jaudio_NES: link ja_calc

This commit is contained in:
Cuyler36
2025-06-21 07:40:17 -04:00
parent 1eabeec82f
commit a221df432d
3 changed files with 25 additions and 3 deletions
@@ -10,6 +10,27 @@ namespace std {
float sqrtf(float);
float sinf(float);
inline float sinf(float x) {
return (float)sin((double)x);
}
inline float sqrtf(float x) {
static const double _half = .5;
static const double _three = 3.0;
volatile float y;
if (x > 0.0f) {
double guess = __frsqrte((double)x); // returns an approximation to
guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits
y = (float)(x * guess);
return y;
}
return x;
}
#ifdef __cplusplus
}
#endif