Index: fusl/src/math/expl.c |
diff --git a/fusl/src/math/expl.c b/fusl/src/math/expl.c |
index 0a7f44f685ee3b708962dc9683698ffcd8074775..c67726759a23e8595bf2db935c05f0dcdb6d55a9 100644 |
--- a/fusl/src/math/expl.c |
+++ b/fusl/src/math/expl.c |
@@ -68,61 +68,54 @@ |
#include "libm.h" |
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 |
-long double expl(long double x) |
-{ |
- return exp(x); |
+long double expl(long double x) { |
+ return exp(x); |
} |
#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 |
static const long double P[3] = { |
- 1.2617719307481059087798E-4L, |
- 3.0299440770744196129956E-2L, |
- 9.9999999999999999991025E-1L, |
+ 1.2617719307481059087798E-4L, 3.0299440770744196129956E-2L, |
+ 9.9999999999999999991025E-1L, |
}; |
static const long double Q[4] = { |
- 3.0019850513866445504159E-6L, |
- 2.5244834034968410419224E-3L, |
- 2.2726554820815502876593E-1L, |
- 2.0000000000000000000897E0L, |
+ 3.0019850513866445504159E-6L, 2.5244834034968410419224E-3L, |
+ 2.2726554820815502876593E-1L, 2.0000000000000000000897E0L, |
}; |
-static const long double |
-LN2HI = 6.9314575195312500000000E-1L, |
-LN2LO = 1.4286068203094172321215E-6L, |
-LOG2E = 1.4426950408889634073599E0L; |
+static const long double LN2HI = 6.9314575195312500000000E-1L, |
+ LN2LO = 1.4286068203094172321215E-6L, |
+ LOG2E = 1.4426950408889634073599E0L; |
-long double expl(long double x) |
-{ |
- long double px, xx; |
- int k; |
+long double expl(long double x) { |
+ long double px, xx; |
+ int k; |
- if (isnan(x)) |
- return x; |
- if (x > 11356.5234062941439488L) /* x > ln(2^16384 - 0.5) */ |
- return x * 0x1p16383L; |
- if (x < -11399.4985314888605581L) /* x < ln(2^-16446) */ |
- return -0x1p-16445L/x; |
+ if (isnan(x)) |
+ return x; |
+ if (x > 11356.5234062941439488L) /* x > ln(2^16384 - 0.5) */ |
+ return x * 0x1p16383L; |
+ if (x < -11399.4985314888605581L) /* x < ln(2^-16446) */ |
+ return -0x1p-16445L / x; |
- /* Express e**x = e**f 2**k |
- * = e**(f + k ln(2)) |
- */ |
- px = floorl(LOG2E * x + 0.5); |
- k = px; |
- x -= px * LN2HI; |
- x -= px * LN2LO; |
+ /* Express e**x = e**f 2**k |
+ * = e**(f + k ln(2)) |
+ */ |
+ px = floorl(LOG2E * x + 0.5); |
+ k = px; |
+ x -= px * LN2HI; |
+ x -= px * LN2LO; |
- /* rational approximation of the fractional part: |
- * e**x = 1 + 2x P(x**2)/(Q(x**2) - x P(x**2)) |
- */ |
- xx = x * x; |
- px = x * __polevll(xx, P, 2); |
- x = px/(__polevll(xx, Q, 3) - px); |
- x = 1.0 + 2.0 * x; |
- return scalbnl(x, k); |
+ /* rational approximation of the fractional part: |
+ * e**x = 1 + 2x P(x**2)/(Q(x**2) - x P(x**2)) |
+ */ |
+ xx = x * x; |
+ px = x * __polevll(xx, P, 2); |
+ x = px / (__polevll(xx, Q, 3) - px); |
+ x = 1.0 + 2.0 * x; |
+ return scalbnl(x, k); |
} |
#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 |
// TODO: broken implementation to make things compile |
-long double expl(long double x) |
-{ |
- return exp(x); |
+long double expl(long double x) { |
+ return exp(x); |
} |
#endif |