-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
Document why mod2pi(2pi) != 0 #5537
Comments
julia> mod2pi(nextfloat(2pi))
6.432490598706546e-16
julia> big(2pi) < big(2.)pi
true |
Yes, clearly that was the explanation. This is a floating-point gotcha that really should be documented. |
Like this method is crazy good and will give the modules of the exact float you give it, and not make a wild guess for what you might have intended to ask for? |
Yes, in that it computes the modulus relative to numerically exact 2pi rather than its floating-point approximation.
The point is that one can ask for a precise floating point computation that doesn't do what new users would naïvely expect it to do. The behavior |
I'm wondering if @StefanKarpinski was right all those months ago in wanting a |
Floating point accuracy is hard to get right, and it tends to bite fairly hard. I'll use this opportunity to bump my suggestion in #4278 to depreciate |
The text was updated successfully, but these errors were encountered: