05 2020 档案

选择排序
摘要:func main(){ a := []int{1, 9, 2, 8, 3, 7, 4, 6, 5, 10} for i:=0;i<len(a)-1;i++{ max := i for j:=i+1;j<len(a);j++{ if a[j] > a[max]{ max = j } } a[i],a 阅读全文

posted @ 2020-05-21 09:11 thotf 阅读(96) 评论(0) 推荐(0)

小数精度丢失问题
摘要:例子: x := 74.96 y := 20.48 b := x - y fmt.Println(b) //output: 54.47999999999999 上面是使用普通编码 硬编码的方式如下: fmt.Println(74.96-20.48) //54.48 百度关于硬编码的解释一堆话 以上的 阅读全文

posted @ 2020-05-04 19:15 thotf 阅读(413) 评论(0) 推荐(0)

导航