Functions

gfloat.h File Reference

#include <math.h>

Go to the source code of this file.

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]

Definition at line 30 of file gfloat.h.

{
#ifdef __USE_ASM_CODE_
    __asm {
        push        ecx
        fld         dword ptr angle
        fsincos
        mov         ecx, dword ptr[cosine]
        fstp        dword ptr [ecx]
        mov         ecx, dword ptr[sine]
        fstp        dword ptr [ecx]
        pop         ecx
    }
#else
    *sine   = (float)sin (angle);
    *cosine = (float)cos (angle);
#endif
}
float Sin ( float  angle ) [inline]

Definition at line 49 of file gfloat.h.

{
#ifdef __USE_ASM_CODE_
    float s, c;
    SinCos(angle, &s, &c);
    return s;
#else
    return (float)sin((double)angle);
#endif
}
float Cos ( float  angle ) [inline]

Definition at line 60 of file gfloat.h.

{
#ifdef __USE_ASM_CODE_
    float s, c;
    SinCos(angle, &s, &c);
    return c;
#else
    return (float)cos((double)angle);
#endif
}
float Sqrt ( float  arg ) [inline]

Definition at line 71 of file gfloat.h.

{
#ifdef __USE_ASM_CODE_
    float ans;
    __asm {
        fld         dword ptr arg
        fsqrt
        fstp        dword ptr [ans]
        }
    return ans;
#else
    return (float)sqrt((double)arg);
#endif
}