Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
float.h
Go to the documentation of this file.
1
#ifndef _MSL_COMMON_FLOAT_H
2
#define _MSL_COMMON_FLOAT_H
3
4
#include <
fdlibm.h
>
5
#include "
global.h
"
6
7
#define FP_SNAN 0
8
#define FP_QNAN 1
9
#define FP_INFINITE 2
10
#define FP_ZERO 3
11
#define FP_NORMAL 4
12
#define FP_SUBNORMAL 5
13
14
#define FP_NAN FP_QNAN
15
16
#if __REVOLUTION_SDK__
17
#define fpclassify(x) \
18
((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : \
19
(sizeof(x) == sizeof(double)) ? __fpclassifyd((double)(x)) : \
20
__fpclassifyl((long double)(x)) )
21
#else
22
#define fpclassify(x) \
23
((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : \
24
__fpclassifyd((double)(x)) )
25
#endif
26
27
#define signbit(x) ((sizeof(x) == sizeof(float)) ? __signbitf(x) : __signbitd(x))
28
#define isfinite(x) ((fpclassify(x) > FP_INFINITE))
29
#define isnan(x) (fpclassify(x) == FP_NAN)
30
#define isinf(x) (fpclassify(x) == FP_INFINITE)
31
32
#define __signbitf(x) ((int)(__HI(x) & 0x80000000))
33
34
// TODO: OK?
35
#define __signbitd(x) ((int)(__HI(x) & 0x80000000))
36
37
extern
int
__float_nan
[];
38
extern
int
__float_huge
[];
39
extern
int
__float_max
[];
40
extern
int
__float_epsilon
[];
41
42
#if !PLATFORM_GCN
43
extern
int
__double_huge
[];
44
#endif
45
46
#ifdef __cplusplus
47
extern
"C"
{
48
#endif
49
50
inline
int
__fpclassifyf
(
float
__value) {
51
switch
(*(
int
*)&__value & 0x7f800000) {
52
case
0x7f800000:
53
if
((*(
int
*)&__value & 0x7fffff) != 0) {
54
return
FP_QNAN;
55
}
56
return
FP_INFINITE;
57
58
case
0:
59
if
((*(
int
*)&__value & 0x7fffff) != 0) {
60
return
FP_SUBNORMAL;
61
}
62
return
FP_ZERO;
63
}
64
65
return
FP_NORMAL;
66
}
67
68
inline
int
__fpclassifyd
(
double
__value) {
69
switch
(
__HI
(__value) & 0x7ff00000) {
70
case
0x7ff00000: {
71
if
((
__HI
(__value) & 0x000fffff) || (
__LO
(__value) & 0xffffffff))
72
return
FP_QNAN;
73
else
74
return
FP_INFINITE;
75
break
;
76
}
77
case
0: {
78
if
((
__HI
(__value) & 0x000fffff) || (
__LO
(__value) & 0xffffffff))
79
return
FP_SUBNORMAL;
80
else
81
return
FP_ZERO;
82
break
;
83
}
84
}
85
return
FP_NORMAL;
86
}
87
88
// Stripped function.
89
int
__fpclassifyl
(
long
double
__value);
90
91
#ifdef __cplusplus
92
};
// extern "C"
93
#endif
94
95
#define FLT_MANT_DIG 24
96
#define FLT_DIG 6
97
#define FLT_MIN_EXP (-125)
98
#define FLT_MIN_10_EXP (-37)
99
#define FLT_MAX_EXP 128
100
#define FLT_MAX_10_EXP 38
101
102
#if !PLATFORM_GCN
103
#define FLT_MAX 3.4028235e38f
104
#define FLT_EPSILON 1.1920929e-7f
105
#else
106
#define FLT_MAX (*(float*) __float_max)
107
#define FLT_EPSILON (*(float*) __float_epsilon)
108
#endif
109
110
#define DBL_MANT_DIG 53
111
#define DBL_DIG 15
112
#define DBL_MIN_EXP (-1021)
113
#define DBL_MIN_10_EXP (-308)
114
#define DBL_MAX_EXP 1024
115
#define DBL_MAX_10_EXP 308
116
117
#define LDBL_MANT_DIG 53
118
#define LDBL_DIG 15
119
#define LDBL_MIN_EXP (-1021)
120
#define LDBL_MIN_10_EXP (-308)
121
#define LDBL_MAX_EXP 1024
122
#define LDBL_MAX_10_EXP 308
123
124
#define LDBL_MAX 0x1.fffffffffffffP1023L
125
#define LDBL_EPSILON 0x1.0000000000000P-52L
126
#define LDBL_MIN 0x1.0000000000000P-1022L
127
128
#endif
/* _MSL_COMMON_FLOAT_H */
__LO
__LO(df)=0
__HI
__HI(x)
fdlibm.h
__fpclassifyf
int __fpclassifyf(float __value)
Definition
float.h:50
__fpclassifyl
int __fpclassifyl(long double __value)
__float_epsilon
int __float_epsilon[]
Definition
float.c:11
__float_huge
int __float_huge[]
Definition
float.c:6
__fpclassifyd
int __fpclassifyd(double __value)
Definition
float.h:68
__float_nan
int __float_nan[]
Definition
float.c:4
__float_max
int __float_max[]
Definition
float.c:9
__double_huge
int __double_huge[]
Definition
float.c:15
global.h
src
PowerPC_EABI_Support
MSL
MSL_C
MSL_Common
Include
float.h
Generated by
1.12.0