Back to index

glibc  2.9
Functions
s_llroundf.c File Reference
#include <math.h>

Go to the source code of this file.

Functions

long long int __llroundf (float x)

Function Documentation

long long int __llroundf ( float  x)

Definition at line 29 of file s_llroundf.c.

{
  float xrf;
  long long int xr;
  xr = (long long int) x;
  xrf = (float) xr;
  if (x >= 0.0)
    if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0)
      return x+1;
    else
      return x;
  else
    if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0)
      return x-1;
    else
      return x;
}