This adds the required functions to libroot.so and fixes DEBUG build.

Unfortunately, they are pretty broken, so I added them into floatmath.c


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14019 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2005-08-21 01:30:46 +00:00
parent 71c9501a76
commit cc33b4a1ca

View File

@ -46,6 +46,8 @@ float scalbf(float x, float n) {return (float)scalb((double)x, (double)n);};
double
modf(double x, double *y)
{
// TODO: this truncates to int precision and is broken!
// this should be implemented arch dependent!
int integer = (int)x;
*y = (double)integer;
return x - integer;
@ -54,8 +56,39 @@ modf(double x, double *y)
float
modff(float x, float *y)
{
// TODO: this truncates to int precision and is broken!
// this should be implemented arch dependent!
double intpart = 0;
float result = (float)modf((double)x, &intpart);
*y = (float)intpart;
return result;
}
int
__signbitf(float value)
{
// TODO: this is broken on most non x86 machines
// this should be implemented arch dependent!
union { float v; int i; } u = { v: value };
return u.i < 0;
}
int
__signbit(double value)
{
// TODO: this is broken on most non x86 machines
// this should be implemented arch dependent!
union { double v; int i[2]; } u = { v: value };
return u.i[1] < 0;
}
int
__signbitl(long double value)
{
// TODO: this is broken on most non x86 machines
// this should be implemented arch dependent!
union { long double v; int i[2]; } u = { v: value };
return (u.i[2] & 0x8000) != 0;
}