TEST(math, __fpclassifyl) { EXPECT_EQ(FP_INFINITE, __fpclassifyl(HUGE_VALL)); EXPECT_EQ(FP_NAN, __fpclassifyl(nanl(""))); EXPECT_EQ(FP_NORMAL, __fpclassifyl(1.0L)); EXPECT_EQ(FP_SUBNORMAL, __fpclassifyl(ldouble_subnormal())); EXPECT_EQ(FP_ZERO, __fpclassifyl(0.0L)); }
TEST(math, __fpclassifyl) { #if defined(__BIONIC__) EXPECT_EQ(FP_INFINITE, __fpclassifyl(HUGE_VALL)); EXPECT_EQ(FP_NAN, __fpclassifyl(nanl(""))); EXPECT_EQ(FP_NORMAL, __fpclassifyl(1.0)); EXPECT_EQ(FP_SUBNORMAL, __fpclassifyl(double_subnormal())); EXPECT_EQ(FP_ZERO, __fpclassifyl(0.0)); #else // __BIONIC__ GTEST_LOG_(INFO) << "This test does nothing.\n"; #endif // __BIONIC__ }
int __isnormall(long double ld) { return (__fpclassifyl(ld) == FP_NORMAL); }
int __isfinitel(long double ld) { int type = __fpclassifyl(ld); return ((type != FP_NAN) && (type != FP_INFINITE)); }
int __isnanl(long double ld) { return (__fpclassifyl(ld) == FP_NAN); }
int __isinfl(long double ld) { return (__fpclassifyl(ld) == FP_INFINITE); }
char *__g_xfmt (char *buf, void *V, int ndig, size_t bufsize) { static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; char *b, *s, *se; ULong bits[2], sign; UShort *L; int decpt, ex, i, mode; #if defined(__MINGW32__) || defined(__MINGW64__) int fptype = __fpclassifyl (*(long double*) V); #endif /* MinGW */ #ifdef Honor_FLT_ROUNDS #include "gdtoa_fltrnds.h" #else #define fpi &fpi0 #endif if (ndig < 0) ndig = 0; if (bufsize < ndig + 10) return 0; L = (UShort *)V; sign = L[_0] & 0x8000; ex = L[_0] & 0x7fff; bits[1] = (L[_1] << 16) | L[_2]; bits[0] = (L[_3] << 16) | L[_4]; #if defined(__MINGW32__) || defined(__MINGW64__) if (fptype & FP_NAN) { /* NaN or Inf */ if (fptype & FP_NORMAL) { b = buf; *b++ = sign ? '-': '+'; strncpy (b, "Infinity", ndig ? ndig : 8); return (buf + strlen (buf)); } strncpy (buf, "NaN", ndig ? ndig : 3); return (buf + strlen (buf)); } else if (fptype & FP_NORMAL) { /* Normal or subnormal */ if (fptype & FP_ZERO) { i = STRTOG_Denormal; ex = 1; } else i = STRTOG_Normal; } #else if (ex != 0) { if (ex == 0x7fff) { /* Infinity or NaN */ if (bits[0] | bits[1]) b = strcp(buf, "NaN"); else { b = buf; if (sign) *b++ = '-'; b = strcp(b, "Infinity"); } return b; } i = STRTOG_Normal; } else if (bits[0] | bits[1]) { i = STRTOG_Denormal; ex = 1; } #endif else { /* i = STRTOG_Zero; */ b = buf; #ifndef IGNORE_ZERO_SIGN if (sign) *b++ = '-'; #endif *b++ = '0'; *b = 0; return b; } ex -= 0x3fff + 63; mode = 2; if (ndig <= 0) { if (bufsize < 32) return 0; mode = 0; } s = __gdtoa(fpi, ex, bits, &i, mode, ndig, &decpt, &se); return __g__fmt(buf, s, se, decpt, sign, bufsize); }
static int testl(long double long_double_x, int int_x, long long_x) { int r = 0; r += __finitel(long_double_x); r += __fpclassifyl(long_double_x); r += __isinfl(long_double_x); r += __isnanl(long_double_x); r += __signbitl(long_double_x); r += acoshl(long_double_x); r += acosl(long_double_x); r += asinhl(long_double_x); r += asinl(long_double_x); r += atan2l(long_double_x, long_double_x); r += atanhl(long_double_x); r += atanl(long_double_x); r += cbrtl(long_double_x); r += ceill(long_double_x); r += copysignl(long_double_x, long_double_x); r += coshl(long_double_x); r += cosl(long_double_x); r += erfcl(long_double_x); r += erfl(long_double_x); r += exp2l(long_double_x); r += expl(long_double_x); r += expm1l(long_double_x); r += fabsl(long_double_x); r += fdiml(long_double_x, long_double_x); r += floorl(long_double_x); r += fmal(long_double_x, long_double_x, long_double_x); r += fmaxl(long_double_x, long_double_x); r += fminl(long_double_x, long_double_x); r += fmodl(long_double_x, long_double_x); r += frexpl(long_double_x, &int_x); r += hypotl(long_double_x, long_double_x); r += ilogbl(long_double_x); r += ldexpl(long_double_x, int_x); r += lgammal(long_double_x); r += llrintl(long_double_x); r += llroundl(long_double_x); r += log10l(long_double_x); r += log1pl(long_double_x); r += log2l(long_double_x); r += logbl(long_double_x); r += logl(long_double_x); r += lrintl(long_double_x); r += lroundl(long_double_x); r += modfl(long_double_x, &long_double_x); r += nearbyintl(long_double_x); r += nextafterl(long_double_x, long_double_x); r += nexttowardl(long_double_x, long_double_x); r += powl(long_double_x, long_double_x); r += remainderl(long_double_x, long_double_x); r += remquol(long_double_x, long_double_x, &int_x); r += rintl(long_double_x); r += roundl(long_double_x); r += scalblnl(long_double_x, long_x); r += scalbnl(long_double_x, int_x); r += sinhl(long_double_x); r += sinl(long_double_x); r += sqrtl(long_double_x); r += tanhl(long_double_x); r += tanl(long_double_x); r += tgammal(long_double_x); r += truncl(long_double_x); return r; }