Updating floatdouble and floatsingle to work around an incorrect result under /fp...
authorTanner Gooding <tagoo@outlook.com>
Wed, 29 Aug 2018 00:28:20 +0000 (17:28 -0700)
committerTanner Gooding <tagoo@outlook.com>
Wed, 29 Aug 2018 23:31:27 +0000 (16:31 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/91eeb98c500d7d841f49eec7916d8c24d61d0eed

src/coreclr/src/classlibnative/float/floatdouble.cpp
src/coreclr/src/classlibnative/float/floatsingle.cpp

index 5911901..abce73d 100644 (file)
@@ -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=====================================
 **
 ==============================================================================*/
index 0be1ad7..2fac42f 100644 (file)
@@ -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======================================
 **
 ==============================================================================*/