diff options
author | Tanner Gooding <tagoo@outlook.com> | 2018-08-28 17:28:20 -0700 |
---|---|---|
committer | Tanner Gooding <tagoo@outlook.com> | 2018-08-29 16:31:27 -0700 |
commit | 91eeb98c500d7d841f49eec7916d8c24d61d0eed (patch) | |
tree | b5104cf2811eaae719f58930d63fcb2e1ea7c749 | |
parent | c46e7eec10e3c697ae24350b85b8ae4c424f5d4a (diff) | |
download | coreclr-91eeb98c500d7d841f49eec7916d8c24d61d0eed.tar.gz coreclr-91eeb98c500d7d841f49eec7916d8c24d61d0eed.tar.bz2 coreclr-91eeb98c500d7d841f49eec7916d8c24d61d0eed.zip |
Updating floatdouble and floatsingle to work around an incorrect result under /fp:fast
-rw-r--r-- | src/classlibnative/float/floatdouble.cpp | 18 | ||||
-rw-r--r-- | src/classlibnative/float/floatsingle.cpp | 9 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/classlibnative/float/floatdouble.cpp b/src/classlibnative/float/floatdouble.cpp index 5911901000..abce73d9dd 100644 --- a/src/classlibnative/float/floatdouble.cpp +++ b/src/classlibnative/float/floatdouble.cpp @@ -123,6 +123,11 @@ FCIMPL1_V(double, COMDouble::Cbrt, double x) return (double)cbrt(x); FCIMPLEND +#if defined(_MSC_VER) && defined(_TARGET_AMD64_) +// The /fp:fast form of `ceil` for AMD64 does not correctly handle: `-1.0 < value <= -0.0` +#pragma float_control(precise, on ) +#endif + /*====================================Ceil====================================== ** ==============================================================================*/ @@ -132,6 +137,10 @@ FCIMPL1_V(double, COMDouble::Ceil, double x) return (double)ceil(x); FCIMPLEND +#if defined(_MSC_VER) && defined(_TARGET_AMD64_) +#pragma float_control(precise, off) +#endif + /*=====================================Cos====================================== ** ==============================================================================*/ @@ -159,6 +168,11 @@ FCIMPL1_V(double, COMDouble::Exp, double x) return (double)exp(x); FCIMPLEND +#if defined(_MSC_VER) && defined(_TARGET_X86_) +// The /fp:fast form of `floor` for x86 does not correctly handle: `-0.0` +#pragma float_control(precise, on ) +#endif + /*====================================Floor===================================== ** ==============================================================================*/ @@ -168,6 +182,10 @@ FCIMPL1_V(double, COMDouble::Floor, double x) return (double)floor(x); FCIMPLEND +#if defined(_MSC_VER) && defined(_TARGET_X86_) +#pragma float_control(precise, off) +#endif + /*=====================================FMod===================================== ** ==============================================================================*/ diff --git a/src/classlibnative/float/floatsingle.cpp b/src/classlibnative/float/floatsingle.cpp index 0be1ad7318..2fac42f489 100644 --- a/src/classlibnative/float/floatsingle.cpp +++ b/src/classlibnative/float/floatsingle.cpp @@ -121,6 +121,11 @@ FCIMPL1_V(float, COMSingle::Cbrt, float x) return (float)cbrtf(x); FCIMPLEND +#if defined(_MSC_VER) && defined(_TARGET_AMD64_) +// The /fp:fast form of `ceilf` for AMD64 does not correctly handle: `-1.0 < value <= -0.0` +#pragma float_control(precise, on ) +#endif + /*====================================Ceil====================================== ** ==============================================================================*/ @@ -130,6 +135,10 @@ FCIMPL1_V(float, COMSingle::Ceil, float x) return (float)ceilf(x); FCIMPLEND +#if defined(_MSC_VER) && defined(_TARGET_AMD64_) +#pragma float_control(precise, off) +#endif + /*=====================================Cos====================================== ** ==============================================================================*/ |