From ad3c8cc8934ec89631c221713b86238f6c86e1b6 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Thu, 30 Aug 2018 10:09:59 -0700 Subject: Updating Number.Formatting to properly print -0 --- src/pal/inc/pal.h | 2 ++ src/pal/src/cruntime/math.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) (limited to 'src/pal') diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h index e7ec886e87..2d0c47177b 100644 --- a/src/pal/inc/pal.h +++ b/src/pal/inc/pal.h @@ -4459,6 +4459,7 @@ PALIMPORT LONG __cdecl labs(LONG); // clang complains if this is declared with __int64 PALIMPORT long long __cdecl llabs(long long); +PALIMPORT int __cdecl _signbit(double); PALIMPORT int __cdecl _finite(double); PALIMPORT int __cdecl _isnan(double); PALIMPORT double __cdecl _copysign(double, double); @@ -4487,6 +4488,7 @@ PALIMPORT double __cdecl sqrt(double); PALIMPORT double __cdecl tan(double); PALIMPORT double __cdecl tanh(double); +PALIMPORT int __cdecl _signbitf(float); PALIMPORT int __cdecl _finitef(float); PALIMPORT int __cdecl _isnanf(float); PALIMPORT float __cdecl _copysignf(float, float); diff --git a/src/pal/src/cruntime/math.cpp b/src/pal/src/cruntime/math.cpp index a36ac9aa93..af2f99416e 100644 --- a/src/pal/src/cruntime/math.cpp +++ b/src/pal/src/cruntime/math.cpp @@ -43,6 +43,34 @@ Abstract: SET_DEFAULT_DEBUG_CHANNEL(CRT); +/*++ +Function: + _signbit + +Determines whether given double-precision floating point value has a negative sign. + +Return Value + +_signbit returns a nonzero value (TRUE) if the sign of its argument x is negative. + +Parameter + +x Double-precision floating-point value + +--*/ +int __cdecl _signbit(double x) +{ + int ret; + PERF_ENTRY(_signbit); + ENTRY("_signbit (x=%f)\n", x); + + ret = signbit(x); + + LOGEXIT("_signbit returns int %d\n", ret); + PERF_EXIT(_signbit); + return ret; +} + /*++ Function: _finite @@ -453,6 +481,34 @@ PALIMPORT double __cdecl PAL_pow(double x, double y) return ret; } +/*++ +Function: + _signbitf + +Determines whether given single-precision floating point value has a negative sign. + +Return Value + +_signbitf returns a nonzero value (TRUE) if the sign of its argument x is negative. + +Parameter + +x Single-precision floating-point value + +--*/ +int __cdecl _signbitf(float x) +{ + int ret; + PERF_ENTRY(_signbitf); + ENTRY("_signbitf (x=%f)\n", x); + + ret = signbit(x); + + LOGEXIT("_signbitf returns int %d\n", ret); + PERF_EXIT(_signbitf); + return ret; +} + /*++ Function: _finitef -- cgit v1.2.3