diff --git a/headers/posix/math.h b/headers/posix/math.h index 4d4a25679d..2da04b698f 100644 --- a/headers/posix/math.h +++ b/headers/posix/math.h @@ -104,7 +104,7 @@ extern float log10f(float x); extern float log1pf(float x); extern float logbf(float x); extern float logf(float x); -extern long lroundf(float x); +extern long lroundf(float x); extern float modff(float x, float *y); extern float powf(float x, float y); extern float roundf(float x); @@ -129,9 +129,10 @@ extern double fmod(double x, double y); extern double frexp(double x, int *_exponent); extern double gamma(double x); extern double ldexp(double x, int exponent); +extern double lgamma(double x); extern double log(double x); extern double log10(double x); -extern long lround(double x); +extern long lround(double x); extern double modf(double x, double *y); extern double pow(double x, double y); extern double round(double x); @@ -143,12 +144,10 @@ extern double tanh(double x); extern double trunc(double x); /* long double math functions */ +extern long double lgammal(long double x); extern long double roundl(long double x); extern long lroundl(long double x); -/* TODO: add and fix those! */ -extern /*long*/ double lgamma(/*long*/ double x); - /* some BSD non-ANSI or POSIX math functions */ extern double acosh(double x); extern double asinh(double x); diff --git a/src/system/libroot/posix/glibc/arch/m68k/Jamfile b/src/system/libroot/posix/glibc/arch/m68k/Jamfile index b3fa896e14..90c8f90e82 100644 --- a/src/system/libroot/posix/glibc/arch/m68k/Jamfile +++ b/src/system/libroot/posix/glibc/arch/m68k/Jamfile @@ -141,6 +141,7 @@ MergeObject posix_gnu_arch_$(TARGET_ARCH)_other.o : e_sqrt.c e_sqrtf.c # e_sqrtl.c # s_fdim.c s_fdimf.c # s_fdiml.S # s_fabs.S s_fabsf.S # s_fabsl.S + s_fpclassifyl.c # s_isnan.c s_isnanf.S s_rint.c s_rintf.c # s_rintl.c # t_sqrt.c diff --git a/src/system/libroot/posix/glibc/arch/m68k/s_fpclassifyl.c b/src/system/libroot/posix/glibc/arch/m68k/s_fpclassifyl.c new file mode 100644 index 0000000000..a8cb099927 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/m68k/s_fpclassifyl.c @@ -0,0 +1,44 @@ +/* Return classification value corresponding to argument. m68k version. + Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + Fixed for m68k by Andreas Schwab . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "math_private.h" + + +int +__fpclassifyl (long double x) +{ + u_int32_t ex, hx, lx; + int retval = FP_NORMAL; + + GET_LDOUBLE_WORDS (ex, hx, lx, x); + ex &= 0x7fff; + if ((ex | hx | lx) == 0) + retval = FP_ZERO; + else if (ex == 0 && (hx & 0x80000000) == 0) + retval = FP_SUBNORMAL; + else if (ex == 0x7fff) + retval = ((hx & 0x7fffffff) | lx) != 0 ? FP_NAN : FP_INFINITE; + + return retval; +} +libm_hidden_def (__fpclassifyl) diff --git a/src/system/libroot/posix/glibc/arch/x86/Jamfile b/src/system/libroot/posix/glibc/arch/x86/Jamfile index 91cf03623f..b1b7b8afd9 100644 --- a/src/system/libroot/posix/glibc/arch/x86/Jamfile +++ b/src/system/libroot/posix/glibc/arch/x86/Jamfile @@ -144,6 +144,7 @@ MergeObject posix_gnu_arch_$(TARGET_ARCH)_s.o : s_fabs.S s_fabsf.S s_fabsl.S s_finite.S s_finitef.S s_finitel.S s_floor.S s_floorf.S s_floorl.S + s_fpclassifyl.c s_frexp.S s_frexpf.S s_frexpl.S s_ilogb.S s_ilogbf.S s_isinfl.c diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fpclassifyl.c b/src/system/libroot/posix/glibc/arch/x86/s_fpclassifyl.c new file mode 100644 index 0000000000..679e721d38 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fpclassifyl.c @@ -0,0 +1,43 @@ +/* Return classification value corresponding to argument. + Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "math_private.h" + + +int +__fpclassifyl (long double x) +{ + u_int32_t ex, hx, lx; + int retval = FP_NORMAL; + + GET_LDOUBLE_WORDS (ex, hx, lx, x); + ex &= 0x7fff; + if ((ex | lx | hx) == 0) + retval = FP_ZERO; + else if (ex == 0 && (hx & 0x80000000) == 0) + retval = FP_SUBNORMAL; + else if (ex == 0x7fff) + retval = ((hx & 0x7fffffff) | lx) != 0 ? FP_NAN : FP_INFINITE; + + return retval; +} +libm_hidden_def (__fpclassifyl)