ReactOS 0.4.15-dev-8349-g6f277e9
sqrtf.c File Reference
#include "libm.h"
#include "libm_util.h"
#include "libm_inlines.h"
#include "libm_errno.h"
Include dependency graph for sqrtf.c:

Go to the source code of this file.

Macros

#define USE_NANF_WITH_FLAGS
 
#define USE_HANDLE_ERRORF
 

Functions

float sqrtf (float x)
 

Macro Definition Documentation

◆ USE_HANDLE_ERRORF

#define USE_HANDLE_ERRORF

Definition at line 34 of file sqrtf.c.

◆ USE_NANF_WITH_FLAGS

#define USE_NANF_WITH_FLAGS

Definition at line 33 of file sqrtf.c.

Function Documentation

◆ sqrtf()

float sqrtf ( float  x)

Definition at line 50 of file sqrtf.c.

51{
52#if USE_SOFTWARE_SQRT
53 return sqrtf_amd_inline(x);
54#else
55 float r;
56 unsigned int ux;
57 GET_BITS_SP32(x, ux);
58 /* Check for special cases for Microsoft error handling */
60 {
61 /* x is infinity, or NaN */
62 if (ux & MANTBITS_SP32)
63 {
64 /* NaN of some sort */
65 /* If it's a signaling NaN, convert to QNaN */
66 return _handle_errorf("sqrtf", OP_SQRT, ux|0x00400000, _DOMAIN, 0,
67 EDOM, x, 0.0F, 1);
68 }
69 else
70 {
71 /* +/-infinity */
72 if (ux & SIGNBIT_SP32)
73 {
74 /* - infinity */
75 return _handle_errorf("sqrtf", OP_SQRT, INDEFBITPATT_SP32,
76 _DOMAIN, AMD_F_INVALID, EDOM, x, 0.0F, 1);
77 }
78 /* positive infinite is not a problem */
79 }
80 }
81 if ((ux & SIGNBIT_SP32)&&(ux & ~SIGNBIT_SP32)) /* if x < zero */
82 {
83 return _handle_errorf("sqrtf", OP_SQRT, INDEFBITPATT_SP32,
84 _DOMAIN, AMD_F_INVALID, EDOM, x, 0.0F, 1);
85 }
86
87 /* VC++ intrinsic call */
89 return r;
90#endif
91}
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
#define _DOMAIN
Definition: math.h:39
#define AMD_F_INVALID
Definition: libm_new.h:86
#define INDEFBITPATT_SP32
Definition: libm_util.h:76
#define GET_BITS_SP32(x, ux)
Definition: libm_util.h:105
#define SIGNBIT_SP32
Definition: libm_util.h:68
#define PINFBITPATT_SP32
Definition: libm_util.h:77
#define MANTBITS_SP32
Definition: libm_util.h:70
void _mm_store_ss(float *p, __m128 a)
Definition: xmmintrin.h:1052
__m128 _mm_load_ss(float const *p)
Definition: xmmintrin.h:956
__m128 _mm_sqrt_ss(__m128 a)
Definition: xmmintrin.h:592