* header cleanup, but there is still a lot more to do...

* added round(), roundf(), and roundl() implementations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14891 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-13 13:22:47 +00:00
parent 6065411b88
commit 4e766dd482
3 changed files with 97 additions and 44 deletions
+1
View File
@@ -34,6 +34,7 @@ KernelMergeObject posix_math.o :
log__L.c
math_globals.c
pow.c
round.c
sincos.c
sinh.c
tan.c
+42
View File
@@ -0,0 +1,42 @@
/*
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <math.h>
float
roundf(float value)
{
if (value >= 0.0f)
return floorf(value + 0.5f);
return ceilf(value + 0.5f);
}
double
round(double value)
{
if (value >= 0.0)
return floor(value + 0.5);
return ceil(value + 0.5);
}
long double
roundl(long double value)
{
// TODO: fix me!
return (long double)round((double)value);
#if 0
if (value >= 0.0)
return floorl(value + 0.5);
return ceill(value + 0.5);
#endif
}