source: trunk/libs/newlib/src/newlib/libm/mathfp/s_ceil.c @ 577

Last change on this file since 577 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 658 bytes
Line 
1
2/* @(#)z_ceil.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#ifndef _DOUBLE_IS_32BITS
21
22double
23ceil (double x)
24{
25  double f, y;
26
27  y = modf (x, &f);
28
29  if (y == 0.0)
30    return (x);
31  else if (x > -1.0 && x < 1.0)
32    return (x > 0 ? 1.0 : 0.0);
33  else
34    return (x > 0 ? f + 1.0 : f);
35}
36
37#endif /* _DOUBLE_IS_32BITS */
Note: See TracBrowser for help on using the repository browser.