add FLT_MAX, FLT_EPSILON, NAN, and HUGE_VALF to MSL_C headers (#316)

This commit is contained in:
Jcw87
2023-04-21 02:01:46 -07:00
committed by GitHub
parent 0629e60eab
commit 6f30fa4d2a
20 changed files with 65 additions and 50 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
#include "JSystem/JStage/JSGCamera.h"
#include "MSL_C/math.h"
#include "MSL_C/float.h"
/* 80280BA0-80280C00 27B4E0 0060+00 0/0 1/1 0/0 .text __dt__Q26JStage7TCameraFv */
JStage::TCamera::~TCamera() {}
@@ -31,7 +31,7 @@ void JStage::TCamera::JSGSetProjectionNear(f32) {}
/* 80280C20-80280C2C 27B560 000C+00 1/0 0/0 0/0 .text JSGGetProjectionFar__Q26JStage7TCameraCFv */
f32 JStage::TCamera::JSGGetProjectionFar() const {
return __float_max[0];
return FLT_MAX;
}
/* 80280C2C-80280C30 27B56C 0004+00 1/0 0/0 0/0 .text JSGSetProjectionFar__Q26JStage7TCameraFf */
+2 -2
View File
@@ -1,5 +1,5 @@
#include "JSystem/JStage/JSGFog.h"
#include "MSL_C/math.h"
#include "MSL_C/float.h"
/* 80280C80-80280CE0 27B5C0 0060+00 0/0 1/1 0/0 .text __dt__Q26JStage4TFogFv */
JStage::TFog::~TFog() {}
@@ -28,7 +28,7 @@ void JStage::TFog::JSGSetStartZ(f32) {}
/* 80280D00-80280D0C 27B640 000C+00 1/0 1/0 0/0 .text JSGGetEndZ__Q26JStage4TFogCFv */
f32 JStage::TFog::JSGGetEndZ() const {
return __float_max[0];
return FLT_MAX;
}
/* 80280D0C-80280D10 27B64C 0004+00 1/0 0/0 0/0 .text JSGSetEndZ__Q26JStage4TFogFf */
@@ -449,7 +449,7 @@ asm f64 extrapolateParameter_turn(f64 param_0, f64 param_1) {
} // namespace functionvalue
void TFunctionValueAttribute_range::range_initialize() {
fBegin_ = __float_nan[0]; // NaN
fBegin_ = NAN; // NaN
fEnd_ = fBegin_;
fDifference_ = fBegin_;
@@ -541,7 +541,7 @@ asm f64 TFunctionValueAttribute_range::range_getParameter(f64 param_0, f64 param
#endif
TFunctionValueAttribute_range::TFunctionValueAttribute_range()
: fBegin_(__float_nan[0]), fEnd_(fBegin_), fDifference_(fBegin_),
: fBegin_(NAN), fEnd_(fBegin_), fDifference_(fBegin_),
mProgress(TFunctionValue::PROG_INIT), mAdjust(TFunctionValue::ADJ_INIT), _20(fBegin_),
_28(fBegin_), mBegin(TFunctionValue::OUT_INIT), mEnd(TFunctionValue::OUT_INIT) {}
@@ -676,7 +676,7 @@ asm void TFunctionValue_composite::composite_divide(TVector_pointer<TFunctionVal
}
#pragma pop
TFunctionValue_constant::TFunctionValue_constant() : fValue_(__float_nan[0]) {}
TFunctionValue_constant::TFunctionValue_constant() : fValue_(NAN) {}
u32 TFunctionValue_constant::getType() const {
return 2;
@@ -687,7 +687,7 @@ TFunctionValueAttributeSet TFunctionValue_constant::getAttributeSet() {
}
void TFunctionValue_constant::initialize() {
fValue_ = __float_nan[0];
fValue_ = NAN;
}
void TFunctionValue_constant::prepare() {
@@ -698,7 +698,7 @@ f64 TFunctionValue_constant::getValue(f64 arg1) {
return fValue_;
}
TFunctionValue_transition::TFunctionValue_transition() : _48(__float_nan[0]), _50(_48) {}
TFunctionValue_transition::TFunctionValue_transition() : _48(NAN), _50(_48) {}
u32 TFunctionValue_transition::getType() const {
return 3;
@@ -712,7 +712,7 @@ void TFunctionValue_transition::initialize() {
range_initialize();
interpolate_initialize();
_48 = __float_nan[0];
_48 = NAN;
_50 = _48;
}
@@ -732,7 +732,7 @@ asm f64 TFunctionValue_transition::getValue(f64 param_0) {
}
#pragma pop
TFunctionValue_list::TFunctionValue_list() : _44(NULL), _48(0), _50(__float_nan[0]), _58(NULL) {}
TFunctionValue_list::TFunctionValue_list() : _44(NULL), _48(0), _50(NAN), _58(NULL) {}
u32 TFunctionValue_list::getType() const {
return 4;
@@ -748,7 +748,7 @@ void TFunctionValue_list::initialize() {
_44 = NULL;
_48 = 0;
_50 = __float_nan[0];
_50 = NAN;
_58 = NULL;
}
+4 -4
View File
@@ -1,16 +1,16 @@
#include "MSL_C/MSL_Common/Src/float.h"
/* 80450AE0-80450AE4 000560 0004+00 0/0 204/204 1060/1060 .sdata __float_nan */
extern unsigned long __float_nan = 0x7FFFFFFF;
unsigned long __float_nan[] = {0x7FFFFFFF};
/* 80450AE4-80450AE8 000564 0004+00 0/0 1/1 0/0 .sdata __float_huge */
extern unsigned long __float_huge = 0x7F800000;
unsigned long __float_huge[] = {0x7F800000};
/* 80450AE8-80450AEC 000568 0004+00 0/0 18/18 14/14 .sdata __float_max */
extern unsigned long __float_max = 0x7F7FFFFF;
unsigned long __float_max[] = {0x7F7FFFFF};
/* 80450AEC-80450AF0 00056C 0004+00 0/0 28/28 0/0 .sdata __float_epsilon */
extern unsigned long __float_epsilon = 0x34000000;
unsigned long __float_epsilon[] = {0x34000000};
/* 80450AF0-80450AF4 000570 0004+00 0/0 1/1 0/0 .sdata None */
extern float data_80450AF0;
+1 -1
View File
@@ -74,7 +74,7 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
if(hx>0) return 0.0; /* acos(1) = 0 */
else return pi+2.0*pio2_lo; /* acos(-1)= pi */
}
return *__float_nan; /* acos(|x|>1) is NaN */
return NAN; /* acos(|x|>1) is NaN */
}
if(ix<0x3fe00000) { /* |x| < 0.5 */
if(ix<=0x3c600000) return pio2_hi+pio2_lo;/*if|x|<2**-57*/
+1 -1
View File
@@ -80,7 +80,7 @@ double __ieee754_asin(x) double x;
if (((ix - 0x3ff00000) | __LO(x)) == 0)
/* asin(1)=+-pi/2 with inexact */
return x * pio2_hi + x * pio2_lo;
return *__float_nan; /* asin(|x|>1) is NaN */
return NAN; /* asin(|x|>1) is NaN */
} else if (ix < 0x3fe00000) { /* |x|<0.5 */
if (ix < 0x3e400000) { /* if |x| < 2**-27 */
if (huge + x > one)
+1 -1
View File
@@ -257,7 +257,7 @@ double __ieee754_pow(x, y) double x, y;
if (((((int)hx >> 31) + 1) | yisint) == 0) {
errno = 33;
return (double)*__float_nan;
return (double)NAN;
};
/* |y| is huge */
+1 -1
View File
@@ -116,7 +116,7 @@ double __ieee754_sqrt(x) double x;
return x; /* sqrt(+-0) = +-0 */
else if (ix0 < 0) {
errno = 33;
return *__float_nan;
return NAN;
} /* sqrt(-ve) = sNaN */
}
/* normalize x */
+2 -2
View File
@@ -4,7 +4,7 @@
//
#include "SSystem/SComponent/c_m3d.h"
#include "MSL_C/math.h"
#include "MSL_C/float.h"
#include "SSystem/SComponent/c_m3d_g_aab.h"
#include "SSystem/SComponent/c_m3d_g_cps.h"
#include "SSystem/SComponent/c_m3d_g_cyl.h"
@@ -113,7 +113,7 @@ extern "C" extern void* __vt__8cM3dGSph[3];
// Declarations:
//
f32 G_CM3D_F_ABS_MIN = 32 * __float_epsilon[0];
f32 G_CM3D_F_ABS_MIN = 32 * FLT_EPSILON;
/* 80268560-802685B0 262EA0 0050+00 2/2 0/0 0/0 .text cM3d_InDivPos1__FPC3VecPC3VecfP3Vec
*/
+4 -4
View File
@@ -4,7 +4,7 @@
//
#include "SSystem/SComponent/c_xyz.h"
#include "MSL_C/math.h"
#include "MSL_C/float.h"
#include "SSystem/SComponent/c_math.h"
#include "dol2asm.h"
#include "global.h"
@@ -144,9 +144,9 @@ bool cXyz::operator!=(const Vec& vec) const {
/* 802670AC-80267128 007C+00 s=0 e=4 z=7 None .text isZero__4cXyzCFv */
bool cXyz::isZero(void) const {
return fabsf(this->x) < 32.0f * __float_epsilon[0] &&
fabsf(this->y) < 32.0f * __float_epsilon[0] &&
fabsf(this->z) < 32.0f * __float_epsilon[0];
return fabsf(this->x) < 32.0f * FLT_EPSILON &&
fabsf(this->y) < 32.0f * FLT_EPSILON &&
fabsf(this->z) < 32.0f * FLT_EPSILON;
}
/* 80267128-80267150 0028+00 s=0 e=81 z=85 None .text atan2sX_Z__4cXyzCFv */