--- uClibc-0.9.27/extra/Configs/Config.in.arch.mps 2005-04-20 08:27:30 +0200 +++ uClibc-0.9.27/extra/Configs/Config.in.arch 2005-04-20 10:38:54 +0200 @@ -80,6 +80,16 @@ If your applications require the newer C99 math library functions, then answer Y. +config UCLIBC_HAS_LONG_DOUBLE_MATH + bool "Enable long double support" + depends on DO_C99_MATH + depends on TARGET_i386 || TARGET_m68k || TARGET_sparc || TARGET_x86_64 + default y + help + If you want the uClibc math library to contain the full set of C99 + long double math library features, then answer Y. Don't enable it + for sparc w/ 32bit ABI. + config KERNEL_SOURCE string "Linux kernel header location" default "/usr/src/linux" --- uClibc-0.9.27/include/math.h.mps 2005-04-20 08:30:50 +0200 +++ uClibc-0.9.27/include/math.h 2005-04-20 10:14:26 +0200 @@ -83,7 +83,7 @@ # undef _Mdouble_ # undef __MATH_PRECNAME -# if (__STDC__ - 0 || __GNUC__ - 0) && !defined __NO_LONG_DOUBLE_MATH +# if (__STDC__ - 0 || __GNUC__ - 0) && defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ /* Include the file of declarations again, this time using `long double' instead of `double' and appending l to each function name. */ @@ -166,7 +166,7 @@ }; /* Return number of classification appropriate for X. */ -# ifdef __NO_LONG_DOUBLE_MATH +# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ # define fpclassify(x) \ (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x)) # else @@ -178,7 +178,7 @@ # endif /* Return nonzero value if sign of X is negative. */ -# ifdef __NO_LONG_DOUBLE_MATH +# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ # define signbit(x) \ (sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x)) # else @@ -190,7 +190,7 @@ # endif /* Return nonzero value if X is not +-Inf or NaN. */ -# ifdef __NO_LONG_DOUBLE_MATH +# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ # define isfinite(x) \ (sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x)) # else @@ -206,7 +206,7 @@ /* Return nonzero value if X is a NaN. We could use `fpclassify' but we already have this functions `__isnan' and it is faster. */ -# ifdef __NO_LONG_DOUBLE_MATH +# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ # define isnan(x) \ (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x)) # else @@ -218,7 +218,7 @@ # endif /* Return nonzero value is X is positive or negative infinity. */ -# ifdef __NO_LONG_DOUBLE_MATH +# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ # define isinf(x) \ (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x)) # else --- uClibc-0.9.27/include/complex.h.mps 2005-04-20 10:11:52 +0200 +++ uClibc-0.9.27/include/complex.h 2005-04-20 10:12:14 +0200 @@ -84,7 +84,7 @@ /* And the long double versions. It is non-critical to define them here unconditionally since `long double' is required in ISO C99. */ -#if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH +#if __STDC__ - 0 || __GNUC__ - 0 && defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ # ifndef _Mlong_double_ # define _Mlong_double_ long double # endif --- uClibc-0.9.27/include/tgmath.h.mps 2005-04-20 10:12:33 +0200 +++ uClibc-0.9.27/include/tgmath.h 2005-04-20 10:12:53 +0200 @@ -36,7 +36,7 @@ #if __GNUC_PREREQ (2, 7) -# ifdef __NO_LONG_DOUBLE_MATH +# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__ # define __tgml(fct) fct # else # define __tgml(fct) fct ## l --- uClibc-0.9.27/libc/sysdeps/linux/arm/bits/mathdef.h.mps 2005-04-20 10:20:46 +0200 +++ uClibc-0.9.27/libc/sysdeps/linux/arm/bits/mathdef.h 2005-04-20 10:20:56 +0200 @@ -38,11 +38,3 @@ # define FP_ILOGBNAN (2147483647) #endif /* ISO C99 */ - -#ifndef __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. This disables the - declaration of all the `long double' function variants. */ -/* XXX The FPA does support this but the patterns in GCC are currently - turned off. */ -# define __NO_LONG_DOUBLE_MATH 1 -#endif --- uClibc-0.9.27/libc/sysdeps/linux/common/bits/mathdef.h.mps 2005-04-20 10:21:16 +0200 +++ uClibc-0.9.27/libc/sysdeps/linux/common/bits/mathdef.h 2005-04-20 10:21:26 +0200 @@ -39,9 +39,3 @@ # define FP_ILOGBNAN 2147483647 #endif /* ISO C99 */ - -#ifndef __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. The disables the - declaration of all the `long double' function variants. */ -# define __NO_LONG_DOUBLE_MATH 1 -#endif --- uClibc-0.9.27/libc/sysdeps/linux/nios/bits/mathdef.h.mps 2005-04-20 10:21:53 +0200 +++ uClibc-0.9.27/libc/sysdeps/linux/nios/bits/mathdef.h 2005-04-20 10:22:00 +0200 @@ -38,11 +38,3 @@ # define FP_ILOGBNAN (2147483647) #endif /* ISO C99 */ - -#ifndef __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. This disables the - declaration of all the `long double' function variants. */ -/* XXX The FPA does support this but the patterns in GCC are currently - turned off. */ -# define __NO_LONG_DOUBLE_MATH 1 -#endif --- uClibc-0.9.27/libc/sysdeps/linux/nios2/bits/mathdef.h.mps 2005-04-20 10:22:23 +0200 +++ uClibc-0.9.27/libc/sysdeps/linux/nios2/bits/mathdef.h 2005-04-20 10:22:37 +0200 @@ -38,11 +38,3 @@ # define FP_ILOGBNAN (2147483647) #endif /* ISO C99 */ - -#ifndef __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. This disables the - declaration of all the `long double' function variants. */ -/* XXX The FPA does support this but the patterns in GCC are currently - turned off. */ -# define __NO_LONG_DOUBLE_MATH 1 -#endif --- uClibc-0.9.27/libc/sysdeps/linux/powerpc/bits/mathdef.h.mps 2005-04-20 10:22:56 +0200 +++ uClibc-0.9.27/libc/sysdeps/linux/powerpc/bits/mathdef.h 2005-04-20 10:23:06 +0200 @@ -73,9 +73,3 @@ # define FP_ILOGBNAN (2147483647) #endif /* ISO C99 */ - -#ifndef __NO_LONG_DOUBLE_MATH -/* Signal that we do not really have a `long double'. The disables the - declaration of all the `long double' function variants. */ -# define __NO_LONG_DOUBLE_MATH 1 -#endif --- uClibc-0.9.27/libc/sysdeps/linux/sparc/bits/mathdef.h.mps 2005-04-20 10:23:23 +0200 +++ uClibc-0.9.27/libc/sysdeps/linux/sparc/bits/mathdef.h 2005-04-20 10:24:21 +0200 @@ -64,14 +64,3 @@ # define FP_ILOGBNAN (2147483647) #endif /* ISO C99 */ - -#ifndef __NO_LONG_DOUBLE_MATH - -# if __WORDSIZE == 32 -/* Signal that in 32bit ABI we do not really have a `long double'. - The disables the declaration of all the `long double' function - variants. */ -# define __NO_LONG_DOUBLE_MATH 1 -# endif - -#endif --- uClibc-0.9.27/libm/Makefile.mps 2005-04-20 08:46:32 +0200 +++ uClibc-0.9.27/libm/Makefile 2005-04-20 09:57:46 +0200 @@ -101,7 +101,11 @@ endif COBJS=$(patsubst %.c,%.o, $(CSRC)) +ifeq ($(strip $(UCLIBC_HAS_LONG_DOUBLE_MATH)),y) OBJS=$(COBJS) $(FL_MOBJ) $(LD_MOBJ) +else +OBJS=$(COBJS) $(FL_MOBJ) +endif ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y) --- uClibc-0.9.27/libm/fpmacros.c.mps 2005-04-20 09:58:02 +0200 +++ uClibc-0.9.27/libm/fpmacros.c 2005-04-20 10:08:01 +0200 @@ -107,10 +107,12 @@ } } +#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ int __fpclassifyl ( long double arg ) { return (long double) __fpclassify( (double)arg ); } +#endif /*********************************************************************** int __isnormalf(float x) returns nonzero if and only if x is a @@ -170,6 +172,14 @@ } weak_alias (__finite, finite) +#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ +int __finitel ( long double x ) +{ + return ( __fpclassifyl ( x ) >= FP_ZERO ); +} +weak_alias (__finitel, finitel) +#endif + /*********************************************************************** int __signbitf(float x) returns nonzero if and only if the sign @@ -213,6 +223,13 @@ return sign; } +#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ +int __signbitl ( long double arg ) +{ + return (long double) __signbit( (double)arg ); +} +#endif + /*********************************************************************** * int __isinff(float x) returns -1 if value represents negative @@ -241,6 +258,7 @@ } weak_alias (__isinf, isinf) +#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ int __isinfl ( long double x ) { int class = __fpclassifyl(x); @@ -250,6 +268,7 @@ return 0; } weak_alias (__isinfl, isinfl); +#endif /*********************************************************************** int __isnanf(float x) returns nonzero if and only if x is a @@ -280,10 +299,12 @@ } weak_alias (__isnan, isnan); +#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ int __isnanl ( long double x ) { int class = __fpclassifyl(x); return ( class == FP_NAN ); } weak_alias (__isnanl, isnanl); +#endif --- uClibc-0.9.27/libm/nan.c.mps 2005-04-20 10:08:06 +0200 +++ uClibc-0.9.27/libm/nan.c 2005-04-20 10:08:30 +0200 @@ -35,6 +35,7 @@ return NAN; } +#ifdef __UCLIBC_HAS_LONG_DOUBLE_MATH__ long double nanl (const char *tagp) { if (tagp[0] != '\0') { @@ -44,3 +45,5 @@ } return NAN; } +#endif + --- uClibc-0.9.27/test/math/Makefile.mps 2005-04-20 10:15:30 +0200 +++ uClibc-0.9.27/test/math/Makefile 2005-04-20 10:17:09 +0200 @@ -20,7 +20,7 @@ TESTDIR=../ include $(TESTDIR)/Rules.mak -CFLAGS+=-D_GNU_SOURCE -DNO_LONG_DOUBLE +CFLAGS+=-D_GNU_SOURCE EXTRA_LIBS=-lm PERL=/usr/bin/perl @@ -28,8 +28,10 @@ libm-tests=libm-test.c libm-tests+= test-double test-idouble libm-tests+= diff -#libm-tests+= test-float test-ifloat -#libm-tests+= test-ldouble test-ildouble +libm-tests+= test-float test-ifloat +ifeq ($(strip $(UCLIBC_HAS_LONG_DOUBLE_MATH)),y) +libm-tests+= test-ldouble test-ildouble +endif libm-tests.o = $(addsuffix .o,$(libm-tests)) libm-tests-generated = libm-test-ulps.h libm-test.c