ReactOS 0.4.16-dev-237-gd6eebaa
ceilf.c File Reference
#include "libm.h"
#include "libm_util.h"
#include "libm_errno.h"
#include "libm_inlines.h"
Include dependency graph for ceilf.c:

Go to the source code of this file.

Macros

#define USE_HANDLE_ERRORF
 

Functions

float FN_PROTOTYPE() ceilf (float x)
 

Macro Definition Documentation

◆ USE_HANDLE_ERRORF

#define USE_HANDLE_ERRORF

Definition at line 31 of file ceilf.c.

Function Documentation

◆ ceilf()

float FN_PROTOTYPE() ceilf ( float  x)

Definition at line 40 of file ceilf.c.

41{
42 float r;
43 int rexp, xneg;
44 unsigned int ux, ax, ur, mask;
45
46 GET_BITS_SP32(x, ux);
47 ax = ux & (~SIGNBIT_SP32);
48 xneg = (ux != ax);
49
50 if (ax >= 0x4b800000)
51 {
52 /* abs(x) is either NaN, infinity, or >= 2^24 */
53 if (ax > 0x7f800000)
54 /* x is NaN */
55 return _handle_errorf("ceilf", OP_CEIL, ux, _DOMAIN, 0, EDOM, x,
56 0.0F, 1);
57 else
58 return x;
59 }
60 else if (ax < 0x3f800000) /* abs(x) < 1.0 */
61 {
62 if (ax == 0x00000000)
63 /* x is +zero or -zero; return the same zero */
64 return x;
65 else if (xneg) /* x < 0.0 */
66 {
67 PUT_BITS_SP32(SIGNBIT_SP32, r); /* return -0.0 */
68 return r;
69 }
70 else
71 return 1.0F;
72 }
73 else
74 {
75 rexp = ((ux & EXPBITS_SP32) >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32;
76 /* Mask out the bits of r that we don't want */
77 mask = (1 << (EXPSHIFTBITS_SP32 - rexp)) - 1;
78 ur = (ux & ~mask);
79 PUT_BITS_SP32(ur, r);
80
81 if (xneg || (ux == ur)) return r;
82 else
83 /* We threw some bits away and x was positive */
84 return r + 1.0F;
85 }
86}
float __cdecl _handle_errorf(char *fname, int opcode, unsigned long long value, int type, int flags, int error, float arg1, float arg2, int nargs)
Definition: _handle_error.c:56
#define EDOM
Definition: errno.h:39
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum GLint GLuint mask
Definition: glext.h:6028
#define _DOMAIN
Definition: math.h:39
#define GET_BITS_SP32(x, ux)
Definition: libm_util.h:105
#define EXPBITS_SP32
Definition: libm_util.h:69
#define SIGNBIT_SP32
Definition: libm_util.h:68
#define EXPBIAS_SP32
Definition: libm_util.h:79
#define PUT_BITS_SP32(ux, x)
Definition: libm_util.h:111
#define EXPSHIFTBITS_SP32
Definition: libm_util.h:80
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx shrl ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 psrlq mm1 psrlq mm5 paddd mm0 paddd mm4 psrad mm0 psrad mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx andl ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm0 psrad mm0 packssdw mm0 movd eax movw ax
Definition: synth_sse3d.h:180