ReactOS 0.4.15-dev-8349-g6f277e9
sincos_special.c File Reference
#include <fpieee.h>
#include <excpt.h>
#include <float.h>
#include <math.h>
#include <errno.h>
#include "libm_new.h"
Include dependency graph for sincos_special.c:

Go to the source code of this file.

Functions

double _sincos_special (double x, char *name, unsigned int operation)
 
float _sincosf_special (float x, char *name, unsigned int operation)
 
float _sinf_special (float x)
 
double _sin_special (double x)
 
float _cosf_special (float x)
 
double _cos_special (double x)
 
double _tan_special (double x)
 
float _tanf_special (float x)
 

Function Documentation

◆ _cos_special()

double _cos_special ( double  x)

Definition at line 117 of file sincos_special.c.

118{
119 return _sincos_special(x, "cos", _FpCodeCos);
120}
@ _FpCodeCos
Definition: fpieee.h:47
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
double _sincos_special(double x, char *name, unsigned int operation)

◆ _cosf_special()

float _cosf_special ( float  x)

Definition at line 112 of file sincos_special.c.

113{
114 return _sincosf_special(x, "cosf", _FpCodeCos);
115}
float _sincosf_special(float x, char *name, unsigned int operation)

◆ _sin_special()

double _sin_special ( double  x)

Definition at line 107 of file sincos_special.c.

108{
109 return _sincos_special(x, "sin", _FpCodeSin);
110}
@ _FpCodeSin
Definition: fpieee.h:59

◆ _sincos_special()

double _sincos_special ( double  x,
char name,
unsigned int  operation 
)

Definition at line 35 of file sincos_special.c.

36{
37 UT64 xu;
38 unsigned int is_snan;
39
40 xu.f64 = x;
41
42 if((xu.u64 & INF_POS_64) == INF_POS_64)
43 {
44 // x is Inf or NaN
45 if((xu.u64 & MANTISSA_MASK_64) == 0x0)
46 {
47 // x is Inf
48 xu.u64 = IND_64;
50 }
51 else
52 {
53 // x is NaN
54 is_snan = (((xu.u64 & QNAN_MASK_64) == QNAN_MASK_64) ? 0 : 1);
55 if(is_snan)
56 {
57 xu.u64 |= QNAN_MASK_64;
58 }
59 _handle_error(name, operation, xu.u64, _DOMAIN, 0, EDOM, x, 0, 1);
60 }
61 }
62
63 return xu.f64;
64}
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
operation
Definition: copy.c:29
#define EDOM
Definition: errno.h:39
#define _DOMAIN
Definition: math.h:39
#define IND_64
Definition: libm_new.h:78
#define MANTISSA_MASK_64
Definition: libm_new.h:76
#define AMD_F_INVALID
Definition: libm_new.h:86
#define QNAN_MASK_64
Definition: libm_new.h:79
#define INF_POS_64
Definition: libm_new.h:73
Definition: name.c:39
Definition: libm_new.h:47
F64 f64
Definition: libm_new.h:48
U64 u64
Definition: libm_new.h:49

Referenced by _cos_special(), _sin_special(), and _tan_special().

◆ _sincosf_special()

float _sincosf_special ( float  x,
char name,
unsigned int  operation 
)

Definition at line 66 of file sincos_special.c.

67{
68 UT64 xu;
69 unsigned int is_snan;
70
71 xu.u64 = 0;
72 xu.f32[0] = x;
73
74 if((xu.u32[0] & INF_POS_32) == INF_POS_32)
75 {
76 // x is Inf or NaN
77 if((xu.u32[0] & MANTISSA_MASK_32) == 0x0)
78 {
79 // x is Inf
80 xu.u32[0] = IND_32;
82 }
83 else
84 {
85 // x is NaN
86 is_snan = (((xu.u32[0] & QNAN_MASK_32) == QNAN_MASK_32) ? 0 : 1);
87 if(is_snan)
88 {
89 xu.u32[0] |= QNAN_SET_32;
91 }
92 else
93 {
94 _handle_errorf(name, operation, xu.u64, _DOMAIN, 0, EDOM, x, 0, 1);
95 }
96 }
97 }
98
99 return xu.f32[0];
100}
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 IND_32
Definition: libm_new.h:67
#define INF_POS_32
Definition: libm_new.h:63
#define QNAN_MASK_32
Definition: libm_new.h:61
#define QNAN_SET_32
Definition: libm_new.h:71
#define MANTISSA_MASK_32
Definition: libm_new.h:59
U32 u32[2]
Definition: libm_new.h:52
F32 f32[2]
Definition: libm_new.h:51

Referenced by _cosf_special(), _sinf_special(), and _tanf_special().

◆ _sinf_special()

float _sinf_special ( float  x)

Definition at line 102 of file sincos_special.c.

103{
104 return _sincosf_special(x, "sinf", _FpCodeSin);
105}

◆ _tan_special()

double _tan_special ( double  x)

Definition at line 122 of file sincos_special.c.

123{
124 return _sincos_special(x, "tan",_FpCodeTan);
125}
@ _FpCodeTan
Definition: fpieee.h:61

◆ _tanf_special()

float _tanf_special ( float  x)

Definition at line 127 of file sincos_special.c.

128{
129 return _sincosf_special(x, "tanf",_FpCodeTan);
130}