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

math: Modf error with negative zero #12867

Closed
ssilverman opened this issue Oct 7, 2015 · 4 comments
Closed

math: Modf error with negative zero #12867

ssilverman opened this issue Oct 7, 2015 · 4 comments
Milestone

Comments

@ssilverman
Copy link

Since math.Modf(-0.333) produces -0 and -0.333, shouldn't calling math.Modf on negative zero produce -0 and -0?

Example code:
http://play.golang.org/p/pJMBWAXiYa

I create negative zero via: 1 / math.Inf(-1)

@ianlancetaylor ianlancetaylor changed the title math.Modf error with negative zero math: Modf error with negative zero Oct 7, 2015
@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Oct 7, 2015
@griesemer
Copy link
Contributor

I think it's a bug. The result is 0, -0 which doesn't add up to -0 as it should.

(FYI, you can create a -0 more easily: http://play.golang.org/p/KTgiTOAZl0)

@griesemer griesemer self-assigned this Oct 7, 2015
@cldorian
Copy link
Contributor

cldorian commented Oct 7, 2015

@griesemer, I can fix this if you wish. The remaining problem I have is that the x87 version returns -0, 0 rather than -0, -0, so it will need to either be fixed or discarded.

@griesemer
Copy link
Contributor

@cldorian please go ahead, thanks!

@gopherbot
Copy link

CL https://golang.org/cl/15570 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants