diff --git a/Makefile b/Makefile index f9eeab4..74b5da7 100644 --- a/Makefile +++ b/Makefile @@ -73,8 +73,8 @@ QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/quickjs.o $(OBJDIR)/libregexp.o $(OBJDIR)/lib $(OBJDIR)/cutils.o $(OBJDIR)/mocked.o $(OBJDIR)/std_module.o $(OBJDIR)/ckb_module.o $(OBJDIR)/ckb_cell_fs.o \ $(OBJDIR)/libbf.o $(OBJDIR)/cmdopt.o -STD_OBJS=$(OBJDIR)/string_impl.o $(OBJDIR)/malloc_impl.o $(OBJDIR)/math_impl.o \ - $(OBJDIR)/math_log_impl.o $(OBJDIR)/printf_impl.o $(OBJDIR)/stdio_impl.o \ +STD_OBJS=$(OBJDIR)/string_impl.o $(OBJDIR)/malloc_impl.o \ + $(OBJDIR)/printf_impl.o $(OBJDIR)/stdio_impl.o \ $(OBJDIR)/locale_impl.o @@ -103,7 +103,7 @@ $(OBJDIR)/%.o: include/c-stdlib/src/%.c $(OBJDIR)/%.o: include/%.c @echo build $< - @$(CC) $(CFLAGS) -c -o $@ $< + @$(CC) $(CFLAGS2) -c -o $@ $< # $(OBJDIR)/ckb_module.o: quickjs/ckb_module.c # @echo build $< diff --git a/include/c-stdlib/src/math_impl.c b/include/c-stdlib/src/math_impl.c deleted file mode 100644 index 82f516e..0000000 --- a/include/c-stdlib/src/math_impl.c +++ /dev/null @@ -1,262 +0,0 @@ -#include "../my_math.h" -#include -#include "my_stdio.h" -#include "my_assert.h" - -#ifndef DBL_EPSILON -#define DBL_EPSILON 2.22044604925031308085e-16 -#endif - -double acos(double x) { - assert(0); - return 0; -} - -double asin(double x) { - assert(0); - return 0; -} - -double atan2(double x, double y) { - assert(0); - return 0; -} - -double cos(double x) { - assert(0); - return 0; -} - -double cosh(double x) { - assert(0); - return 0; -} - -double exp(double x) { - assert(0); - return 0; -} - -#define EPS DBL_EPSILON -double floor(double x) { - static const double toint = 1 / EPS; - union { - double f; - uint64_t i; - } u = {x}; - int e = u.i >> 52 & 0x7ff; - double y; - - if (e >= 0x3ff + 52 || x == 0) return x; - /* y = int(x) - x, where int(x) is an integer neighbor of x */ - if (u.i >> 63) - y = x - toint + toint - x; - else - y = x + toint - toint - x; - /* special case because of non-nearest rounding modes */ - if (e <= 0x3ff - 1) { - FORCE_EVAL(y); - return u.i >> 63 ? -1 : 0; - } - if (y > 0) return x + y - 1; - return x + y; -} - -double ceil(double x) { - static const double toint = 1 / EPS; - union { - double f; - uint64_t i; - } u = {x}; - int e = u.i >> 52 & 0x7ff; - double y; - - if (e >= 0x3ff + 52 || x == 0) return x; - /* y = int(x) - x, where int(x) is an integer neighbor of x */ - if (u.i >> 63) - y = x - toint + toint - x; - else - y = x + toint - toint - x; - /* special case because of non-nearest rounding modes */ - if (e <= 0x3ff - 1) { - FORCE_EVAL(y); - return u.i >> 63 ? -0.0 : 1; - } - if (y < 0) return x + y + 1; - return x + y; -} - -double fabs(double x) { - union { - double f; - uint64_t i; - } u = {x}; - u.i &= -1ULL / 2; - return u.f; -} - -double ldexp(double x, int n) { return scalbn(x, n); } - -double log2(double x) { - assert(0); - return 0; -} - -double log10(double x) { - assert(0); - return 0; -} - -double sin(double x) { - assert(0); - return 0; -} - -double sinh(double x) { - assert(0); - return 0; -} - -double sqrt(double x) { - assert(0); - return 0; -} - -double tan(double x) { - assert(0); - return 0; -} - -double tanh(double x) { - assert(0); - return 0; -} - -double rint(double x) { - static const double toint = 1 / EPS; - union { - double f; - uint64_t i; - } u = {x}; - int e = u.i >> 52 & 0x7ff; - int s = u.i >> 63; - double y; - - if (e >= 0x3ff + 52) return x; - if (s) - y = x - toint + toint; - else - y = x + toint - toint; - if (y == 0) return s ? -0.0 : 0; - return y; -} - -long int lrint(double x) { return rint(x); } - -double cbrt(double x) { - assert(0); - return 0; -} - -double fmod(double numer, double denom); - -double fmin(double x, double y) { return x > y ? y : x; } - -double fmax(double x, double y) { return x < y ? y : x; } - -double hypot(double x, double y) { - assert(0); - return 0; -} - -int signbit(double num) { return num > 0; } - -double frexp(double x, int *e) { - union { - double d; - uint64_t i; - } y = {x}; - int ee = y.i >> 52 & 0x7ff; - - if (!ee) { - if (x) { - x = frexp(x * 0x1p64, e); - *e -= 64; - } else - *e = 0; - return x; - } else if (ee == 0x7ff) { - return x; - } - - *e = ee - 0x3fe; - y.i &= 0x800fffffffffffffull; - y.i |= 0x3fe0000000000000ull; - return y.d; -} - -double fmod(double x, double y) { - union { - double f; - uint64_t i; - } ux = {x}, uy = {y}; - int ex = ux.i >> 52 & 0x7ff; - int ey = uy.i >> 52 & 0x7ff; - int sx = ux.i >> 63; - uint64_t i; - - /* in the followings uxi should be ux.i, but then gcc wrongly adds */ - /* float load/store to inner loops ruining performance and code size */ - uint64_t uxi = ux.i; - - if (uy.i << 1 == 0 || __builtin_isnan(y) || ex == 0x7ff) return (x * y) / (x * y); - if (uxi << 1 <= uy.i << 1) { - if (uxi << 1 == uy.i << 1) return 0 * x; - return x; - } - - /* normalize x and y */ - if (!ex) { - for (i = uxi << 12; i >> 63 == 0; ex--, i <<= 1); - uxi <<= -ex + 1; - } else { - uxi &= -1ULL >> 12; - uxi |= 1ULL << 52; - } - if (!ey) { - for (i = uy.i << 12; i >> 63 == 0; ey--, i <<= 1); - uy.i <<= -ey + 1; - } else { - uy.i &= -1ULL >> 12; - uy.i |= 1ULL << 52; - } - - /* x mod y */ - for (; ex > ey; ex--) { - i = uxi - uy.i; - if (i >> 63 == 0) { - if (i == 0) return 0 * x; - uxi = i; - } - uxi <<= 1; - } - i = uxi - uy.i; - if (i >> 63 == 0) { - if (i == 0) return 0 * x; - uxi = i; - } - for (; uxi >> 52 == 0; uxi <<= 1, ex--); - - /* scale result */ - if (ex > 0) { - uxi -= 1ULL << 52; - uxi |= (uint64_t)ex << 52; - } else { - uxi >>= -ex + 1; - } - uxi |= (uint64_t)sx << 63; - ux.i = uxi; - return ux.f; -} - -int abs(int a) { return a > 0 ? a : -a; } diff --git a/include/c-stdlib/src/math_log_impl.c b/include/c-stdlib/src/math_log_impl.c deleted file mode 100644 index 5539cca..0000000 --- a/include/c-stdlib/src/math_log_impl.c +++ /dev/null @@ -1,132 +0,0 @@ -/* @(#)e_log.c 1.3 95/01/18 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -//__FBSDID("$FreeBSD: src/lib/msun/src/e_log.c,v 1.15 2008/03/29 16:37:59 das -// Exp $"); - -/* __ieee754_log(x) - * Return the logrithm of x - * - * Method : - * 1. Argument Reduction: find k and f such that - * x = 2^k * (1+f), - * where sqrt(2)/2 < 1+f < sqrt(2) . - * - * 2. Approximation of log(1+f). - * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) - * = 2s + 2/3 s**3 + 2/5 s**5 + ....., - * = 2s + s*R - * We use a special Reme algorithm on [0,0.1716] to generate - * a polynomial of degree 14 to approximate R The maximum error - * of this polynomial approximation is bounded by 2**-58.45. In - * other words, - * 2 4 6 8 10 12 14 - * R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s +Lg6*s +Lg7*s - * (the values of Lg1 to Lg7 are listed in the program) - * and - * | 2 14 | -58.45 - * | Lg1*s +...+Lg7*s - R(z) | <= 2 - * | | - * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. - * In order to guarantee error in log below 1ulp, we compute log - * by - * log(1+f) = f - s*(f - R) (if f is not too large) - * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy) - * - * 3. Finally, log(x) = k*ln2 + log(1+f). - * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) - * Here ln2 is split into two floating point number: - * ln2_hi + ln2_lo, - * where n*ln2_hi is always exact for |n| < 2000. - * - * Special cases: - * log(x) is NaN with signal if x < 0 (including -INF) ; - * log(+INF) is +INF; log(0) is -INF with signal; - * log(NaN) is that NaN with no signal. - * - * Accuracy: - * according to an error analysis, the error is always less than - * 1 ulp (unit in the last place). - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "my_math.h" -#include -#include "my_float.h" - -double log(double x) { - double hfsq, f, s, z, R, w, t1, t2, dk; - int32_t k, hx, i, j; - uint32_t lx; - - EXTRACT_WORDS(hx, lx, x); - - k = 0; - if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx & 0x7fffffff) | lx) == 0) return -two54 / zero; /* log(+-0)=-inf */ - if (hx < 0) return (x - x) / zero; /* log(-#) = NaN */ - k -= 54; - x *= two54; /* subnormal number, scale up x */ - GET_HIGH_WORD(hx, x); - } - if (hx >= 0x7ff00000) return x + x; - k += (hx >> 20) - 1023; - hx &= 0x000fffff; - i = (hx + 0x95f64) & 0x100000; - SET_HIGH_WORD(x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */ - k += (i >> 20); - f = x - 1.0; - if ((0x000fffff & (2 + hx)) < 3) { /* -2**-20 <= f < 2**-20 */ - if (f == zero) { - if (k == 0) { - return zero; - } else { - dk = (double)k; - return dk * ln2_hi + dk * ln2_lo; - } - } - R = f * f * (0.5 - 0.33333333333333333 * f); - if (k == 0) - return f - R; - else { - dk = (double)k; - return dk * ln2_hi - ((R - dk * ln2_lo) - f); - } - } - s = f / (2.0 + f); - dk = (double)k; - z = s * s; - i = hx - 0x6147a; - w = z * z; - j = 0x6b851 - hx; - t1 = w * (Lg2 + w * (Lg4 + w * Lg6)); - t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7))); - i |= j; - R = t2 + t1; - if (i > 0) { - hfsq = 0.5 * f * f; - if (k == 0) - return f - (hfsq - s * (hfsq + R)); - else - return dk * ln2_hi - ((hfsq - (s * (hfsq + R) + dk * ln2_lo)) - f); - } else { - if (k == 0) - return f - s * (f - R); - else - return dk * ln2_hi - ((s * (f - R) - dk * ln2_lo) - f); - } -} diff --git a/include/c-stdlib/src/math_pow_impl.c b/include/c-stdlib/src/math_pow_impl.c deleted file mode 100644 index b9ff050..0000000 --- a/include/c-stdlib/src/math_pow_impl.c +++ /dev/null @@ -1,329 +0,0 @@ -/* @(#)e_pow.c 1.5 04/04/22 SMI */ -/* - * ==================================================== - * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. - * - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -//__FBSDID("$FreeBSD: src/lib/msun/src/e_pow.c,v 1.14 2011/10/21 06:26:07 das -// Exp $"); - -/* __ieee754_pow(x,y) return x**y - * - * n - * Method: Let x = 2 * (1+f) - * 1. Compute and return log2(x) in two pieces: - * log2(x) = w1 + w2, - * where w1 has 53-24 = 29 bit trailing zeros. - * 2. Perform y*log2(x) = n+y' by simulating muti-precision - * arithmetic, where |y'|<=0.5. - * 3. Return x**y = 2**n*exp(y'*log2) - * - * Special cases: - * 1. (anything) ** 0 is 1 - * 2. (anything) ** 1 is itself - * 3. (anything) ** NAN is NAN - * 4. NAN ** (anything except 0) is NAN - * 5. +-(|x| > 1) ** +INF is +INF - * 6. +-(|x| > 1) ** -INF is +0 - * 7. +-(|x| < 1) ** +INF is +0 - * 8. +-(|x| < 1) ** -INF is +INF - * 9. +-1 ** +-INF is NAN - * 10. +0 ** (+anything except 0, NAN) is +0 - * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 - * 12. +0 ** (-anything except 0, NAN) is +INF - * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF - * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) - * 15. +INF ** (+anything except 0,NAN) is +INF - * 16. +INF ** (-anything except 0,NAN) is +0 - * 17. -INF ** (anything) = -0 ** (-anything) - * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) - * 19. (-anything except 0 and inf) ** (non-integer) is NAN - * - * Accuracy: - * pow(x,y) returns x**y nearly rounded. In particular - * pow(integer,integer) - * always returns the correct integer provided it is - * representable. - * - * Constants : - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ -#include "my_float.h" -#include "my_math.h" -#include - -double copysign(double x, double y) { - uint32_t hx, hy; - GET_HIGH_WORD(hx, x); - GET_HIGH_WORD(hy, y); - SET_HIGH_WORD(x, (hx & 0x7fffffff) | (hy & 0x80000000)); - return x; -} - -double scalbn(double x, int n) { - int32_t k, hx, lx; - EXTRACT_WORDS(hx, lx, x); - k = (hx & 0x7ff00000) >> 20; /* extract exponent */ - if (k == 0) { /* 0 or subnormal x */ - if ((lx | (hx & 0x7fffffff)) == 0) return x; /* +-0 */ - x *= two54; - GET_HIGH_WORD(hx, x); - k = ((hx & 0x7ff00000) >> 20) - 54; - if (n < -50000) return tiny * x; /*underflow*/ - } - if (k == 0x7ff) return x + x; /* NaN or Inf */ - k = k + n; - if (k > 0x7fe) return huge * copysign(huge, x); /* overflow */ - if (k > 0) /* normal result */ - { - SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); - return x; - } - if (k <= -54) { - if (n > 50000) /* in case integer overflow in n+k */ - return huge * copysign(huge, x); /*overflow*/ - else - return tiny * copysign(tiny, x); /*underflow*/ - } - k += 54; /* subnormal result */ - SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); - return x * twom54; -} - -double pow(double x, double y) { - double z, ax, z_h, z_l, p_h, p_l; - double y1, t1, t2, r, s, t, u, v, w; - int32_t i, j, k, yisint, n; - int32_t hx, hy, ix, iy; - uint32_t lx, ly; - - EXTRACT_WORDS(hx, lx, x); - EXTRACT_WORDS(hy, ly, y); - ix = hx & 0x7fffffff; - iy = hy & 0x7fffffff; - - /* y==zero: x**0 = 1 */ - if ((iy | ly) == 0) return one; - - /* x==1: 1**y = 1, even if y is NaN */ - if (hx == 0x3ff00000 && lx == 0) return one; - - /* y!=zero: result is NaN if either arg is NaN */ - if (ix > 0x7ff00000 || ((ix == 0x7ff00000) && (lx != 0)) || iy > 0x7ff00000 || ((iy == 0x7ff00000) && (ly != 0))) - return (x + 0.0) + (y + 0.0); - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if (hx < 0) { - if (iy >= 0x43400000) - yisint = 2; /* even integer y */ - else if (iy >= 0x3ff00000) { - k = (iy >> 20) - 0x3ff; /* exponent */ - if (k > 20) { - j = ly >> (52 - k); - if ((j << (52 - k)) == (int32_t)ly) yisint = 2 - (j & 1); - } else if (ly == 0) { - j = iy >> (20 - k); - if ((j << (20 - k)) == iy) yisint = 2 - (j & 1); - } - } - } - - /* special value of y */ - if (ly == 0) { - if (iy == 0x7ff00000) { /* y is +-inf */ - if (((ix - 0x3ff00000) | lx) == 0) - return one; /* (-1)**+-inf is NaN */ - else if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */ - return (hy >= 0) ? y : zero; - else /* (|x|<1)**-,+inf = inf,0 */ - return (hy < 0) ? -y : zero; - } - if (iy == 0x3ff00000) { /* y is +-1 */ - if (hy < 0) - return one / x; - else - return x; - } - if (hy == 0x40000000) return x * x; /* y is 2 */ - if (hy == 0x40080000) return x * x * x; /* y is 3 */ - if (hy == 0x40100000) { /* y is 4 */ - u = x * x; - return u * u; - } - if (hy == 0x3fe00000) { /* y is 0.5 */ - if (hx >= 0) /* x >= +0 */ - return sqrt(x); - } - } - - ax = fabs(x); - /* special value of x */ - if (lx == 0) { - if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000) { - z = ax; /*x is +-0,+-inf,+-1*/ - if (hy < 0) z = one / z; /* z = (1/|x|) */ - if (hx < 0) { - if (((ix - 0x3ff00000) | yisint) == 0) { - z = (z - z) / (z - z); /* (-1)**non-int is NaN */ - } else if (yisint == 1) - z = -z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - } - - /* CYGNUS LOCAL + fdlibm-5.3 fix: This used to be - n = (hx>>31)+1; - but ANSI C says a right shift of a signed negative quantity is - implementation defined. */ - n = ((uint32_t)hx >> 31) - 1; - - /* (x<0)**(non-int) is NaN */ - if ((n | yisint) == 0) return (x - x) / (x - x); - - s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ - if ((n | (yisint - 1)) == 0) s = -one; /* (-ve)**(odd int) */ - - /* |y| is huge */ - if (iy > 0x41e00000) { /* if |y| > 2**31 */ - if (iy > 0x43f00000) { /* if |y| > 2**64, must o/uflow */ - if (ix <= 0x3fefffff) return (hy < 0) ? huge * huge : tiny * tiny; - if (ix >= 0x3ff00000) return (hy > 0) ? huge * huge : tiny * tiny; - } - /* over/underflow if x is not close to one */ - if (ix < 0x3fefffff) return (hy < 0) ? s * huge * huge : s * tiny * tiny; - if (ix > 0x3ff00000) return (hy > 0) ? s * huge * huge : s * tiny * tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = ax - one; /* t has 20 trailing zeros */ - w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); - u = ivln2_h * t; /* ivln2_h has 21 sig. bits */ - v = t * ivln2_l - w * ivln2; - t1 = u + v; - SET_LOW_WORD(t1, 0); - t2 = v - (t1 - u); - } else { - double ss, s2, s_h, s_l, t_h, t_l; - n = 0; - /* take care subnormal number */ - if (ix < 0x00100000) { - ax *= two53; - n -= 53; - GET_HIGH_WORD(ix, ax); - } - n += ((ix) >> 20) - 0x3ff; - j = ix & 0x000fffff; - /* determine interval */ - ix = j | 0x3ff00000; /* normalize ix */ - if (j <= 0x3988E) - k = 0; /* |x|> 1) | 0x20000000) + 0x00080000 + (k << 18)); - t_l = ax - (t_h - bp[k]); - s_l = v * ((u - s_h * t_h) - s_h * t_l); - /* compute log(ax) */ - s2 = ss * ss; - r = s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); - r += s_l * (s_h + ss); - s2 = s_h * s_h; - t_h = 3.0 + s2 + r; - SET_LOW_WORD(t_h, 0); - t_l = r - ((t_h - 3.0) - s2); - /* u+v = ss*(1+...) */ - u = s_h * t_h; - v = s_l * t_h + t_l * ss; - /* 2/(3log2)*(ss+...) */ - p_h = u + v; - SET_LOW_WORD(p_h, 0); - p_l = v - (p_h - u); - z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = cp_l * p_h + p_l * cp + dp_l[k]; - /* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (double)n; - t1 = (((z_h + z_l) + dp_h[k]) + t); - SET_LOW_WORD(t1, 0); - t2 = z_l - (((t1 - t) - dp_h[k]) - z_h); - } - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - y1 = y; - SET_LOW_WORD(y1, 0); - p_l = (y - y1) * t1 + y * t2; - p_h = y1 * t1; - z = p_l + p_h; - EXTRACT_WORDS(j, i, z); - if (j >= 0x40900000) { /* z >= 1024 */ - if (((j - 0x40900000) | i) != 0) /* if z > 1024 */ - return s * huge * huge; /* overflow */ - else { - if (p_l + ovt > z - p_h) return s * huge * huge; /* overflow */ - } - } else if ((j & 0x7fffffff) >= 0x4090cc00) { /* z <= -1075 */ - if (((j - 0xc090cc00) | i) != 0) /* z < -1075 */ - return s * tiny * tiny; /* underflow */ - else { - if (p_l <= z - p_h) return s * tiny * tiny; /* underflow */ - } - } - /* - * compute 2**(p_h+p_l) - */ - i = j & 0x7fffffff; - k = (i >> 20) - 0x3ff; - n = 0; - if (i > 0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ - n = j + (0x00100000 >> (k + 1)); - k = ((n & 0x7fffffff) >> 20) - 0x3ff; /* new k for n */ - t = zero; - SET_HIGH_WORD(t, n & ~(0x000fffff >> k)); - n = ((n & 0x000fffff) | 0x00100000) >> (20 - k); - if (j < 0) n = -n; - p_h -= t; - } - t = p_l + p_h; - SET_LOW_WORD(t, 0); - u = t * lg2_h; - v = (p_l - (t - p_h)) * lg2 + t * lg2_l; - z = u + v; - w = v - (z - u); - t = z * z; - t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); - r = (z * t1) / (t1 - two) - (w + z * w); - z = one - (r - z); - GET_HIGH_WORD(j, z); - j += (n << 20); - if ((j >> 20) <= 0) - z = scalbn(z, n); /* subnormal output */ - else - SET_HIGH_WORD(z, j); - return s * z; -} diff --git a/include/ckb_cell_fs.c b/include/ckb_cell_fs.c index 6a3060e..06f726d 100644 --- a/include/ckb_cell_fs.c +++ b/include/ckb_cell_fs.c @@ -1,3 +1,4 @@ +#include #include #include #include