update for HEAD-2003091401
[reactos.git] / lib / crtdll / math / ceil.c
1 #include <msvcrt/math.h>
2
3 /*
4  * @implemented
5  */
6 double ceil (double __x)
7 {
8   register double __value;
9 #ifdef __GNUC__
10   __volatile unsigned short int __cw, __cwtmp;
11
12   __asm __volatile ("fnstcw %0" : "=m" (__cw));
13   __cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */
14   __asm __volatile ("fldcw %0" : : "m" (__cwtmp));
15   __asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
16   __asm __volatile ("fldcw %0" : : "m" (__cw));
17 #else
18   __value = linkme_ceil(__x);
19 #endif /*__GNUC__*/
20   return __value;
21 }
22
23
24 long double ceill (long double __x)
25 {
26         return floor(__x)+1;
27 }