Back to index

glibc  2.9
Defines | Functions | Variables
s_cbrtl.c File Reference
#include "math.h"
#include "math_private.h"

Go to the source code of this file.

Defines

#define CBRT2   1.2599210498948731648 /* 2^(1/3) */
#define SQR_CBRT2   1.5874010519681994748 /* 2^(2/3) */

Functions

long double __cbrtl (long double x)

Variables

static const double factor [5]
static const long double third = 0.3333333333333333333333333L

Define Documentation

#define CBRT2   1.2599210498948731648 /* 2^(1/3) */

Definition at line 26 of file s_cbrtl.c.

#define SQR_CBRT2   1.5874010519681994748 /* 2^(2/3) */

Definition at line 27 of file s_cbrtl.c.


Function Documentation

long double __cbrtl ( long double  x)

Definition at line 43 of file s_cbrtl.c.

{
  long double xm, u;
  int xe;

  /* Reduce X.  XM now is an range 1.0 to 0.5.  */
  xm = __frexpl (fabs (x), &xe);

  /* If X is not finite or is null return it (with raising exceptions
     if necessary.
     Note: *Our* version of `frexp' sets XE to zero if the argument is
     Inf or NaN.  This is not portable but faster.  */
  if (xe == 0 && fpclassify (x) <= FP_ZERO)
    return x + x;

  u = (((-1.34661104733595206551E-1 * xm
         + 5.46646013663955245034E-1) * xm
        - 9.54382247715094465250E-1) * xm
       + 1.13999833547172932737E0) * xm
       + 4.02389795645447521269E-1;

  u *= factor[2 + xe % 3];
  u = __ldexpl (x > 0.0 ? u : -u, xe / 3);

  u -= (u - (x / (u * u))) * third;
  u -= (u - (x / (u * u))) * third;
  return u;
}

Here is the call graph for this function:


Variable Documentation

const double factor[5] [static]
Initial value:
{
  1.0 / SQR_CBRT2,
  1.0 / CBRT2,
  1.0,
  CBRT2,
  SQR_CBRT2
}

Definition at line 31 of file s_cbrtl.c.

const long double third = 0.3333333333333333333333333L [static]

Definition at line 40 of file s_cbrtl.c.