-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go 1.12 & 1.13 floating-point bug prevents encoding signalling NaN values #93
Comments
If Go 1.15 resolves golang/go#36400 in Bumping library requirements to Go 1.15 isn't a good idea until 1.16 or 1.17 is released. So that's 1+ years from now unless there's a workaround. EDIT: Never mind, Keith Randall's suggested workaround works great with Go 1.12 and makes these two bugs irrelevant. |
golang/go#36399 discussion mentioned there could be tests added to Go to determine if other architectures like ARMv8 or POWER8 force quiet bit = 1 when casting non-const floats to other sizes. |
Some Go 1.12 and Go 1.13 bugs are preventing CBOR encoder from encoding sNaN values without them becoming qNaN values. This is a blocker for #91.
Works: Casting float32 to float64 directly doesn't turn sNaN into qNaN, which is good.
Go bug 1: Casting a float64 to float32 turns sNaN into qNaN.
Go bug 2:
func (Value) Float
in Go'sreflect
package turns float32 sNaN into float64 qNaN.I wrote code to convert NaN while preserving signalling at cbor-go/float16 in
FromNaN32ps
. Its for float32 to float16 (IEEE 754 binary16) but the same principal applies.Here are the reproducers for bug 1 and 2.
Bug 1: https://play.golang.org/p/kzLI9A07wRv
Bug 2: https://play.golang.org/p/T7orv6p_C6h
The text was updated successfully, but these errors were encountered: