Back to index

glibc  2.9
Functions
s_truncl.c File Reference
#include <math.h>
#include "math_private.h"

Go to the source code of this file.

Functions

long double __truncl (long double x)

Function Documentation

long double __truncl ( long double  x)

Definition at line 27 of file s_truncl.c.

{
  int32_t i0, j0;
  u_int32_t se, i1;
  int sx;

  GET_LDOUBLE_WORDS (se, i0, i1, x);
  sx = se & 0x8000;
  j0 = (se & 0x7fff) - 0x3fff;
  if (j0 < 31)
    {
      if (j0 < 0)
       /* The magnitude of the number is < 1 so the result is +-0.  */
       SET_LDOUBLE_WORDS (x, sx, 0, 0);
      else
       SET_LDOUBLE_WORDS (x, se, i0 & ~(0x7fffffff >> j0), 0);
    }
  else if (j0 > 63)
    {
      if (j0 == 0x4000)
       /* x is inf or NaN.  */
       return x + x;
    }
  else
    {
      SET_LDOUBLE_WORDS (x, se, i0, i1 & ~(0xffffffffu >> (j0 - 31)));
    }

  return x;
}

Here is the call graph for this function: