Browse Source

libm: Add missing C99 float/ld wrappers

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Bernhard Reutner-Fischer 9 years ago
parent
commit
6c4538905e

+ 1 - 0
TODO

@@ -93,6 +93,7 @@ TODO list for the uClibc 1.0.0 release:
 	ugetrlimit, it seems, else use the modern variant)
 	*) simplify exec*() in the light of execvpe (perhaps single internal
 	impl); USE_GNU for execvpe (and other GNU extensions, see psm).
+	*) Remove unused math complex hidden protos throughout
 
 
 TODO list for AFTER the uClibc 1.0.0 release:

+ 2 - 0
include/complex.h

@@ -79,6 +79,7 @@ __BEGIN_DECLS
 #endif
 #include <bits/cmathcalls.h>
 #undef	_Mdouble_
+#undef	_Mfloat_
 #undef	__MATH_PRECNAME
 
 /* And the long double versions.  It is non-critical to define them
@@ -97,6 +98,7 @@ __BEGIN_DECLS
 # include <bits/cmathcalls.h>
 #endif
 #undef	_Mdouble_
+#undef	_Mlong_double_
 #undef	__MATH_PRECNAME
 #undef	__MATHDECL_1
 #undef	__MATHDECL

+ 2 - 0
include/math.h

@@ -129,6 +129,7 @@ __BEGIN_DECLS
 # undef	_Mdouble_
 # undef _Mdouble_BEGIN_NAMESPACE
 # undef _Mdouble_END_NAMESPACE
+# undef _Mfloat_
 # undef	__MATH_PRECNAME
 # undef __MATH_maybe_libm_hidden_proto
 
@@ -176,6 +177,7 @@ extern long double __REDIRECT_NTH (nexttowardl, (long double __x, long double __
 #  undef _Mdouble_
 #  undef _Mdouble_BEGIN_NAMESPACE
 #  undef _Mdouble_END_NAMESPACE
+#  undef _Mlong_double_
 #  undef __MATH_PRECNAME
 #  undef __MATH_maybe_libm_hidden_proto
 

+ 23 - 0
libc/sysdeps/linux/common/bits/mathcalls.h

@@ -74,8 +74,22 @@ __MATHCALLI (atan2,, (_Mdouble_ __y, _Mdouble_ __x))
 
 /* Cosine of X.  */
 __MATHCALLI (cos,, (_Mdouble_ __x))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(cosl)
+# endif
+# if defined _LIBC && defined _Mfloat_
+libm_hidden_proto(cosf)
+# endif
+
 /* Sine of X.  */
 __MATHCALLI (sin,, (_Mdouble_ __x))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(sinl)
+# endif
+# if defined _LIBC && defined _Mfloat_
+libm_hidden_proto(sinf)
+# endif
+
 /* Tangent of X.  */
 __MATHCALLI (tan,, (_Mdouble_ __x))
 
@@ -111,6 +125,9 @@ __END_NAMESPACE_C99
 _Mdouble_BEGIN_NAMESPACE
 /* Exponential function of X.  */
 __MATHCALLI (exp,, (_Mdouble_ __x))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(expl)
+# endif
 
 /* Break VALUE into a normalized fraction and an integral power of 2.  */
 __MATHCALLI (frexp,, (_Mdouble_ __x, int *__exponent))
@@ -173,6 +190,9 @@ _Mdouble_END_NAMESPACE
 __BEGIN_NAMESPACE_C99
 /* Return `sqrt(X*X + Y*Y)'.  */
 __MATHCALLI (hypot,, (_Mdouble_ __x, _Mdouble_ __y))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(hypotl)
+# endif
 __END_NAMESPACE_C99
 #endif
 
@@ -298,6 +318,9 @@ __MATHCALLI (rint,, (_Mdouble_ __x))
 
 /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
 __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(nextafterl)
+# endif
 # if defined __USE_ISOC99 && !defined __LDBL_COMPAT
 __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__))
 # endif

+ 36 - 5
libm/Makefile.in

@@ -75,9 +75,6 @@ libm_CSRC := \
 	s_remquo.c w_exp2.c \
 	cexp.c sincos.c
 
-# Not implemented [yet?], see comment in float_wrappers.c:
-# fdimf.o fmaf.o fmaxf.o fminf.o
-# nearbyintf.o remquof.o scalblnf.o tgammaf.o
 FL_MOBJ := \
 	acosf.o \
 	acoshf.o \
@@ -98,7 +95,11 @@ FL_MOBJ := \
 	expf.o \
 	expm1f.o \
 	fabsf.o \
+	fdimf.o \
 	floorf.o \
+	fmaf.o \
+	fmaxf.o \
+	fminf.o \
 	fmodf.o \
 	frexpf.o \
 	gammaf.o \
@@ -116,11 +117,14 @@ FL_MOBJ := \
 	lrintf.o \
 	lroundf.o \
 	modff.o \
+	nearbyintf.o \
+	nexttowardf.o \
 	powf.o \
 	remainderf.o \
+	remquof.o \
 	rintf.o \
 	roundf.o \
-	scalbf.o \
+	scalblnf.o \
 	scalbnf.o \
 	significandf.o \
 	sinf.o \
@@ -128,9 +132,24 @@ FL_MOBJ := \
 	sqrtf.o \
 	tanf.o \
 	tanhf.o \
+	tgammaf.o \
 	truncf.o \
 
-# Not implemented [yet?]: nexttowardl.o
+ifeq ($(UCLIBC_SUSV3_LEGACY),y)
+FL_MOBJ += scalbf.o
+endif
+
+# Do not (yet?) implement the float variants of bessel functions
+ifeq (not-yet-implemented-$(DO_XSI_MATH),y)
+FL_MOBJ += \
+	j0f.o \
+	j1f.o \
+	jnf.o \
+	y0f.o \
+	y1f.o \
+	ynf.o
+endif
+
 LD_MOBJ := \
 	__finitel.o \
 	__fpclassifyl.o \
@@ -180,6 +199,7 @@ LD_MOBJ := \
 	modfl.o \
 	nearbyintl.o \
 	nextafterl.o \
+	nexttowardl.o \
 	powl.o \
 	remainderl.o \
 	remquol.o \
@@ -196,6 +216,17 @@ LD_MOBJ := \
 	tgammal.o \
 	truncl.o \
 
+# Do not (yet?) implement the long double variants of bessel functions
+ifeq (not-yet-implemented-$(DO_XSI_MATH),y)
+LD_MOBJ += \
+	j0l.o \
+	j1l.o \
+	jnl.o \
+	y0l.o \
+	y1l.o \
+	ynl.o
+endif
+
 else
 
 # This list of math functions was taken from POSIX/IEEE 1003.1b-1993

+ 41 - 21
libm/float_wrappers.c

@@ -38,19 +38,14 @@ long long func##f (float x) \
 	return func((double)x); \
 }
 
-
-/* For the time being, do _NOT_ implement these functions
- * that are defined by SuSv3 [because we don't need them
- * and nobody asked to include them] */
-#undef L_fdimf         /*float       fdimf(float, float);*/
-#undef L_fmaf          /*float       fmaf(float, float, float);*/
-#undef L_fmaxf         /*float       fmaxf(float, float);*/
-#undef L_fminf         /*float       fminf(float, float);*/
-#undef L_nearbyintf    /*float       nearbyintf(float);*/
-#undef L_nexttowardf   /*float       nexttowardf(float, long double);*/
-#undef L_remquof       /*float       remquof(float, float, int *);*/
-#undef L_scalblnf      /*float       scalblnf(float, long);*/
-#undef L_tgammaf       /*float       tgammaf(float);*/
+#ifndef __DO_XSI_MATH__
+# undef L_j0f	/* float j0f(float x); */
+# undef L_j1f	/* float j1f(float x); */
+# undef L_jnf	/* float jnf(int n, float x); */
+# undef L_y0f	/* float y0f(float x); */
+# undef L_y1f	/* float y1f(float x); */
+# undef L_ynf	/* float ynf(int n, float x); */
+#endif
 
 /* Implement the following, as defined by SuSv3 */
 #if 0
@@ -155,6 +150,7 @@ float copysignf (float x, float y)
 
 #ifdef L_cosf
 WRAPPER1(cos)
+libm_hidden_def(cosf)
 #endif
 
 #ifdef L_coshf
@@ -242,6 +238,21 @@ float hypotf (float x, float y)
 int_WRAPPER1(ilogb)
 #endif
 
+#ifdef L_j0f
+WRAPPER1(j0)
+#endif
+
+#ifdef L_j1f
+WRAPPER1(j1)
+#endif
+
+#ifdef L_jnf
+float jnf(int n, float x)
+{
+	return (float) jn(n, (double)x);
+}
+#endif
+
 #ifdef L_ldexpf
 float ldexpf (float x, int _exp)
 {
@@ -306,7 +317,7 @@ WRAPPER1(nearbyint)
 #ifdef L_nexttowardf
 float nexttowardf (float x, long double y)
 {
-	return (float) nexttoward( (double)x, (double)y );
+	return (float) nexttoward( (double)x, (long double)y );
 }
 #endif
 
@@ -355,6 +366,7 @@ float scalbnf (float x, int _exp)
 
 #ifdef L_sinf
 WRAPPER1(sin)
+libm_hidden_def(sinf)
 #endif
 
 #ifdef L_sinhf
@@ -381,13 +393,6 @@ WRAPPER1(tgamma)
 WRAPPER1(trunc)
 #endif
 
-#ifdef L_fmaf
-float fmaf (float x, float y, float z)
-{
-	return (float) fma( (double)x, (double)y, (double)z );
-}
-#endif
-
 #if defined L_scalbf && defined __UCLIBC_SUSV3_LEGACY__
 float scalbf (float x, float y)
 {
@@ -402,3 +407,18 @@ WRAPPER1(gamma)
 #ifdef L_significandf
 WRAPPER1(significand)
 #endif
+
+#ifdef L_y0f
+WRAPPER1(y0)
+#endif
+
+#ifdef L_y1f
+WRAPPER1(y1)
+#endif
+
+#ifdef L_ynf
+float ynf(int n, float x)
+{
+	return (float) yn(n, (double)x);
+}
+#endif

+ 54 - 4
libm/ldouble_wrappers.c

@@ -42,6 +42,15 @@ long long func##l(long double x) \
 	return func((double) x); \
 }
 
+#ifndef __DO_XSI_MATH__
+# undef L_j0l  /* long double j0l(long double x); */
+# undef L_j1l  /* long double j1l(long double x); */
+# undef L_jnl  /* long double jnl(int n, long double x); */
+# undef L_y0l  /* long double y0l(long double x); */
+# undef L_y1l  /* long double y1l(long double x); */
+# undef L_ynl  /* long double ynl(int n, long double x); */
+#endif
+
 /* Implement the following, as defined by SuSv3 */
 #if 0
 long double acoshl(long double);
@@ -156,6 +165,7 @@ WRAPPER1(cosh)
 
 #ifdef L_cosl
 WRAPPER1(cos)
+libm_hidden_def(cosl)
 #endif
 
 #ifdef L_erfcl
@@ -172,6 +182,7 @@ WRAPPER1(exp2)
 
 #ifdef L_expl
 WRAPPER1(exp)
+libm_hidden_def(expl)
 #endif
 
 #ifdef L_expm1l
@@ -222,12 +233,28 @@ WRAPPER1(gamma)
 
 #ifdef L_hypotl
 WRAPPER2(hypot)
+libm_hidden_def(hypotl)
 #endif
 
 #ifdef L_ilogbl
 int_WRAPPER1(ilogb)
 #endif
 
+#ifdef L_j0l
+	WRAPPER1(j0)
+#endif
+
+#ifdef L_j1l
+	WRAPPER1(j1)
+#endif
+
+#ifdef L_jnl
+long double jnl(int n, long double x)
+{
+	return (long double) jn(n, (double)x);
+}
+#endif
+
 #ifdef L_ldexpl
 long double ldexpl (long double x, int ex)
 {
@@ -291,12 +318,18 @@ WRAPPER1(nearbyint)
 
 #ifdef L_nextafterl
 WRAPPER2(nextafter)
+libm_hidden_def(nextafterl)
 #endif
 
-/* Disabled in Makefile.in */
-#if 0 /* def L_nexttowardl */
-WRAPPER2(nexttoward)
-libm_hidden_def(nexttowardl)
+#ifdef L_nexttowardl
+# if 0 /* TODO */
+strong_alias(nextafterl, nexttowardl)
+# else
+long double nexttowardl(long double x, long double y)
+{
+	return nextafterl(x, y);
+}
+#endif
 #endif
 
 #ifdef L_powl
@@ -344,6 +377,7 @@ WRAPPER1(sinh)
 
 #ifdef L_sinl
 WRAPPER1(sin)
+libm_hidden_def(sinl)
 #endif
 
 #ifdef L_sqrtl
@@ -370,6 +404,22 @@ WRAPPER1(trunc)
 WRAPPER1(significand)
 #endif
 
+#ifdef L_y0l
+WRAPPER1(y0)
+#endif
+
+#ifdef L_y1l
+WRAPPER1(y1)
+#endif
+
+#ifdef L_ynl
+long double ynl(int n, long double x)
+{
+	return (long double) yn(n, (double)x);
+}
+#endif
+
+
 #if defined __DO_C99_MATH__ && !defined __NO_LONG_DOUBLE_MATH
 
 # ifdef L___fpclassifyl

+ 13 - 4
libm/s_fdim.c

@@ -6,13 +6,22 @@
 
 #include "math.h"
 #include "math_private.h"
+#include <errno.h>
 
 double fdim(double x, double y)
 {
-  int c = __fpclassify(x);
-  if (c == FP_NAN || c == FP_INFINITE)
-    return HUGE_VAL;
+  int cx = __fpclassify(x); /* need both NAN and INF */
+  int cy = __fpclassify(y); /* need both NAN and INF */
+  if (cx == FP_NAN || cy == NAN)
+    return x - y;
 
-  return x > y ? x - y : 0.0;
+  if (x <= y)
+	  return .0;
+
+  double z = x - y;
+  if (isinf(z) && cx != FP_INFINITE && cy != FP_INFINITE)
+	  __set_errno(ERANGE);
+
+  return z;
 }
 libm_hidden_def(fdim)

+ 3 - 3
libm/s_fmax.c

@@ -9,10 +9,10 @@
 
 double fmax(double x, double y)
 {
-  if (__fpclassify(x) == FP_NAN)
-    return x;
-  if (__fpclassify(y) == FP_NAN)
+  if (isnan(x))
     return y;
+  if (isnan(y))
+    return x;
 
   return x > y ? x : y;
 }

+ 3 - 3
libm/s_fmin.c

@@ -9,10 +9,10 @@
 
 double fmin(double x, double y)
 {
-  if (__fpclassify(x) == FP_NAN)
-    return x;
-  if (__fpclassify(y) == FP_NAN)
+  if (isnan(x))
     return y;
+  if (isnan(y))
+    return x;
 
   return x < y ? x : y;
 }

+ 3 - 1
libm/s_nextafter.c

@@ -32,7 +32,7 @@ double nextafter(double x, double y)
 	if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) ||   /* x is nan */
 	   ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0))     /* y is nan */
 	   return x+y;
-	if(x==y) return x;		/* x=y, return x */
+	if(x==y) return y;		/* x=y, return y */
 	if((ix|lx)==0) {			/* x == 0 */
 	    INSERT_WORDS(x,hy&0x80000000,1);	/* return +-minsubnormal */
 	    y = x*x;
@@ -68,3 +68,5 @@ double nextafter(double x, double y)
 	return x;
 }
 libm_hidden_def(nextafter)
+strong_alias_untyped(nextafter, nexttoward)
+libm_hidden_def(nexttoward)

+ 10 - 10
test/math/compile_test.c

@@ -22,11 +22,11 @@ r += exp2f(float_x);
 r += expf(float_x);
 r += expm1f(float_x);
 r += fabsf(float_x);
-/*r += fdimf(float_x, float_x); - uclibc does not have it (yet?) */
+r += fdimf(float_x, float_x);
 r += floorf(float_x);
-/*r += fmaf(float_x, float_x, float_x); - uclibc does not have it (yet?) */
-/*r += fmaxf(float_x, float_x); - uclibc does not have it (yet?) */
-/*r += fminf(float_x, float_x); - uclibc does not have it (yet?) */
+r += fmaf(float_x, float_x, float_x);
+r += fmaxf(float_x, float_x);
+r += fminf(float_x, float_x);
 r += fmodf(float_x, float_x);
 r += frexpf(float_x, &int_x);
 r += gammaf(float_x);
@@ -44,17 +44,17 @@ r += logf(float_x);
 r += lrintf(float_x);
 r += lroundf(float_x);
 r += modff(float_x, &float_x);
-/*r += nearbyintf(float_x); - uclibc does not have it (yet?) */
-/*r += nexttowardf(float_x, long_double_x); - uclibc does not have it (yet?) */
+r += nearbyintf(float_x);
+r += nexttowardf(float_x, long_double_x);
 r += powf(float_x, float_x);
 r += remainderf(float_x, float_x);
-/*r += remquof(float_x, float_x, &int_x); - uclibc does not have it (yet?) */
+r += remquof(float_x, float_x, &int_x);
 r += rintf(float_x);
 r += roundf(float_x);
 #ifdef __UCLIBC_SUSV3_LEGACY__
 r += scalbf(float_x, float_x);
 #endif
-/*r += scalblnf(float_x, long_x); - uclibc does not have it (yet?) */
+r += scalblnf(float_x, long_x);
 r += scalbnf(float_x, int_x);
 r += significandf(float_x);
 r += sinf(float_x);
@@ -62,7 +62,7 @@ r += sinhf(float_x);
 r += sqrtf(float_x);
 r += tanf(float_x);
 r += tanhf(float_x);
-/*r += tgammaf(float_x); - uclibc does not have it (yet?) */
+r += tgammaf(float_x);
 r += truncf(float_x);
 return r;
 }
@@ -116,7 +116,7 @@ r += lroundl(long_double_x);
 r += modfl(long_double_x, &long_double_x);
 r += nearbyintl(long_double_x);
 r += nextafterl(long_double_x, long_double_x);
-/* r += nexttowardl(long_double_x, long_double_x); - uclibc doesn't provide this [yet?] */
+r += nexttowardl(long_double_x, long_double_x);
 r += powl(long_double_x, long_double_x);
 r += remainderl(long_double_x, long_double_x);
 r += remquol(long_double_x, long_double_x, &int_x);

+ 25 - 31
test/math/libm-test.inc

@@ -115,6 +115,9 @@
 # define _GNU_SOURCE
 #endif
 
+#undef __CHK_COMPLEX_STUFF
+#define __CHK_COMPLEX_STUFF 0
+
 #include "libm-test-ulps.h"
 #include <complex.h>
 #include <math.h>
@@ -1120,8 +1123,10 @@ cacosh_test (void)
 
   END (cacosh, complex);
 }
+#endif
 
 
+#if __CHK_COMPLEX_STUFF
 static void
 carg_test (void)
 {
@@ -1188,7 +1193,9 @@ carg_test (void)
 
   END (carg);
 }
+#endif /* __CHK_COMPLEX_STUFF */
 
+#if 0
 static void
 casin_test (void)
 {
@@ -1683,7 +1690,7 @@ ceil_test (void)
 }
 
 
-#if 0
+#if __CHK_COMPLEX_STUFF
 static void
 cexp_test (void)
 {
@@ -1746,8 +1753,9 @@ cexp_test (void)
 
   END (cexp, complex);
 }
+#endif /* __CHK_COMPLEX_STUFF */
 
-
+#if 0
 static void
 cimag_test (void)
 {
@@ -2588,7 +2596,6 @@ fabs_test (void)
 }
 
 
-#if 0
 static void
 fdim_test (void)
 {
@@ -2624,7 +2631,6 @@ fdim_test (void)
 
   END (fdim);
 }
-#endif
 
 
 static void
@@ -2694,7 +2700,6 @@ floor_test (void)
 }
 
 
-#if 0
 static void
 fma_test (void)
 {
@@ -2797,7 +2802,6 @@ fmin_test (void)
 
   END (fmin);
 }
-#endif
 
 
 static void
@@ -3002,7 +3006,7 @@ isnormal_test (void)
   END (isnormal);
 }
 
-#if defined __DO_XSI_MATH__
+#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
 static void
 j0_test (void)
 {
@@ -3629,7 +3633,6 @@ modf_test (void)
 }
 
 
-#if 0
 static void
 nearbyint_test (void)
 {
@@ -3710,7 +3713,6 @@ nexttoward_test (void)
 
   END (nexttoward);
 }
-#endif
 
 
 static void
@@ -3950,7 +3952,6 @@ remainder_test (void)
   END (remainder);
 }
 
-#if 0
 static void
 remquo_test (void)
 {
@@ -3981,7 +3982,6 @@ remquo_test (void)
 
   END (remquo);
 }
-#endif
 
 static void
 rint_test (void)
@@ -4229,12 +4229,12 @@ round_test (void)
 #endif
 
 
+#ifdef __UCLIBC_SUSV3_LEGACY__
 static void
 scalb_test (void)
 {
   START (scalb);
 #ifndef TEST_LDOUBLE /* uclibc doesn't have scalbl */
-#ifdef __UCLIBC_SUSV3_LEGACY__ /* scalbf is susv3 legacy */
 
   TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
   TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
@@ -4285,11 +4285,10 @@ scalb_test (void)
 
   TEST_ff_f (scalb, 0.8L, 4, 12.8L);
   TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
-#endif /* __UCLIBC_SUSV3_LEGACY__ */
 #endif /* TEST_LDOUBLE */
   END (scalb);
 }
-
+#endif
 
 static void
 scalbn_test (void)
@@ -4313,7 +4312,6 @@ scalbn_test (void)
 }
 
 
-#if 0
 static void
 scalbln_test (void)
 {
@@ -4334,7 +4332,6 @@ scalbln_test (void)
 
   END (scalbn);
 }
-#endif
 
 
 static void
@@ -4539,7 +4536,6 @@ tanh_test (void)
   END (tanh);
 }
 
-#if 0
 static void
 tgamma_test (void)
 {
@@ -4571,7 +4567,6 @@ tgamma_test (void)
 
   END (tgamma);
 }
-#endif
 
 
 #if 0
@@ -4651,7 +4646,7 @@ trunc_test (void)
 }
 #endif
 
-#if defined __DO_XSI_MATH__
+#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
 static void
 y0_test (void)
 {
@@ -4979,11 +4974,11 @@ main (int argc, char **argv)
   logb_test ();
   modf_test ();
   ilogb_test ();
+#ifdef __UCLIBC_SUSV3_LEGACY__
   scalb_test ();
+#endif
   scalbn_test ();
-#if 0
   scalbln_test ();
-#endif
   significand_test ();
 
   /* Power and absolute value functions:  */
@@ -4998,16 +4993,12 @@ main (int argc, char **argv)
   erfc_test ();
   gamma_test ();
   lgamma_test ();
-#if 0
   tgamma_test ();
-#endif
 
   /* Nearest integer functions:  */
   ceil_test ();
   floor_test ();
-#if 0
   nearbyint_test ();
-#endif
   rint_test ();
 #if 0
   rint_test_tonearest ();
@@ -5025,13 +5016,10 @@ main (int argc, char **argv)
   /* Remainder functions:  */
   fmod_test ();
   remainder_test ();
-#if 0
   remquo_test ();
-#endif
 
   /* Manipulation functions:  */
   copysign_test ();
-#if 0
   nextafter_test ();
   nexttoward_test ();
 
@@ -5043,24 +5031,29 @@ main (int argc, char **argv)
   /* Multiply and add:  */
   fma_test ();
 
+
   /* Complex functions:  */
   cabs_test ();
+#if __CHK_COMPLEX_STUFF
+#if 0
   cacos_test ();
   cacosh_test ();
+#endif
   carg_test ();
+#if 0
   casin_test ();
   casinh_test ();
   catan_test ();
   catanh_test ();
   ccos_test ();
   ccosh_test ();
+#endif
   cexp_test ();
+#if 0
   cimag_test ();
   clog10_test ();
   clog_test ();
-#if 0
   conj_test ();
-#endif
   cpow_test ();
   cproj_test ();
   creal_test ();
@@ -5070,9 +5063,10 @@ main (int argc, char **argv)
   ctan_test ();
   ctanh_test ();
 #endif
+#endif /* __CHK_COMPLEX_STUFF */
 
   /* Bessel functions:  */
-#if defined __DO_XSI_MATH__
+#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
   j0_test ();
   j1_test ();
   jn_test ();