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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [newlib/] [newlib/] [libm/] [mathfp/] [sf_ceil.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

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