Skip to content
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

NaN? #11

Open
jamesdbrock opened this issue Dec 8, 2022 · 1 comment
Open

NaN? #11

jamesdbrock opened this issue Dec 8, 2022 · 1 comment

Comments

@jamesdbrock
Copy link
Member

-- | Uses `Math.fround()` to convert to a `Float32`.
-- | Returns *0.0* when outside the range.
fromNumber' :: Number -> Float32
fromNumber' x = case fromNumber x of
Nothing -> Float32 0.0
Just y -> y

Is NaN a member of the Float32 type?

Maybe this should overflow to NaN rather than 0.0?

@jamesdbrock
Copy link
Member Author

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround

If the number is outside the range of a 32-bit float, Infinity or -Infinity is returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant