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)`.

Here is the code example: https://go.dev/play/p/Au0YCVKYas8

The output is:
```
4895412794951729152
1111111111111111111111111111111111111111111111111111111111111111
1.8446744073709552e+19
4895412794951729152
4895412794951729152
9223372036854775808
```
The 4895412794951729152 is output by math.Float64Bits and the value 
9223372036854775808 is directly begot from `uint64(f)`.

I am still confusing where the 9223372036854775808 comes from. Could you 
kindly help me if you have some ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/eaa5da30-5545-47c5-96aa-a3b0a2eeb1e4n%40googlegroups.com.

Reply via email to