-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-123836: workaround fmod(x, y) bug on Windows #124171
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
Changes from 1 commit
065f4bf
49c13a6
d3a0af6
aedcf74
fbecd8b
5a15cbe
32aa012
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,21 @@ | |
| } | ||
|
|
||
| #define m_log1p _Py_log1p | ||
|
|
||
| static double | ||
| _Py_fmod(double x, double y) | ||
|
Check warning on line 28 in Modules/_math.h
|
||
| { | ||
| /* Some platforms (e.g. Windows 10 with MSC v.1916) loose sign | ||
| for zero result. But C99+ says: "if y is nonzero, the result | ||
| has the same sign as x". | ||
| */ | ||
| double r = fmod(x, y); | ||
|
|
||
| if (r == 0.0 && y != 0.0) { | ||
|
||
| r = copysign(r, x); | ||
| } | ||
|
|
||
| return r; | ||
| } | ||
|
|
||
| #define m_fmod _Py_fmod | ||
Uh oh!
There was an error while loading. Please reload this page.