-static const uint32_t k = 1799; /* constant for reduction */
-static const double kln2 = 1246.97177782734161156; /* k * ln2 */
-
-/*
- * Compute exp(x), scaled to avoid spurious overflow. An exponent is
- * returned separately in 'expt'.
- *
- * Input: ln(DBL_MAX) <= x < ln(2 * DBL_MAX / DBL_MIN_DENORM) ~= 1454.91
- * Output: 2**1023 <= y < 2**1024
- */
-static double __frexp_exp(double x, int *expt)
-{
- double exp_x;
- uint32_t hx;
-
- /*
- * We use exp(x) = exp(x - kln2) * 2**k, carefully chosen to
- * minimize |exp(kln2) - 2**k|. We also scale the exponent of
- * exp_x to MAX_EXP so that the result can be multiplied by
- * a tiny number without losing accuracy due to denormalization.
- */
- exp_x = exp(x - kln2);
- GET_HIGH_WORD(hx, exp_x);
- *expt = (hx >> 20) - (0x3ff + 1023) + k;
- SET_HIGH_WORD(exp_x, (hx & 0xfffff) | ((0x3ff + 1023) << 20));
- return exp_x;
-}
-