You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import"runtime"funcmain() {
varf64float64=-2.99println(runtime.GOARCH)
println("casting float64 to uint64 given negative num", f64, uint64(f64))
}
amd64 result:
amd64
casting float64 to uint64 given negative num -2.990000e+000 18446744073709551614
arm64 result:
arm64
casting float64 to uint64 given negative num -2.990000e+000 0
What did you expect to see?
The behavior of casting a negative float to unsigned int should be the same on different platforms, just like rust.
What did you see instead?
varxfloat64=-2.99uint64(x) ==0
The text was updated successfully, but these errors were encountered:
In all non-constant conversions involving floating-point or complex values, if the result type cannot represent the value the conversion succeeds but the result value is implementation-dependent.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
amd64 result:
arm64 result:
What did you expect to see?
The behavior of casting a negative float to unsigned int should be the same on different platforms, just like rust.
What did you see instead?
The text was updated successfully, but these errors were encountered: