-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
add math.signbit #16592
add math.signbit #16592
Conversation
cast[uint](NaN)
differs at CT vs RT; `-NaN and NaN have same bit representation
timotheecour/Nim#499
We target C89 though. Also, why do we need it? One can always cast to uint64 and check the sign bit. |
plenty of code in stdlib use functions that require >= C99, see https://en.wikibooks.org/wiki/C_Programming/math.h, so there's no reason to single this one out; future work can improve general support for C89 (via
that wouldn't be portable, it'd depend on the FP type, endian-ness, architecture; note that FP endian-ness is not simple, eg see https://en.wikipedia.org/wiki/Endianness
etc... |
It is useful for making copysign work robust in JS backend. It is also useful for making nan consistent in CT and RT |
C99 function
Ref timotheecour#505