- Notifications
You must be signed in to change notification settings - Fork3.2k
ch1-basic/ch1-03-array-string-and-slice#622
-
ch1-basic/ch1-03-array-string-and-sliceGo语言高级编程 https://chai2010.cn/advanced-go-programming-book/ch1-basic/ch1-03-array-string-and-slice.html |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 6 comments 6 replies
-
成功数 = copy(目标数据, 原数据) |
BetaWas this translation helpful?Give feedback.
All reactions
-
SortFloat64FastV这种排序有问题,float64类型指数的起始数为011 1111 1111, -1.0内存里存的是1 011 1111 1111 0....,-2.0存的是1 100 0000 0000 0....,这就导致了排序后-2.0>-1.0 |
BetaWas this translation helpful?Give feedback.
All reactions
👍 4
-
你的机器32位 还是 64位 |
BetaWas this translation helpful?Give feedback.
All reactions
-
64位机器的int也是32位的 |
BetaWas this translation helpful?Give feedback.
All reactions
-
func main() { func SortFloat64FastV2(a []float64) { } output: [-1.1 -10 0 1 1.1 2 3 4] 确实有问题 |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
int 不是 32bit吗?为什么可以吧float64转换成int? |
BetaWas this translation helpful?Give feedback.
All reactions
-
没注意到注释说用的是64位机器,当我没说过 |
BetaWas this translation helpful?Give feedback.
All reactions
-
64位机器,int也是32位啊,long才是64位 |
BetaWas this translation helpful?Give feedback.
All reactions
-
@miziaiba 64位机器,int不是64位吗 |
BetaWas this translation helpful?Give feedback.
All reactions
-
写的还是很好的 |
BetaWas this translation helpful?Give feedback.
All reactions
-
用 for range 方式迭代的性能可能会更好一些 |
BetaWas this translation helpful?Give feedback.
All reactions
-
针对这个问题,特地做了一下测试,fori的性能更好一些 |
BetaWas this translation helpful?Give feedback.