38 static partial class fdlibm
40 internal static double floor(
double x)
42 const double huge = 1.0e300;
48 j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
55 if (i0 >= 0) { i0 = i1 = 0; }
56 else if (((i0 & 0x7fffffff) | i1) != 0)
57 { i0 = unchecked((
int)0xbff00000); i1 = 0; }
63 if (((i0 & (
int)i) | i1) == 0)
return x;
66 if (i0 < 0) i0 += (0x00100000) >> j0;
67 i0 &= (~(int)i); i1 = 0;
73 if (j0 == 0x400)
return x + x;
78 i = ((
unsigned)(0xffffffff)) >> (j0 - 20);
79 if ((i1 & i) == 0)
return x;
84 if (j0 == 20) i0 += 1;
87 j = (
unsigned)(i1 + (1 << (52 - j0)));