ReactOS  0.4.13-dev-563-g0561610
s_modf.c File Reference

Go to the source code of this file.

Classes

union  ieee_double_shape_type
 

Macros

#define __int32_t   long
 
#define __uint32_t   unsigned long
 
#define __IEEE_LITTLE_ENDIAN
 
#define EXTRACT_WORDS(ix0, ix1, d)
 
#define GET_HIGH_WORD(i, d)
 
#define GET_LOW_WORD(i, d)
 
#define INSERT_WORDS(d, ix0, ix1)
 

Functions

double modf (double x, double *iptr)
 

Variables

static const double one = 1.0
 

Macro Definition Documentation

◆ __IEEE_LITTLE_ENDIAN

#define __IEEE_LITTLE_ENDIAN

Definition at line 78 of file s_modf.c.

◆ __int32_t

#define __int32_t   long

Definition at line 76 of file s_modf.c.

◆ __uint32_t

#define __uint32_t   unsigned long

Definition at line 77 of file s_modf.c.

◆ EXTRACT_WORDS

#define EXTRACT_WORDS (   ix0,
  ix1,
  d 
)
Value:
do { \
ieee_double_shape_type ew_u; \
ew_u.value = (d); \
(ix0) = ew_u.parts.msw; \
(ix1) = ew_u.parts.lsw; \
} while (0)
#define d
Definition: ke_i.h:81

Definition at line 111 of file s_modf.c.

◆ GET_HIGH_WORD

#define GET_HIGH_WORD (   i,
  d 
)
Value:
do { \
ieee_double_shape_type gh_u; \
gh_u.value = (d); \
(i) = gh_u.parts.msw; \
} while (0)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define d
Definition: ke_i.h:81

Definition at line 121 of file s_modf.c.

◆ GET_LOW_WORD

#define GET_LOW_WORD (   i,
  d 
)
Value:
do { \
ieee_double_shape_type gl_u; \
gl_u.value = (d); \
(i) = gl_u.parts.lsw; \
} while (0)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define d
Definition: ke_i.h:81

Definition at line 130 of file s_modf.c.

◆ INSERT_WORDS

#define INSERT_WORDS (   d,
  ix0,
  ix1 
)
Value:
do { \
ieee_double_shape_type iw_u; \
iw_u.parts.msw = (ix0); \
iw_u.parts.lsw = (ix1); \
(d) = iw_u.value; \
} while (0)
#define d
Definition: ke_i.h:81

Definition at line 139 of file s_modf.c.

Function Documentation

◆ modf()

double modf ( double  x,
double iptr 
)

Definition at line 150 of file s_modf.c.

151 {
152  __int32_t i0,i1,j_0;
153  __uint32_t i;
154  EXTRACT_WORDS(i0,i1,x);
155  j_0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */
156  if(j_0<20) { /* integer part in high x */
157  if(j_0<0) { /* |x|<1 */
158  INSERT_WORDS(*iptr,i0&0x80000000U,0); /* *iptr = +-0 */
159  return x;
160  } else {
161  i = (0x000fffff)>>j_0;
162  if(((i0&i)|i1)==0) { /* x is integral */
163  __uint32_t high;
164  *iptr = x;
165  GET_HIGH_WORD(high,x);
166  INSERT_WORDS(x,high&0x80000000U,0); /* return +-0 */
167  return x;
168  } else {
169  INSERT_WORDS(*iptr,i0&(~i),0);
170  return x - *iptr;
171  }
172  }
173  } else if (j_0>51) { /* no fraction part */
174  __uint32_t high;
175  *iptr = x*one;
176  GET_HIGH_WORD(high,x);
177  INSERT_WORDS(x,high&0x80000000U,0); /* return +-0 */
178  return x;
179  } else { /* fraction part in low x */
180  i = ((__uint32_t)(0xffffffffU))>>(j_0-20);
181  if((i1&i)==0) { /* x is integral */
182  __uint32_t high;
183  *iptr = x;
184  GET_HIGH_WORD(high,x);
185  INSERT_WORDS(x,high&0x80000000U,0); /* return +-0 */
186  return x;
187  } else {
188  INSERT_WORDS(*iptr,i0,i1&(~i));
189  return x - *iptr;
190  }
191  }
192 }
#define __int32_t
Definition: s_modf.c:76
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define EXTRACT_WORDS(ix0, ix1, d)
Definition: s_modf.c:111
#define __uint32_t
Definition: s_modf.c:77
#define GET_HIGH_WORD(i, d)
Definition: s_modf.c:121
#define INSERT_WORDS(d, ix0, ix1)
Definition: s_modf.c:139
static const double one
Definition: s_modf.c:74

Variable Documentation

◆ one

const double one = 1.0
static

Definition at line 74 of file s_modf.c.

Referenced by modf().