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.Cos(double.MaxValue) returns different values on Windows and other platforms #5616
Comments
|
@janvorli PTAL |
|
Here is top of the call stack of the Math.Cos invocation on Linux: and here is the source: FCIMPL1_V(double, COMDouble::Cos, double d)
FCALL_CONTRACT;
return (double) cos(d);
FCIMPLENDSo the behavior clearly reflects the C++ math library |
|
Yes, this is what I expected to be the cause, but it's good to have confirmation. I am fine with this behavior difference as well, but I wanted to call it out to make sure it had seen some scrutiny other than my own. I'm not sure if we have a list of such low-level behavioral differences, but if we do we should document this one. |
|
I am not aware of such a list. @richlander do we have some doc where a list of platform specific differences as @mellinoe has suggested would fit? |
|
@leecow @blackdwarf Can you please add this to the documented difference list we prepare for each release? |
|
I can see a reference to this issue was added to https://github.com/dotnet/core/blob/master/release-notes/1.1/1.1.0-preview1-known-issues.md, so I am closing this issue. |
|
Would adding a math library that has matching results on all platforms be worth it? Java has a |
Scenario:
Expected behavior
double.MaxValue is returned according to the .NET Framework documentation:
Actual behavior
on Windows,
double.MaxValueis returned. On my Ubuntu test machine, -0.999987689... is returned.This may be an acceptable difference in behavior, as long as we've acknowledged it. It seems like we could easily match this behavior by doing some parameter boundary checks, but it may not be worth it. I'm assuming this behavior difference is coming from the native cosine functions we are using.
The text was updated successfully, but these errors were encountered: