diff options
author | Tanner Gooding <tannergooding@users.noreply.github.com> | 2017-03-22 22:44:40 -0700 |
---|---|---|
committer | Dan Moseley <danmose@microsoft.com> | 2017-03-22 22:44:40 -0700 |
commit | 72c57d9d9fd2d4cd8c96f124d132d316c8ef6013 (patch) | |
tree | 33e4152de6b9e38f575c2e1782cd29f6beb36644 /src/classlibnative | |
parent | ab0fbce6b629d081c1102d353abab0d8febd4487 (diff) | |
download | coreclr-72c57d9d9fd2d4cd8c96f124d132d316c8ef6013.tar.gz coreclr-72c57d9d9fd2d4cd8c96f124d132d316c8ef6013.tar.bz2 coreclr-72c57d9d9fd2d4cd8c96f124d132d316c8ef6013.zip |
Removing the special handling in classlibnative for atan2(±∞, ±∞) and pow(-1.0, ±∞). (#10295)
* Removing the special handling in classlibnative for atan2(±∞, ±∞) and pow(-1.0, ±∞).
* Fixing up the logic for HAVE_COMPATIBLE_POW in the PAL layer.
Diffstat (limited to 'src/classlibnative')
-rw-r--r-- | src/classlibnative/float/floatdouble.cpp | 27 | ||||
-rw-r--r-- | src/classlibnative/float/floatsingle.cpp | 31 |
2 files changed, 0 insertions, 58 deletions
diff --git a/src/classlibnative/float/floatdouble.cpp b/src/classlibnative/float/floatdouble.cpp index d9603c0636..6f593e503c 100644 --- a/src/classlibnative/float/floatdouble.cpp +++ b/src/classlibnative/float/floatdouble.cpp @@ -9,8 +9,6 @@ #include "floatdouble.h" -#define IS_DBL_INFINITY(x) (((*((INT64*)((void*)&x))) & I64(0x7FFFFFFFFFFFFFFF)) == I64(0x7FF0000000000000)) - // The default compilation mode is /fp:precise, which disables floating-point intrinsics. This // default compilation mode has previously caused performance regressions in floating-point code. // We enable /fp:fast semantics for the majority of the math functions, as it will speed up performance @@ -86,13 +84,6 @@ FCIMPLEND FCIMPL2_VV(double, COMDouble::Atan2, double y, double x) FCALL_CONTRACT; - // atan2(+/-INFINITY, +/-INFINITY) produces +/-0.78539816339744828 (x is +INFINITY) and - // +/-2.3561944901923448 (x is -INFINITY) instead of the expected value of NaN. We handle - // that case here ourselves. - if (IS_DBL_INFINITY(y) && IS_DBL_INFINITY(x)) { - return (double)(y / x); - } - return (double)atan2(y, x); FCIMPLEND @@ -174,24 +165,6 @@ FCIMPLEND FCIMPL2_VV(double, COMDouble::Pow, double x, double y) FCALL_CONTRACT; - // The CRT version of pow preserves the NaN payload of x over the NaN payload of y. - - if(_isnan(y)) { - return y; // IEEE 754-2008: NaN payload must be preserved - } - - if(_isnan(x)) { - return x; // IEEE 754-2008: NaN payload must be preserved - } - - // The CRT version of pow does not return NaN for pow(-1.0, +/-INFINITY) and - // instead returns +1.0. - - if(IS_DBL_INFINITY(y) && (x == -1.0)) { - INT64 result = CLR_NAN_64; - return (*((double*)((INT64*)&result))); - } - return (double)pow(x, y); FCIMPLEND diff --git a/src/classlibnative/float/floatsingle.cpp b/src/classlibnative/float/floatsingle.cpp index c84c0bfb93..c7b7d4126b 100644 --- a/src/classlibnative/float/floatsingle.cpp +++ b/src/classlibnative/float/floatsingle.cpp @@ -9,18 +9,12 @@ #include "floatsingle.h" -#define IS_FLT_INFINITY(x) (((*((INT32*)((void*)&x))) & 0x7FFFFFFF) == 0x7F800000) - // Windows x86 and Windows ARM/ARM64 may not define _isnanf() or _copysignf() but they do // define _isnan() and _copysign(). We will redirect the macros to these other functions if // the macro is not defined for the platform. This has the side effect of a possible implicit // upcasting for arguments passed in and an explicit downcasting for the _copysign() call. #if (defined(_TARGET_X86_) || defined(_TARGET_ARM_) || defined(_TARGET_ARM64_)) && !defined(FEATURE_PAL) -#if !defined(_isnanf) -#define _isnanf _isnan -#endif - #if !defined(_copysignf) #define _copysignf (float)_copysign #endif @@ -88,13 +82,6 @@ FCIMPLEND FCIMPL2_VV(float, COMSingle::Atan2, float y, float x) FCALL_CONTRACT; - // atan2f(+/-INFINITY, +/-INFINITY) produces +/-0.785398163f (x is +INFINITY) and - // +/-2.35619449f (x is -INFINITY) instead of the expected value of NaN. We handle - // that case here ourselves. - if (IS_FLT_INFINITY(y) && IS_FLT_INFINITY(x)) { - return (float)(y / x); - } - return (float)atan2f(y, x); FCIMPLEND @@ -176,24 +163,6 @@ FCIMPLEND FCIMPL2_VV(float, COMSingle::Pow, float x, float y) FCALL_CONTRACT; - // The CRT version of pow preserves the NaN payload of x over the NaN payload of y. - - if(_isnanf(y)) { - return y; // IEEE 754-2008: NaN payload must be preserved - } - - if(_isnanf(x)) { - return x; // IEEE 754-2008: NaN payload must be preserved - } - - // The CRT version of powf does not return NaN for powf(-1.0f, +/-INFINITY) and - // instead returns +1.0f. - - if(IS_FLT_INFINITY(y) && (x == -1.0f)) { - INT32 result = CLR_NAN_32; - return (*((float*)((INT32*)&result))); - } - return (float)powf(x, y); FCIMPLEND |