Back to index

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

Go to the source code of this file.

Functions

float __truncf (float x)

Function Documentation

float __truncf ( float  x)

Definition at line 27 of file s_truncf.c.

{
  int32_t i0, j0;
  int sx;

  GET_FLOAT_WORD (i0, x);
  sx = i0 & 0x80000000;
  j0 = ((i0 >> 23) & 0xff) - 0x7f;
  if (j0 < 23)
    {
      if (j0 < 0)
       /* The magnitude of the number is < 1 so the result is +-0.  */
       SET_FLOAT_WORD (x, sx);
      else
       SET_FLOAT_WORD (x, sx | (i0 & ~(0x007fffff >> j0)));
    }
  else
    {
      if (j0 == 0x80)
       /* x is inf or NaN.  */
       return x + x;
    }

  return x;
}

Here is the call graph for this function: