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

preserve sign of NaN in conversions to and from BigFloat #25378

Merged
merged 1 commit into from
Jan 5, 2018

Conversation

JeffBezanson
Copy link
Sponsor Member

Looking at #5290 led me to finding various issues with the sign bit of NaN, which, let's be honest, is basically what most issues boil down to.

I don't know if this really matters, but our other floating point conversions preserve the sign of NaN so I figure these should too. Currently we get e.g.:

julia> signbit(big(NaN))  # ok
false

julia> signbit(Float64(big(NaN)))  # not ok
true

julia> copysign(1.0, big(NaN))  # not ok
-1.0

julia> signbit(big(-NaN))  # not ok
false

Maybe this is a bug in MPFR; not sure.

@JeffBezanson JeffBezanson added the maths Mathematical functions label Jan 3, 2018
@StefanKarpinski
Copy link
Sponsor Member

StefanKarpinski commented Jan 4, 2018

led me to finding various issues with the sign bit of NaN, which, let's be honest, is basically what most issues boil down to.

🤣

It does seem like MPFR should perhaps handle this better; fixing it ourselves is probably the right approach and maybe filing an upstream bug report.

@JeffBezanson JeffBezanson merged commit b8b4fb3 into master Jan 5, 2018
@JeffBezanson JeffBezanson deleted the jb/bigfloatnansign branch January 5, 2018 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maths Mathematical functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants