Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
math.h
Go to the documentation of this file.
1#ifndef MSL_MATH_H_
2#define MSL_MATH_H_
3
4#include "float.h"
5
6#define NAN (*(float*) __float_nan)
7#define HUGE_VALF (*(float*) __float_huge)
8
9#define M_PI 3.14159265358979323846f
10#define M_SQRT3 1.73205f
11
12#define DEG_TO_RAD(degrees) (degrees * (M_PI / 180.0f))
13#define RAD_TO_DEG(radians) (radians / (180.0f / M_PI))
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19int abs(int);
20double acos(double);
21float acosf(float);
22double asin(double);
23double atan(double);
24double atan2(double, double);
25double ceil(double);
26double copysign(double, double);
27double cos(double);
28float cosf(float);
29double exp(double);
30
31extern float __fabsf(float);
32inline double fabs(double f) {
33 return __fabs(f);
34}
35inline double fabsf2(float f) {
36 return __fabsf(f);
37}
38inline float fabsf(float f) {
39 return fabsf2(f);
40}
41
42double floor(double);
43double fmod(double, double);
44inline float fmodf(float f1, float f2) {
45 return fmod(f1, f2);
46}
47
48double frexp(double, int*);
49double ldexp(double, int);
50double modf(double, double*);
51double pow(double, double);
52double sin(double);
53float sinf(float);
54double sqrt(double);
55double tan(double);
56float tanf(float);
57
58inline double sqrt_step(double tmpd, float mag) {
59 return tmpd * 0.5 * (3.0 - mag * (tmpd * tmpd));
60}
61
62inline float sqrtf(float mag) {
63 if (mag > 0.0f) {
64 double tmpd = __frsqrte(mag);
68 return mag * tmpd;
69 } else if (mag < 0.0) {
70 return NAN;
71 } else if (fpclassify(mag) == 1) {
72 return NAN;
73 } else {
74 return mag;
75 }
76}
77
78inline float atan2f(float y, float x) {
79 return (float)atan2(y, x);
80}
81
82inline float i_sinf(float x) { return sin(x); }
83inline float i_cosf(float x) { return cos(x); }
84inline float i_tanf(float x) { return tan(x); }
85
86#ifdef __cplusplus
87};
88#endif
89
90#endif
T cLib_calcTimer(T *value)
Definition c_lib.h:74
void floor()
void fmod()
void ceil()
double x double x
Definition e_atan2.c:58
double x double y
Definition e_atan2.c:58
double atan2(double, double)
Definition w_atan2.c:4
float cosf(float)
Definition d_kankyo.cpp:29
int abs(int)
Definition arith.c:4
float tanf(float)
float sinf(float)
Definition d_kankyo.cpp:25
float i_cosf(float x)
Definition math.h:83
float i_tanf(float x)
Definition math.h:84
float sqrtf(float mag)
Definition math.h:62
double frexp(double, int *)
double acos(double)
Definition w_acos.c:4
float acosf(float)
double modf(double, double *)
double cos(double)
float __fabsf(float)
double copysign(double, double)
double pow(double, double)
Definition w_pow.c:4
float fmodf(float f1, float f2)
Definition math.h:44
double ldexp(double, int)
Definition s_ldexp.c:22
double sqrt_step(double tmpd, float mag)
Definition math.h:58
double atan(double)
double fabs(double f)
Definition math.h:32
float fabsf(float f)
Definition math.h:38
double tan(double)
double sqrt(double)
Definition w_sqrt.c:4
double sin(double)
double asin(double)
Definition w_asin.c:4
double exp(double)
Definition w_exp.c:4
float i_sinf(float x)
Definition math.h:82
float atan2f(float y, float x)
Definition math.h:78
double fabsf2(float f)
Definition math.h:35