Re: [go-nuts] Question in Converting float64 to uint64

2023-10-25 Thread Eli Lindsey
Float64Bits preserves the underlying representation. The numeric value of the uint64 it returns has little significance. You’d typically use it when serializing floats, when wanting to make manual changes to the float’s representation, and so on. uint64(f) cares about preserving the numeric val

[go-nuts] Question in Converting float64 to uint64

2023-10-25 Thread Xie Yuchen
Hi Guys, recently, I've been learning the number types conversion. I learned about the ieee 754 round to even when golang converts from uint64 to float64. However, when I want to convert the float64 to uint64 back, there is a different between functions: `math.Float64Bits` and use `uint64(f)`.