gfloat.h File Reference

#include <math.h>

Functions

void SinCos (float angle, float *sine, float *cosine)
 
float Sin (float angle)
 
float Cos (float angle)
 
float Sqrt (float arg)
 

Function Documentation

void SinCos ( float  angle,
float *  sine,
float *  cosine 
)
inline
Remarks
Returns both the sine and cosine of the specified angle as floats. This function uses the assembly language on Intel CPUs.
33 {
34 #ifdef __USE_ASM_CODE_
35  __asm {
36  push ecx
37  fld dword ptr angle
38  fsincos
39  mov ecx, dword ptr[cosine]
40  fstp dword ptr [ecx]
41  mov ecx, dword ptr[sine]
42  fstp dword ptr [ecx]
43  pop ecx
44  }
45 #else
46  *sine = (float)sin (angle);
47  *cosine = (float)cos (angle);
48 #endif
49 }
float Sin ( float  angle)
inline
Remarks
Returns the sine of the specified angle as a float. This function uses the assembly language on Intel CPUs.
53 {
54 #ifdef __USE_ASM_CODE_
55  float s, c;
56  SinCos(angle, &s, &c);
57  return s;
58 #else
59  return (float)sin((double)angle);
60 #endif
61 }
void SinCos(float angle, float *sine, float *cosine)
Definition: gfloat.h:32
float Cos ( float  angle)
inline
Remarks
Returns the cosine of the specified angle as a float. This function uses the assembly language on Intel CPUs.
65 {
66 #ifdef __USE_ASM_CODE_
67  float s, c;
68  SinCos(angle, &s, &c);
69  return c;
70 #else
71  return (float)cos((double)angle);
72 #endif
73 }
void SinCos(float angle, float *sine, float *cosine)
Definition: gfloat.h:32
float Sqrt ( float  arg)
inline
Remarks
Returns the square root of the specified argument as a float. This function uses the assembly language on Intel CPUs.
77 {
78 #ifdef __USE_ASM_CODE_
79  float ans;
80  __asm {
81  fld dword ptr arg
82  fsqrt
83  fstp dword ptr [ans]
84  }
85  return ans;
86 #else
87  return (float)sqrt((double)arg);
88 #endif
89 }