LibM: Implement some naive functionality to make VVVVVV run

This commit is contained in:
Andreas Kling 2020-01-13 19:00:55 +01:00
parent 65cb406327
commit 3b2f20ed4d
Notes: sideshowbarker 2024-07-19 10:04:21 +09:00

View file

@ -64,11 +64,11 @@ double pow(double x, double y)
return exp(y * log(x));
}
double ldexp(double, int exp)
double ldexp(double x, int exp)
{
(void)exp;
ASSERT_NOT_REACHED();
return 0;
// FIXME: Please fix me. I am naive.
double val = pow(2, exp);
return x * val;
}
double tanh(double x)
@ -290,6 +290,16 @@ float roundf(float value)
return (float)(int)(value - 0.5f);
}
double floor(double value)
{
return (int)value;
}
double rint(double value)
{
return (int)roundf(value);
}
float ceilf(float value)
{
// FIXME: Please fix me. I am naive.
@ -300,6 +310,16 @@ float ceilf(float value)
return as_int + 1;
}
double ceil(double value)
{
// FIXME: Please fix me. I am naive.
int as_int = (int)value;
if (value == (double)as_int) {
return (double)as_int;
}
return as_int + 1;
}
double modf(double x, double* intpart)
{
*intpart = (double)((int)(x));