OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libm/] [mathfp/] [sf_floor.c] - Blame information for rev 207

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
 
2
/* @(#)z_floorf.c 1.0 98/08/13 */
3
/*****************************************************************
4
 * floor
5
 *
6
 * Input:
7
 *   x  - floating point value
8
 *
9
 * Output:
10
 *   Smallest integer less than x.
11
 *
12
 * Description:
13
 *   This routine returns the smallest integer less than x.
14
 *
15
 *****************************************************************/
16
 
17
#include "fdlibm.h"
18
#include "zmath.h"
19
 
20
float
21
_DEFUN (floorf, (float),
22
        float x)
23
{
24
  float f, y;
25
 
26
  if (x > -1.0 && x < 1.0)
27
    return (x >= 0 ? 0 : -1.0);
28
 
29
  y = modff (x, &f);
30
 
31
  if (y == 0.0)
32
    return (x);
33
 
34
  return (x >= 0 ? f : f - 1.0);
35
}
36
 
37
#ifdef _DOUBLE_IS_32BITS
38
double floor (double x)
39
{
40
  return (double) floorf ((float) x);
41
}
42
 
43
#endif /* defined(_DOUBLE_IS_32BITS) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.