Closed mathetake closed 1 hour ago
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
@golang/riscv64
Very probably ad377e906a8ee6f27545d83de280206dacec1e58 cc @mengzhuo
Yes, that riscv64 assembly looks bad. It converts float64->int64->float64, which doesn't work if the input float is bigger than 2^63-1. (For your example it is 2^64-2^11, I think, but generally it is a problem for very large floats.) We could probably compare |input|
to a large value and if it is bigger than 2^53 (or whatever the last fractional float is), return the input. (And maybe we could do that instead of the Inf comparison?)
Change https://go.dev/cl/596516 mentions this issue: math: remove riscv64 assembly implementations of rounding
Go version
go version go1.23rc1 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
I created the following reproducer
What did you see happen?
I cross compiled the test with GOOS=linux GOARCH=riscv64, and run it in the qemu environment. Then the test passed with Go 1.22 but was failing with Go 1.23rc1.
What did you expect to see?
The test passes.