ReactOS 0.4.16-dev-340-g0540c21
logb.c File Reference
#include "libm.h"
#include "libm_util.h"
#include "libm_inlines.h"
#include "libm_errno.h"
Include dependency graph for logb.c:

Go to the source code of this file.

Macros

#define USE_INFINITY_WITH_FLAGS
 
#define USE_HANDLE_ERROR
 

Functions

double _logb (double x)
 

Macro Definition Documentation

◆ USE_HANDLE_ERROR

#define USE_HANDLE_ERROR

Definition at line 31 of file logb.c.

◆ USE_INFINITY_WITH_FLAGS

#define USE_INFINITY_WITH_FLAGS

Definition at line 30 of file logb.c.

Function Documentation

◆ _logb()

double _logb ( double  x)

Definition at line 38 of file logb.c.

39{
40
41 unsigned long long ux;
42 long long u;
43 GET_BITS_DP64(x, ux);
45 if ((ux & ~SIGNBIT_DP64) == 0)
46 /* x is +/-zero. Return -infinity with div-by-zero flag. */
47 return _handle_error("_logb", OP_LOGB, NINFBITPATT_DP64, _SING,
48 AMD_F_DIVBYZERO, ERANGE, x, 0.0, 1);
49 else if (EMIN_DP64 <= u && u <= EMAX_DP64)
50 /* x is a normal number */
51 return (double)u;
52 else if (u > EMAX_DP64)
53 {
54 /* x is infinity or NaN */
55 if ((ux & MANTBITS_DP64) == 0)
56 /* x is +/-infinity. For VC++, return infinity of same sign. */
57 return x;
58 else
59 /* x is NaN, result is NaN */
60 return _handle_error("_logb", OP_LOGB, ux|0x0008000000000000, _DOMAIN,
61 0, EDOM, x, 0.0, 1);
62 }
63 else
64 {
65 /* x is denormalized. */
66#ifdef FOLLOW_IEEE754_LOGB
67 /* Return the value of the minimum exponent to ensure that
68 the relationship between logb and scalb, defined in
69 IEEE 754, holds. */
70 return EMIN_DP64;
71#else
72 /* Follow the rule set by IEEE 854 for logb */
73 ux &= MANTBITS_DP64;
74 u = EMIN_DP64;
75 while (ux < IMPBIT_DP64)
76 {
77 ux <<= 1;
78 u--;
79 }
80 return (double)u;
81#endif
82 }
83
84}
double __cdecl _handle_error(char *fname, int opcode, unsigned long long value, int type, int flags, int error, double arg1, double arg2, int nargs)
Handles an error condition.
Definition: _handle_error.c:34
#define ERANGE
Definition: acclib.h:92
#define EDOM
Definition: errno.h:39
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 * u
Definition: glfuncs.h:240
#define _DOMAIN
Definition: math.h:39
#define _SING
Definition: math.h:40
#define AMD_F_DIVBYZERO
Definition: libm_new.h:85
#define IMPBIT_DP64
Definition: libm_util.h:50
#define EXPSHIFTBITS_DP64
Definition: libm_util.h:56
#define NINFBITPATT_DP64
Definition: libm_util.h:54
#define GET_BITS_DP64(x, ux)
Definition: libm_util.h:118
#define SIGNBIT_DP64
Definition: libm_util.h:44
#define EXPBITS_DP64
Definition: libm_util.h:45
#define EMAX_DP64
Definition: libm_util.h:60
#define EMIN_DP64
Definition: libm_util.h:58
#define EXPBIAS_DP64
Definition: libm_util.h:55
#define MANTBITS_DP64
Definition: libm_util.h:46