summary refs log tree commit diff
path: root/math/w_exp2l.c
blob: ac8d231e2c69e408ded8260bcf626de328a38896 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * wrapper exp2l(x)
 */

#include <float.h>
#include <math.h>
#include <math_private.h>

static const long double o_threshold = (long double) LDBL_MAX_EXP;
static const long double u_threshold
  = (long double) (LDBL_MIN_EXP - LDBL_MANT_DIG - 1);

long double
__exp2l (long double x)
{
  if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
      && _LIB_VERSION != _IEEE_ && __finitel (x))
    /* exp2 overflow: 244, exp2 underflow: 245 */
    return __kernel_standard (x, x, 244 + (x <= o_threshold));

  return __ieee754_exp2l (x);
}
weak_alias (__exp2l, exp2l)