summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-05-22 10:59:04 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-05-22 10:59:04 +0200
commitda0e04506ccf801fa6577363ff10ef7637a82771 (patch)
tree51866fd3a6150bd7a4b90e3f539cba90e8255e01
parentMerge branch 'upstream' (diff)
parentlibtests/math*: Avoid generated files (diff)
downloadrtems-da0e04506ccf801fa6577363ff10ef7637a82771.tar.bz2
Merge branch 'upstream'
-rw-r--r--testsuites/libtests/complex/Makefile.am20
-rw-r--r--testsuites/libtests/complex/docomplex.c106
-rw-r--r--testsuites/libtests/complex/docomplex.h122
-rw-r--r--testsuites/libtests/complex/docomplex.in116
-rw-r--r--testsuites/libtests/complex/docomplexf.c107
-rw-r--r--testsuites/libtests/complex/docomplexl.c107
-rw-r--r--testsuites/libtests/complex/init.c4
-rw-r--r--testsuites/libtests/math/Makefile.am8
-rw-r--r--testsuites/libtests/math/domath.c275
-rw-r--r--testsuites/libtests/math/domath.h293
-rw-r--r--testsuites/libtests/math/domath.in287
-rw-r--r--testsuites/libtests/mathf/Makefile.am8
-rw-r--r--testsuites/libtests/mathf/domathf.c276
-rw-r--r--testsuites/libtests/mathl/Makefile.am9
-rw-r--r--testsuites/libtests/mathl/domathl.c276
15 files changed, 461 insertions, 1553 deletions
diff --git a/testsuites/libtests/complex/Makefile.am b/testsuites/libtests/complex/Makefile.am
index 2a16eec2ce..7861d4a437 100644
--- a/testsuites/libtests/complex/Makefile.am
+++ b/testsuites/libtests/complex/Makefile.am
@@ -2,30 +2,10 @@ if HAS_COMPLEX
rtems_tests_PROGRAMS = complex
complex_SOURCES = init.c docomplex.c docomplexf.c docomplexl.c
endif
-EXTRA_DIST = docomplex.in
# FIXME: Skip long double, not yet supported in newlib
complex_CPPFLAGS = $(AM_CPPFLAGS) -DNO_LONG_DOUBLE
-docomplex.c: $(srcdir)/docomplex.in
- sed -e 's,[@]FTYPE[@],double,' \
- -e 's,[@]FSUFFIX[@], ,g' \
- -e 's,[@]FGUARD[@],NO_DOUBLE,' \
- $(srcdir)/docomplex.in > $(srcdir)/docomplex.c
-
-docomplexf.c: $(srcdir)/docomplex.in
- sed -e 's,[@]FTYPE[@],float,' \
- -e 's,[@]FSUFFIX[@],f,g' \
- -e 's,[@]FGUARD[@],NO_FLOAT,' \
- $(srcdir)/docomplex.in > $(srcdir)/docomplexf.c
-
-docomplexl.c: $(srcdir)/docomplex.in
- sed -e 's,[@]FTYPE[@],long double,' \
- -e 's,[@]FSUFFIX[@],l,g' \
- -e 's,%f,%Lf,g' \
- -e 's,[@]FGUARD[@],NO_LONG_DOUBLE,' \
- $(srcdir)/docomplex.in > $(srcdir)/docomplexl.c
-
dist_rtems_tests_DATA = complex.scn
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
diff --git a/testsuites/libtests/complex/docomplex.c b/testsuites/libtests/complex/docomplex.c
index 7a1b96135b..4872b5d15c 100644
--- a/testsuites/libtests/complex/docomplex.c
+++ b/testsuites/libtests/complex/docomplex.c
@@ -11,106 +11,14 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+ #include "config.h"
#endif
-#include <complex.h>
-#include <stdio.h>
-
-extern void docomplex (void);
-
-void
-docomplex (void)
-{
-#ifndef NO_DOUBLE
- complex double ca, cb, cc;
- double f1;
-
- ca = 1.0 + 1.0 * I;
- cb = 1.0 - 1.0 * I;
-
- f1 = cabs (ca);
- fprintf (stdout, "cabs : %f\n", f1);
-
- cc = cacos (ca);
- fprintf (stdout, "cacos : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = cacosh (ca);
- fprintf (stdout, "cacosh : %f %fi\n", creal (cc),
- cimag (cc));
-
- f1 = carg (ca);
- fprintf (stdout, "carg : %f\n", f1);
-
- cc = casin (ca);
- fprintf (stdout, "casin : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = casinh (ca);
- fprintf (stdout, "casinh : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = catan (ca);
- fprintf (stdout, "catan : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = catanh (ca);
- fprintf (stdout, "catanh : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = ccos (ca);
- fprintf (stdout, "ccos : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = ccosh (ca);
- fprintf (stdout, "ccosh : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = cexp (ca);
- fprintf (stdout, "cexp : %f %fi\n", creal (cc),
- cimag (cc));
-
- f1 = cimag (ca);
- fprintf (stdout, "cimag : %f\n", f1);
-
- cc = clog (ca);
- fprintf (stdout, "clog : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = conj (ca);
- fprintf (stdout, "conj : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = cpow (ca, cb);
- fprintf (stdout, "cpow : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = cproj (ca);
- fprintf (stdout, "cproj : %f %fi\n", creal (cc),
- cimag (cc));
-
- f1 = creal (ca);
- fprintf (stdout, "creal : %f\n", f1);
-
- cc = csin (ca);
- fprintf (stdout, "csin : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = csinh (ca);
- fprintf (stdout, "csinh : %f %fi\n", creal (cc),
- cimag (cc));
-
- cc = csqrt (ca);
- fprintf (stdout, "csqrt : %f %fi\n", creal (cc),
- cimag (cc));
+#ifdef NO_DOUBLE
+ #define PROVIDE_EMPTY_FUNC
+#endif
- cc = ctan (ca);
- fprintf (stdout, "ctan : %f %fi\n", creal (cc),
- cimag (cc));
+#define FTYPE double
+#define PRI "%f"
- cc = ctanh (ca);
- fprintf (stdout, "ctanh : %f %fi\n", creal (cc),
- cimag (cc));
-#endif
-}
+#include "docomplex.h"
diff --git a/testsuites/libtests/complex/docomplex.h b/testsuites/libtests/complex/docomplex.h
new file mode 100644
index 0000000000..96ce9eb1a9
--- /dev/null
+++ b/testsuites/libtests/complex/docomplex.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2010, 2011 by
+ * Ralf Corsepius, Ulm/Germany. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#include <complex.h>
+#include <stdio.h>
+
+#define CONCAT(x, y) x ## y
+#define XCONCAT(x, y) CONCAT(x, y)
+
+#define STRINGIFY(x, y) # x # y
+#define XSTRINGIFY(x, y) STRINGIFY(x, y)
+
+#ifdef SUFFIX
+ #define FUNC(name) XCONCAT(name, SUFFIX)
+ #define STR(name) XSTRINGIFY(name, SUFFIX)
+#else
+ #define FUNC(name) XCONCAT(name, )
+ #define STR(name) XSTRINGIFY(name, ) " "
+#endif
+
+extern void FUNC(docomplex) (void);
+
+void
+FUNC(docomplex) (void)
+{
+#ifndef PROVIDE_EMPTY_FUNC
+ complex FTYPE ca, cb, cc;
+ FTYPE f1;
+
+ ca = 1.0 + 1.0 * I;
+ cb = 1.0 - 1.0 * I;
+
+ f1 = FUNC(cabs) (ca);
+ fprintf (stdout, STR(cabs) " : " PRI "\n", f1);
+
+ cc = FUNC(cacos) (ca);
+ fprintf (stdout, STR(cacos) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(cacosh) (ca);
+ fprintf (stdout, STR(cacosh) ": " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ f1 = FUNC(carg) (ca);
+ fprintf (stdout, STR(carg) " : " PRI "\n", f1);
+
+ cc = FUNC(casin) (ca);
+ fprintf (stdout, STR(casin) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(casinh) (ca);
+ fprintf (stdout, STR(casinh) ": " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(catan) (ca);
+ fprintf (stdout, STR(catan) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(catanh) (ca);
+ fprintf (stdout, STR(catanh) ": " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(ccos) (ca);
+ fprintf (stdout, STR(ccos) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(ccosh) (ca);
+ fprintf (stdout, STR(ccosh) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(cexp) (ca);
+ fprintf (stdout, STR(cexp) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ f1 = FUNC(cimag) (ca);
+ fprintf (stdout, STR(cimag) " : " PRI "\n", f1);
+
+ cc = FUNC(clog) (ca);
+ fprintf (stdout, STR(clog) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(conj) (ca);
+ fprintf (stdout, STR(conj) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(cpow) (ca, cb);
+ fprintf (stdout, STR(cpow) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(cproj) (ca);
+ fprintf (stdout, STR(cproj) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ f1 = FUNC(creal) (ca);
+ fprintf (stdout, STR(creal) " : " PRI "\n", f1);
+
+ cc = FUNC(csin) (ca);
+ fprintf (stdout, STR(csin) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(csinh) (ca);
+ fprintf (stdout, STR(csinh) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(csqrt) (ca);
+ fprintf (stdout, STR(csqrt) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(ctan) (ca);
+ fprintf (stdout, STR(ctan) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+
+ cc = FUNC(ctanh) (ca);
+ fprintf (stdout, STR(ctanh) " : " PRI " " PRI "i\n", FUNC(creal) (cc),
+ FUNC(cimag) (cc));
+#endif
+}
diff --git a/testsuites/libtests/complex/docomplex.in b/testsuites/libtests/complex/docomplex.in
deleted file mode 100644
index e476f6dfd3..0000000000
--- a/testsuites/libtests/complex/docomplex.in
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2010, 2011 by
- * Ralf Corsepius, Ulm/Germany. All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-/*
- * Try to compile and link against POSIX complex math routines.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <complex.h>
-#include <stdio.h>
-
-extern void docomplex@FSUFFIX@ (void);
-
-void
-docomplex@FSUFFIX@ (void)
-{
-#ifndef @FGUARD@
- complex @FTYPE@ ca, cb, cc;
- @FTYPE@ f1;
-
- ca = 1.0 + 1.0 * I;
- cb = 1.0 - 1.0 * I;
-
- f1 = cabs@FSUFFIX@ (ca);
- fprintf (stdout, "cabs@FSUFFIX@ : %f\n", f1);
-
- cc = cacos@FSUFFIX@ (ca);
- fprintf (stdout, "cacos@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = cacosh@FSUFFIX@ (ca);
- fprintf (stdout, "cacosh@FSUFFIX@: %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- f1 = carg@FSUFFIX@ (ca);
- fprintf (stdout, "carg@FSUFFIX@ : %f\n", f1);
-
- cc = casin@FSUFFIX@ (ca);
- fprintf (stdout, "casin@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = casinh@FSUFFIX@ (ca);
- fprintf (stdout, "casinh@FSUFFIX@: %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = catan@FSUFFIX@ (ca);
- fprintf (stdout, "catan@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = catanh@FSUFFIX@ (ca);
- fprintf (stdout, "catanh@FSUFFIX@: %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = ccos@FSUFFIX@ (ca);
- fprintf (stdout, "ccos@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = ccosh@FSUFFIX@ (ca);
- fprintf (stdout, "ccosh@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = cexp@FSUFFIX@ (ca);
- fprintf (stdout, "cexp@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- f1 = cimag@FSUFFIX@ (ca);
- fprintf (stdout, "cimag@FSUFFIX@ : %f\n", f1);
-
- cc = clog@FSUFFIX@ (ca);
- fprintf (stdout, "clog@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = conj@FSUFFIX@ (ca);
- fprintf (stdout, "conj@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = cpow@FSUFFIX@ (ca, cb);
- fprintf (stdout, "cpow@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = cproj@FSUFFIX@ (ca);
- fprintf (stdout, "cproj@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- f1 = creal@FSUFFIX@ (ca);
- fprintf (stdout, "creal@FSUFFIX@ : %f\n", f1);
-
- cc = csin@FSUFFIX@ (ca);
- fprintf (stdout, "csin@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = csinh@FSUFFIX@ (ca);
- fprintf (stdout, "csinh@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = csqrt@FSUFFIX@ (ca);
- fprintf (stdout, "csqrt@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = ctan@FSUFFIX@ (ca);
- fprintf (stdout, "ctan@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-
- cc = ctanh@FSUFFIX@ (ca);
- fprintf (stdout, "ctanh@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc),
- cimag@FSUFFIX@ (cc));
-#endif
-}
diff --git a/testsuites/libtests/complex/docomplexf.c b/testsuites/libtests/complex/docomplexf.c
index ff2e73d3f6..b51f888232 100644
--- a/testsuites/libtests/complex/docomplexf.c
+++ b/testsuites/libtests/complex/docomplexf.c
@@ -11,106 +11,15 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+ #include "config.h"
#endif
-#include <complex.h>
-#include <stdio.h>
-
-extern void docomplexf (void);
-
-void
-docomplexf (void)
-{
-#ifndef NO_FLOAT
- complex float ca, cb, cc;
- float f1;
-
- ca = 1.0 + 1.0 * I;
- cb = 1.0 - 1.0 * I;
-
- f1 = cabsf (ca);
- fprintf (stdout, "cabsf : %f\n", f1);
-
- cc = cacosf (ca);
- fprintf (stdout, "cacosf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = cacoshf (ca);
- fprintf (stdout, "cacoshf: %f %fi\n", crealf (cc),
- cimagf (cc));
-
- f1 = cargf (ca);
- fprintf (stdout, "cargf : %f\n", f1);
-
- cc = casinf (ca);
- fprintf (stdout, "casinf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = casinhf (ca);
- fprintf (stdout, "casinhf: %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = catanf (ca);
- fprintf (stdout, "catanf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = catanhf (ca);
- fprintf (stdout, "catanhf: %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = ccosf (ca);
- fprintf (stdout, "ccosf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = ccoshf (ca);
- fprintf (stdout, "ccoshf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = cexpf (ca);
- fprintf (stdout, "cexpf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- f1 = cimagf (ca);
- fprintf (stdout, "cimagf : %f\n", f1);
-
- cc = clogf (ca);
- fprintf (stdout, "clogf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = conjf (ca);
- fprintf (stdout, "conjf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = cpowf (ca, cb);
- fprintf (stdout, "cpowf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = cprojf (ca);
- fprintf (stdout, "cprojf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- f1 = crealf (ca);
- fprintf (stdout, "crealf : %f\n", f1);
-
- cc = csinf (ca);
- fprintf (stdout, "csinf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = csinhf (ca);
- fprintf (stdout, "csinhf : %f %fi\n", crealf (cc),
- cimagf (cc));
-
- cc = csqrtf (ca);
- fprintf (stdout, "csqrtf : %f %fi\n", crealf (cc),
- cimagf (cc));
+#ifdef NO_FLOAT
+ #define PROVIDE_EMPTY_FUNC
+#endif
- cc = ctanf (ca);
- fprintf (stdout, "ctanf : %f %fi\n", crealf (cc),
- cimagf (cc));
+#define SUFFIX f
+#define FTYPE float
+#define PRI "%f"
- cc = ctanhf (ca);
- fprintf (stdout, "ctanhf : %f %fi\n", crealf (cc),
- cimagf (cc));
-#endif
-}
+#include "docomplex.h"
diff --git a/testsuites/libtests/complex/docomplexl.c b/testsuites/libtests/complex/docomplexl.c
index f63d00ad30..87817c7773 100644
--- a/testsuites/libtests/complex/docomplexl.c
+++ b/testsuites/libtests/complex/docomplexl.c
@@ -11,106 +11,15 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+ #include "config.h"
#endif
-#include <complex.h>
-#include <stdio.h>
-
-extern void docomplexl (void);
-
-void
-docomplexl (void)
-{
-#ifndef NO_LONG_DOUBLE
- complex long double ca, cb, cc;
- long double f1;
-
- ca = 1.0 + 1.0 * I;
- cb = 1.0 - 1.0 * I;
-
- f1 = cabsl (ca);
- fprintf (stdout, "cabsl : %Lf\n", f1);
-
- cc = cacosl (ca);
- fprintf (stdout, "cacosl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = cacoshl (ca);
- fprintf (stdout, "cacoshl: %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- f1 = cargl (ca);
- fprintf (stdout, "cargl : %Lf\n", f1);
-
- cc = casinl (ca);
- fprintf (stdout, "casinl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = casinhl (ca);
- fprintf (stdout, "casinhl: %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = catanl (ca);
- fprintf (stdout, "catanl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = catanhl (ca);
- fprintf (stdout, "catanhl: %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = ccosl (ca);
- fprintf (stdout, "ccosl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = ccoshl (ca);
- fprintf (stdout, "ccoshl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = cexpl (ca);
- fprintf (stdout, "cexpl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- f1 = cimagl (ca);
- fprintf (stdout, "cimagl : %Lf\n", f1);
-
- cc = clogl (ca);
- fprintf (stdout, "clogl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = conjl (ca);
- fprintf (stdout, "conjl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = cpowl (ca, cb);
- fprintf (stdout, "cpowl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = cprojl (ca);
- fprintf (stdout, "cprojl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- f1 = creall (ca);
- fprintf (stdout, "creall : %Lf\n", f1);
-
- cc = csinl (ca);
- fprintf (stdout, "csinl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = csinhl (ca);
- fprintf (stdout, "csinhl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-
- cc = csqrtl (ca);
- fprintf (stdout, "csqrtl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
+#ifdef NO_LONG_DOUBLE
+ #define PROVIDE_EMPTY_FUNC
+#endif
- cc = ctanl (ca);
- fprintf (stdout, "ctanl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
+#define SUFFIX l
+#define FTYPE long double
+#define PRI "%Lf"
- cc = ctanhl (ca);
- fprintf (stdout, "ctanhl : %Lf %Lfi\n", creall (cc),
- cimagl (cc));
-#endif
-}
+#include "docomplex.h"
diff --git a/testsuites/libtests/complex/init.c b/testsuites/libtests/complex/init.c
index 82554f4816..2f3c800506 100644
--- a/testsuites/libtests/complex/init.c
+++ b/testsuites/libtests/complex/init.c
@@ -31,9 +31,7 @@
extern void docomplex(void);
extern void docomplexf(void);
-#ifndef NO_LONG_DOUBLE
extern void docomplexl(void);
-#endif
#if __rtems__
/* NOTICE: the clock driver is explicitly disabled */
@@ -60,9 +58,7 @@ int main( void )
docomplex();
docomplexf();
-#ifndef NO_LONG_DOUBLE
docomplexl();
-#endif
fprintf( stdout, "*** END OF COMPLEX MATH TEST ***\n" );
exit( 0 );
}
diff --git a/testsuites/libtests/math/Makefile.am b/testsuites/libtests/math/Makefile.am
index 5a8a010810..835bd931a5 100644
--- a/testsuites/libtests/math/Makefile.am
+++ b/testsuites/libtests/math/Makefile.am
@@ -1,12 +1,5 @@
rtems_tests_PROGRAMS = math
math_SOURCES = init.c domath.c
-EXTRA_DIST = $(srcdir)/../math/domath.in
-
-$(srcdir)/domath.c: $(srcdir)/../math/domath.in
- sed -e 's,[@]FTYPE[@],double,' \
- -e 's,[@]FSUFFIX[@], ,g' \
- -e 's,[@]FGUARD[@],NO_DOUBLE,' \
- $(srcdir)/../math/domath.in > $(srcdir)/domath.c
dist_rtems_tests_DATA = math.scn
@@ -14,6 +7,7 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
+math_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/math
math_LDADD = -lm
LINK_OBJS = $(math_OBJECTS) $(math_LDADD)
diff --git a/testsuites/libtests/math/domath.c b/testsuites/libtests/math/domath.c
index cc145142f3..3485fb210c 100644
--- a/testsuites/libtests/math/domath.c
+++ b/testsuites/libtests/math/domath.c
@@ -11,277 +11,14 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+ #include "config.h"
#endif
-#include <math.h>
-#include <stdio.h>
-
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
-#endif
-
-#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
+#ifdef NO_DOUBLE
+ #define PROVIDE_EMPTY_FUNC
#endif
-extern void domath (void);
-
-void
-domath (void)
-{
-#ifndef NO_DOUBLE
- double f1;
- double f2;
-
- int i1;
-
- f1 = acos (0.0);
- fprintf( stdout, "acos : %f\n", f1);
-
- f1 = acosh (0.0);
- fprintf( stdout, "acosh : %f\n", f1);
-
- f1 = asin (1.0);
- fprintf( stdout, "asin : %f\n", f1);
-
- f1 = asinh (1.0);
- fprintf( stdout, "asinh : %f\n", f1);
-
- f1 = atan (M_PI_4);
- fprintf( stdout, "atan : %f\n", f1);
-
- f1 = atan2 (2.3, 2.3);
- fprintf( stdout, "atan2 : %f\n", f1);
-
- f1 = atanh (1.0);
- fprintf( stdout, "atanh : %f\n", f1);
-
- f1 = cbrt (27.0);
- fprintf( stdout, "cbrt : %f\n", f1);
-
- f1 = ceil (3.5);
- fprintf( stdout, "ceil : %f\n", f1);
-
- f1 = copysign (3.5, -2.5);
- fprintf( stdout, "copysign : %f\n", f1);
-
- f1 = cos (M_PI_2);
- fprintf( stdout, "cos : %f\n", f1);
-
- f1 = cosh (M_PI_2);
- fprintf( stdout, "cosh : %f\n", f1);
-
- f1 = erf (42.0);
- fprintf( stdout, "erf : %f\n", f1);
-
- f1 = erfc (42.0);
- fprintf( stdout, "erfc : %f\n", f1);
-
- f1 = exp (0.42);
- fprintf( stdout, "exp : %f\n", f1);
-
- f1 = exp2 (0.42);
- fprintf( stdout, "exp2 : %f\n", f1);
-
- f1 = expm1 (0.00042);
- fprintf( stdout, "expm1 : %f\n", f1);
-
- f1 = fabs (-1.123);
- fprintf( stdout, "fabs : %f\n", f1);
-
- f1 = fdim (1.123, 2.123);
- fprintf( stdout, "fdim : %f\n", f1);
-
- f1 = floor (0.5);
- fprintf( stdout, "floor : %f\n", f1);
- f1 = floor (-0.5);
- fprintf( stdout, "floor : %f\n", f1);
-
- f1 = fma (2.1, 2.2, 3.01);
- fprintf( stdout, "fma : %f\n", f1);
-
- f1 = fmax (-0.42, 0.42);
- fprintf( stdout, "fmax : %f\n", f1);
-
- f1 = fmin (-0.42, 0.42);
- fprintf( stdout, "fmin : %f\n", f1);
-
- f1 = fmod (42.0, 3.0);
- fprintf( stdout, "fmod : %f\n", f1);
-
- /* no type-specific variant */
- i1 = fpclassify(1.0);
- fprintf( stdout, "fpclassify : %d\n", i1);
-
- f1 = frexp (42.0, &i1);
- fprintf( stdout, "frexp : %f\n", f1);
-
- f1 = hypot (42.0, 42.0);
- fprintf( stdout, "hypot : %f\n", f1);
-
- i1 = ilogb (42.0);
- fprintf( stdout, "ilogb : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isfinite(3.0);
- fprintf( stdout, "isfinite : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isgreater(3.0, 3.1);
- fprintf( stdout, "isgreater : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isgreaterequal(3.0, 3.1);
- fprintf( stdout, "isgreaterequal : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isinf(3.0);
- fprintf( stdout, "isinf : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isless(3.0, 3.1);
- fprintf( stdout, "isless : %d\n", i1);
-
- /* no type-specific variant */
- i1 = islessequal(3.0, 3.1);
- fprintf( stdout, "islessequal : %d\n", i1);
-
- /* no type-specific variant */
- i1 = islessgreater(3.0, 3.1);
- fprintf( stdout, "islessgreater : %d\n", i1);
+#define FTYPE double
+#define PRI "%f"
- /* no type-specific variant */
- i1 = isnan(0.0);
- fprintf( stdout, "isnan : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isnormal(3.0);
- fprintf( stdout, "isnormal : %d\n", i1);
-
- /* no type-specific variant */
- f1 = isunordered(1.0, 2.0);
- fprintf( stdout, "isunordered : %d\n", i1);
-
- f1 = j0 (1.2);
- fprintf( stdout, "j0 : %f\n", f1);
-
- f1 = j1 (1.2);
- fprintf( stdout, "j1 : %f\n", f1);
-
- f1 = jn (2,1.2);
- fprintf( stdout, "jn : %f\n", f1);
-
- f1 = ldexp (1.2,3);
- fprintf( stdout, "ldexp : %f\n", f1);
-
- f1 = lgamma (42.0);
- fprintf( stdout, "lgamma : %f\n", f1);
-
- f1 = llrint (-0.5);
- fprintf( stdout, "llrint : %f\n", f1);
- f1 = llrint (0.5);
- fprintf( stdout, "llrint : %f\n", f1);
-
- f1 = llround (-0.5);
- fprintf( stdout, "lround : %f\n", f1);
- f1 = llround (0.5);
- fprintf( stdout, "lround : %f\n", f1);
-
- f1 = log (42.0);
- fprintf( stdout, "log : %f\n", f1);
-
- f1 = log10 (42.0);
- fprintf( stdout, "log10 : %f\n", f1);
-
- f1 = log1p (42.0);
- fprintf( stdout, "log1p : %f\n", f1);
-
- f1 = log2 (42.0);
- fprintf( stdout, "log2 : %f\n", f1);
-
- f1 = logb (42.0);
- fprintf( stdout, "logb : %f\n", f1);
-
- f1 = lrint (-0.5);
- fprintf( stdout, "lrint : %f\n", f1);
- f1 = lrint (0.5);
- fprintf( stdout, "lrint : %f\n", f1);
-
- f1 = lround (-0.5);
- fprintf( stdout, "lround : %f\n", f1);
- f1 = lround (0.5);
- fprintf( stdout, "lround : %f\n", f1);
-
- f1 = modf (42.0,&f2);
- fprintf( stdout, "lmodf : %f\n", f1);
-
- f1 = nan ("");
- fprintf( stdout, "nan : %f\n", f1);
-
- f1 = nearbyint (1.5);
- fprintf( stdout, "nearbyint : %f\n", f1);
-
- f1 = nextafter (1.5,2.0);
- fprintf( stdout, "nextafter : %f\n", f1);
-
- f1 = pow (3.01, 2.0);
- fprintf( stdout, "pow : %f\n", f1);
-
- f1 = remainder (3.01,2.0);
- fprintf( stdout, "remainder : %f\n", f1);
-
- f1 = remquo (29.0,3.0,&i1);
- fprintf( stdout, "remquo : %f\n", f1);
-
- f1 = rint (0.5);
- fprintf( stdout, "rint : %f\n", f1);
- f1 = rint (-0.5);
- fprintf( stdout, "rint : %f\n", f1);
-
- f1 = round (0.5);
- fprintf( stdout, "round : %f\n", f1);
- f1 = round (-0.5);
- fprintf( stdout, "round : %f\n", f1);
-
- f1 = scalbln (1.2,3);
- fprintf( stdout, "scalbln : %f\n", f1);
-
- f1 = scalbn (1.2,3);
- fprintf( stdout, "scalbn : %f\n", f1);
-
- /* no type-specific variant */
- i1 = signbit(1.0);
- fprintf( stdout, "signbit : %i\n", i1);
-
- f1 = sin (M_PI_4);
- fprintf( stdout, "sin : %f\n", f1);
-
- f1 = sinh (M_PI_4);
- fprintf( stdout, "sinh : %f\n", f1);
-
- f1 = sqrt (9.0);
- fprintf( stdout, "sqrt : %f\n", f1);
-
- f1 = tan (M_PI_4);
- fprintf( stdout, "tan : %f\n", f1);
-
- f1 = tanh (M_PI_4);
- fprintf( stdout, "tanh : %f\n", f1);
-
- f1 = tgamma (2.1);
- fprintf( stdout, "tgamma : %f\n", f1);
-
- f1 = trunc (3.5);
- fprintf( stdout, "trunc : %f\n", f1);
-
- f1 = y0 (1.2);
- fprintf( stdout, "y0 : %f\n", f1);
-
- f1 = y1 (1.2);
- fprintf( stdout, "y1 : %f\n", f1);
-
- f1 = yn (3,1.2);
- fprintf( stdout, "yn : %f\n", f1);
-#endif
-}
+#include <domath.h>
diff --git a/testsuites/libtests/math/domath.h b/testsuites/libtests/math/domath.h
new file mode 100644
index 0000000000..4915577d57
--- /dev/null
+++ b/testsuites/libtests/math/domath.h
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2010, 2011 by
+ * Ralf Corsepius, Ulm/Germany. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#include <math.h>
+#include <stdio.h>
+
+#ifndef M_PI_2
+#define M_PI_2 1.57079632679489661923
+#endif
+
+#ifndef M_PI_4
+#define M_PI_4 0.78539816339744830962
+#endif
+
+#define CONCAT(x, y) x ## y
+#define XCONCAT(x, y) CONCAT(x, y)
+
+#define STRINGIFY(x, y) # x # y
+#define XSTRINGIFY(x, y) STRINGIFY(x, y)
+
+#ifdef SUFFIX
+ #define FUNC(name) XCONCAT(name, SUFFIX)
+ #define STR(name) XSTRINGIFY(name, SUFFIX)
+#else
+ #define FUNC(name) XCONCAT(name, )
+ #define STR(name) XSTRINGIFY(name, ) " "
+#endif
+
+extern void FUNC(domath) (void);
+
+void
+FUNC(domath) (void)
+{
+#ifndef PROVIDE_EMPTY_FUNC
+ FTYPE f1;
+ FTYPE f2;
+
+ int i1;
+
+ f1 = FUNC(acos) (0.0);
+ fprintf( stdout, STR(acos) " : " PRI "\n", f1);
+
+ f1 = FUNC(acosh) (0.0);
+ fprintf( stdout, STR(acosh) " : " PRI "\n", f1);
+
+ f1 = FUNC(asin) (1.0);
+ fprintf( stdout, STR(asin) " : " PRI "\n", f1);
+
+ f1 = FUNC(asinh) (1.0);
+ fprintf( stdout, STR(asinh) " : " PRI "\n", f1);
+
+ f1 = FUNC(atan) (M_PI_4);
+ fprintf( stdout, STR(atan) " : " PRI "\n", f1);
+
+ f1 = FUNC(atan2) (2.3, 2.3);
+ fprintf( stdout, STR(atan2) " : " PRI "\n", f1);
+
+ f1 = FUNC(atanh) (1.0);
+ fprintf( stdout, STR(atanh) " : " PRI "\n", f1);
+
+ f1 = FUNC(cbrt) (27.0);
+ fprintf( stdout, STR(cbrt) " : " PRI "\n", f1);
+
+ f1 = FUNC(ceil) (3.5);
+ fprintf( stdout, STR(ceil) " : " PRI "\n", f1);
+
+ f1 = FUNC(copysign) (3.5, -2.5);
+ fprintf( stdout, STR(copysign) " : " PRI "\n", f1);
+
+ f1 = FUNC(cos) (M_PI_2);
+ fprintf( stdout, STR(cos) " : " PRI "\n", f1);
+
+ f1 = FUNC(cosh) (M_PI_2);
+ fprintf( stdout, STR(cosh) " : " PRI "\n", f1);
+
+ f1 = FUNC(erf) (42.0);
+ fprintf( stdout, STR(erf) " : " PRI "\n", f1);
+
+ f1 = FUNC(erfc) (42.0);
+ fprintf( stdout, STR(erfc) " : " PRI "\n", f1);
+
+ f1 = FUNC(exp) (0.42);
+ fprintf( stdout, STR(exp) " : " PRI "\n", f1);
+
+ f1 = FUNC(exp2) (0.42);
+ fprintf( stdout, STR(exp2) " : " PRI "\n", f1);
+
+ f1 = FUNC(expm1) (0.00042);
+ fprintf( stdout, STR(expm1) " : " PRI "\n", f1);
+
+ f1 = FUNC(fabs) (-1.123);
+ fprintf( stdout, STR(fabs) " : " PRI "\n", f1);
+
+ f1 = FUNC(fdim) (1.123, 2.123);
+ fprintf( stdout, STR(fdim) " : " PRI "\n", f1);
+
+ f1 = FUNC(floor) (0.5);
+ fprintf( stdout, STR(floor) " : " PRI "\n", f1);
+ f1 = FUNC(floor) (-0.5);
+ fprintf( stdout, STR(floor) " : " PRI "\n", f1);
+
+ f1 = FUNC(fma) (2.1, 2.2, 3.01);
+ fprintf( stdout, STR(fma) " : " PRI "\n", f1);
+
+ f1 = FUNC(fmax) (-0.42, 0.42);
+ fprintf( stdout, STR(fmax) " : " PRI "\n", f1);
+
+ f1 = FUNC(fmin) (-0.42, 0.42);
+ fprintf( stdout, STR(fmin) " : " PRI "\n", f1);
+
+ f1 = FUNC(fmod) (42.0, 3.0);
+ fprintf( stdout, STR(fmod) " : " PRI "\n", f1);
+
+ /* no type-specific variant */
+ i1 = fpclassify(1.0);
+ fprintf( stdout, "fpclassify : %d\n", i1);
+
+ f1 = FUNC(frexp) (42.0, &i1);
+ fprintf( stdout, STR(frexp) " : " PRI "\n", f1);
+
+ f1 = FUNC(hypot) (42.0, 42.0);
+ fprintf( stdout, STR(hypot) " : " PRI "\n", f1);
+
+ i1 = FUNC(ilogb) (42.0);
+ fprintf( stdout, STR(ilogb) " : %d\n", i1);
+
+ /* no type-specific variant */
+ i1 = isfinite(3.0);
+ fprintf( stdout, "isfinite : %d\n", i1);
+
+ /* no type-specific variant */
+ i1 = isgreater(3.0, 3.1);
+ fprintf( stdout, "isgreater : %d\n", i1);
+
+ /* no type-specific variant */
+ i1 = isgreaterequal(3.0, 3.1);
+ fprintf( stdout, "isgreaterequal : %d\n", i1);
+
+ /* no type-specific variant */
+ i1 = isinf(3.0);
+ fprintf( stdout, "isinf : %d\n", i1);
+
+ /* no type-specific variant */
+ i1 = isless(3.0, 3.1);
+ fprintf( stdout, "isless : %d\n", i1);
+
+ /* no type-specific variant */
+ i1 = islessequal(3.0, 3.1);
+ fprintf( stdout, "islessequal : %d\n", i1);
+
+ /* no type-specific variant */
+ i1 = islessgreater(3.0, 3.1);
+ fprintf( stdout, "islessgreater : %d\n", i1);
+
+ /* no type-specific variant */
+ i1 = isnan(0.0);
+ fprintf( stdout, "isnan : %d\n", i1);
+
+ /* no type-specific variant */
+ i1 = isnormal(3.0);
+ fprintf( stdout, "isnormal : %d\n", i1);
+
+ /* no type-specific variant */
+ f1 = isunordered(1.0, 2.0);
+ fprintf( stdout, "isunordered : %d\n", i1);
+
+ f1 = FUNC(j0) (1.2);
+ fprintf( stdout, STR(j0) " : " PRI "\n", f1);
+
+ f1 = FUNC(j1) (1.2);
+ fprintf( stdout, STR(j1) " : " PRI "\n", f1);
+
+ f1 = FUNC(jn) (2,1.2);
+ fprintf( stdout, STR(jn) " : " PRI "\n", f1);
+
+ f1 = FUNC(ldexp) (1.2,3);
+ fprintf( stdout, STR(ldexp) " : " PRI "\n", f1);
+
+ f1 = FUNC(lgamma) (42.0);
+ fprintf( stdout, STR(lgamma) " : " PRI "\n", f1);
+
+ f1 = FUNC(llrint) (-0.5);
+ fprintf( stdout, STR(llrint) " : " PRI "\n", f1);
+ f1 = FUNC(llrint) (0.5);
+ fprintf( stdout, STR(llrint) " : " PRI "\n", f1);
+
+ f1 = FUNC(llround) (-0.5);
+ fprintf( stdout, STR(lround) " : " PRI "\n", f1);
+ f1 = FUNC(llround) (0.5);
+ fprintf( stdout, STR(lround) " : " PRI "\n", f1);
+
+ f1 = FUNC(log) (42.0);
+ fprintf( stdout, STR(log) " : " PRI "\n", f1);
+
+ f1 = FUNC(log10) (42.0);
+ fprintf( stdout, STR(log10) " : " PRI "\n", f1);
+
+ f1 = FUNC(log1p) (42.0);
+ fprintf( stdout, STR(log1p) " : " PRI "\n", f1);
+
+ f1 = FUNC(log2) (42.0);
+ fprintf( stdout, STR(log2) " : " PRI "\n", f1);
+
+ f1 = FUNC(logb) (42.0);
+ fprintf( stdout, STR(logb) " : " PRI "\n", f1);
+
+ f1 = FUNC(lrint) (-0.5);
+ fprintf( stdout, STR(lrint) " : " PRI "\n", f1);
+ f1 = FUNC(lrint) (0.5);
+ fprintf( stdout, STR(lrint) " : " PRI "\n", f1);
+
+ f1 = FUNC(lround) (-0.5);
+ fprintf( stdout, STR(lround) " : " PRI "\n", f1);
+ f1 = FUNC(lround) (0.5);
+ fprintf( stdout, STR(lround) " : " PRI "\n", f1);
+
+ f1 = FUNC(modf) (42.0,&f2);
+ fprintf( stdout, STR(lmodf) " : " PRI "\n", f1);
+
+ f1 = FUNC(nan) ("");
+ fprintf( stdout, STR(nan) " : " PRI "\n", f1);
+
+ f1 = FUNC(nearbyint) (1.5);
+ fprintf( stdout, STR(nearbyint) " : " PRI "\n", f1);
+
+ f1 = FUNC(nextafter) (1.5,2.0);
+ fprintf( stdout, STR(nextafter) " : " PRI "\n", f1);
+
+ f1 = FUNC(pow) (3.01, 2.0);
+ fprintf( stdout, STR(pow) " : " PRI "\n", f1);
+
+ f1 = FUNC(remainder) (3.01,2.0);
+ fprintf( stdout, STR(remainder) " : " PRI "\n", f1);
+
+ f1 = FUNC(remquo) (29.0,3.0,&i1);
+ fprintf( stdout, STR(remquo) " : " PRI "\n", f1);
+
+ f1 = FUNC(rint) (0.5);
+ fprintf( stdout, STR(rint) " : " PRI "\n", f1);
+ f1 = FUNC(rint) (-0.5);
+ fprintf( stdout, STR(rint) " : " PRI "\n", f1);
+
+ f1 = FUNC(round) (0.5);
+ fprintf( stdout, STR(round) " : " PRI "\n", f1);
+ f1 = FUNC(round) (-0.5);
+ fprintf( stdout, STR(round) " : " PRI "\n", f1);
+
+ f1 = FUNC(scalbln) (1.2,3);
+ fprintf( stdout, STR(scalbln) " : " PRI "\n", f1);
+
+ f1 = FUNC(scalbn) (1.2,3);
+ fprintf( stdout, STR(scalbn) " : " PRI "\n", f1);
+
+ /* no type-specific variant */
+ i1 = signbit(1.0);
+ fprintf( stdout, "signbit : %i\n", i1);
+
+ f1 = FUNC(sin) (M_PI_4);
+ fprintf( stdout, STR(sin) " : " PRI "\n", f1);
+
+ f1 = FUNC(sinh) (M_PI_4);
+ fprintf( stdout, STR(sinh) " : " PRI "\n", f1);
+
+ f1 = FUNC(sqrt) (9.0);
+ fprintf( stdout, STR(sqrt) " : " PRI "\n", f1);
+
+ f1 = FUNC(tan) (M_PI_4);
+ fprintf( stdout, STR(tan) " : " PRI "\n", f1);
+
+ f1 = FUNC(tanh) (M_PI_4);
+ fprintf( stdout, STR(tanh) " : " PRI "\n", f1);
+
+ f1 = FUNC(tgamma) (2.1);
+ fprintf( stdout, STR(tgamma) " : " PRI "\n", f1);
+
+ f1 = FUNC(trunc) (3.5);
+ fprintf( stdout, STR(trunc) " : " PRI "\n", f1);
+
+ f1 = FUNC(y0) (1.2);
+ fprintf( stdout, STR(y0) " : " PRI "\n", f1);
+
+ f1 = FUNC(y1) (1.2);
+ fprintf( stdout, STR(y1) " : " PRI "\n", f1);
+
+ f1 = FUNC(yn) (3,1.2);
+ fprintf( stdout, STR(yn) " : " PRI "\n", f1);
+#endif
+}
diff --git a/testsuites/libtests/math/domath.in b/testsuites/libtests/math/domath.in
deleted file mode 100644
index 92bafff276..0000000000
--- a/testsuites/libtests/math/domath.in
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright (c) 2010, 2011 by
- * Ralf Corsepius, Ulm/Germany. All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-/*
- * Try to compile and link against POSIX math routines.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include <stdio.h>
-
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
-#endif
-
-#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
-#endif
-
-extern void domath@FSUFFIX@ (void);
-
-void
-domath@FSUFFIX@ (void)
-{
-#ifndef @FGUARD@
- @FTYPE@ f1;
- @FTYPE@ f2;
-
- int i1;
-
- f1 = acos@FSUFFIX@(0.0);
- fprintf( stdout, "acos@FSUFFIX@ : %f\n", f1);
-
- f1 = acosh@FSUFFIX@(0.0);
- fprintf( stdout, "acosh@FSUFFIX@ : %f\n", f1);
-
- f1 = asin@FSUFFIX@(1.0);
- fprintf( stdout, "asin@FSUFFIX@ : %f\n", f1);
-
- f1 = asinh@FSUFFIX@(1.0);
- fprintf( stdout, "asinh@FSUFFIX@ : %f\n", f1);
-
- f1 = atan@FSUFFIX@(M_PI_4);
- fprintf( stdout, "atan@FSUFFIX@ : %f\n", f1);
-
- f1 = atan2@FSUFFIX@(2.3, 2.3);
- fprintf( stdout, "atan2@FSUFFIX@ : %f\n", f1);
-
- f1 = atanh@FSUFFIX@(1.0);
- fprintf( stdout, "atanh@FSUFFIX@ : %f\n", f1);
-
- f1 = cbrt@FSUFFIX@(27.0);
- fprintf( stdout, "cbrt@FSUFFIX@ : %f\n", f1);
-
- f1 = ceil@FSUFFIX@(3.5);
- fprintf( stdout, "ceil@FSUFFIX@ : %f\n", f1);
-
- f1 = copysign@FSUFFIX@(3.5, -2.5);
- fprintf( stdout, "copysign@FSUFFIX@ : %f\n", f1);
-
- f1 = cos@FSUFFIX@(M_PI_2);
- fprintf( stdout, "cos@FSUFFIX@ : %f\n", f1);
-
- f1 = cosh@FSUFFIX@(M_PI_2);
- fprintf( stdout, "cosh@FSUFFIX@ : %f\n", f1);
-
- f1 = erf@FSUFFIX@(42.0);
- fprintf( stdout, "erf@FSUFFIX@ : %f\n", f1);
-
- f1 = erfc@FSUFFIX@(42.0);
- fprintf( stdout, "erfc@FSUFFIX@ : %f\n", f1);
-
- f1 = exp@FSUFFIX@(0.42);
- fprintf( stdout, "exp@FSUFFIX@ : %f\n", f1);
-
- f1 = exp2@FSUFFIX@(0.42);
- fprintf( stdout, "exp2@FSUFFIX@ : %f\n", f1);
-
- f1 = expm1@FSUFFIX@(0.00042);
- fprintf( stdout, "expm1@FSUFFIX@ : %f\n", f1);
-
- f1 = fabs@FSUFFIX@(-1.123);
- fprintf( stdout, "fabs@FSUFFIX@ : %f\n", f1);
-
- f1 = fdim@FSUFFIX@(1.123, 2.123);
- fprintf( stdout, "fdim@FSUFFIX@ : %f\n", f1);
-
- f1 = floor@FSUFFIX@(0.5);
- fprintf( stdout, "floor@FSUFFIX@ : %f\n", f1);
- f1 = floor@FSUFFIX@(-0.5);
- fprintf( stdout, "floor@FSUFFIX@ : %f\n", f1);
-
- f1 = fma@FSUFFIX@(2.1, 2.2, 3.01);
- fprintf( stdout, "fma@FSUFFIX@ : %f\n", f1);
-
- f1 = fmax@FSUFFIX@(-0.42, 0.42);
- fprintf( stdout, "fmax@FSUFFIX@ : %f\n", f1);
-
- f1 = fmin@FSUFFIX@(-0.42, 0.42);
- fprintf( stdout, "fmin@FSUFFIX@ : %f\n", f1);
-
- f1 = fmod@FSUFFIX@(42.0, 3.0);
- fprintf( stdout, "fmod@FSUFFIX@ : %f\n", f1);
-
- /* no type-specific variant */
- i1 = fpclassify(1.0);
- fprintf( stdout, "fpclassify : %d\n", i1);
-
- f1 = frexp@FSUFFIX@(42.0, &i1);
- fprintf( stdout, "frexp@FSUFFIX@ : %f\n", f1);
-
- f1 = hypot@FSUFFIX@(42.0, 42.0);
- fprintf( stdout, "hypot@FSUFFIX@ : %f\n", f1);
-
- i1 = ilogb@FSUFFIX@(42.0);
- fprintf( stdout, "ilogb@FSUFFIX@ : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isfinite(3.0);
- fprintf( stdout, "isfinite : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isgreater(3.0, 3.1);
- fprintf( stdout, "isgreater : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isgreaterequal(3.0, 3.1);
- fprintf( stdout, "isgreaterequal : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isinf(3.0);
- fprintf( stdout, "isinf : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isless(3.0, 3.1);
- fprintf( stdout, "isless : %d\n", i1);
-
- /* no type-specific variant */
- i1 = islessequal(3.0, 3.1);
- fprintf( stdout, "islessequal : %d\n", i1);
-
- /* no type-specific variant */
- i1 = islessgreater(3.0, 3.1);
- fprintf( stdout, "islessgreater : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isnan(0.0);
- fprintf( stdout, "isnan : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isnormal(3.0);
- fprintf( stdout, "isnormal : %d\n", i1);
-
- /* no type-specific variant */
- f1 = isunordered(1.0, 2.0);
- fprintf( stdout, "isunordered : %d\n", i1);
-
- f1 = j0@FSUFFIX@(1.2);
- fprintf( stdout, "j0@FSUFFIX@ : %f\n", f1);
-
- f1 = j1@FSUFFIX@(1.2);
- fprintf( stdout, "j1@FSUFFIX@ : %f\n", f1);
-
- f1 = jn@FSUFFIX@(2,1.2);
- fprintf( stdout, "jn@FSUFFIX@ : %f\n", f1);
-
- f1 = ldexp@FSUFFIX@(1.2,3);
- fprintf( stdout, "ldexp@FSUFFIX@ : %f\n", f1);
-
- f1 = lgamma@FSUFFIX@(42.0);
- fprintf( stdout, "lgamma@FSUFFIX@ : %f\n", f1);
-
- f1 = llrint@FSUFFIX@(-0.5);
- fprintf( stdout, "llrint@FSUFFIX@ : %f\n", f1);
- f1 = llrint@FSUFFIX@(0.5);
- fprintf( stdout, "llrint@FSUFFIX@ : %f\n", f1);
-
- f1 = llround@FSUFFIX@(-0.5);
- fprintf( stdout, "lround@FSUFFIX@ : %f\n", f1);
- f1 = llround@FSUFFIX@(0.5);
- fprintf( stdout, "lround@FSUFFIX@ : %f\n", f1);
-
- f1 = log@FSUFFIX@(42.0);
- fprintf( stdout, "log@FSUFFIX@ : %f\n", f1);
-
- f1 = log10@FSUFFIX@(42.0);
- fprintf( stdout, "log10@FSUFFIX@ : %f\n", f1);
-
- f1 = log1p@FSUFFIX@(42.0);
- fprintf( stdout, "log1p@FSUFFIX@ : %f\n", f1);
-
- f1 = log2@FSUFFIX@(42.0);
- fprintf( stdout, "log2@FSUFFIX@ : %f\n", f1);
-
- f1 = logb@FSUFFIX@(42.0);
- fprintf( stdout, "logb@FSUFFIX@ : %f\n", f1);
-
- f1 = lrint@FSUFFIX@(-0.5);
- fprintf( stdout, "lrint@FSUFFIX@ : %f\n", f1);
- f1 = lrint@FSUFFIX@(0.5);
- fprintf( stdout, "lrint@FSUFFIX@ : %f\n", f1);
-
- f1 = lround@FSUFFIX@(-0.5);
- fprintf( stdout, "lround@FSUFFIX@ : %f\n", f1);
- f1 = lround@FSUFFIX@(0.5);
- fprintf( stdout, "lround@FSUFFIX@ : %f\n", f1);
-
- f1 = modf@FSUFFIX@(42.0,&f2);
- fprintf( stdout, "lmodf@FSUFFIX@ : %f\n", f1);
-
- f1 = nan@FSUFFIX@("");
- fprintf( stdout, "nan@FSUFFIX@ : %f\n", f1);
-
- f1 = nearbyint@FSUFFIX@(1.5);
- fprintf( stdout, "nearbyint@FSUFFIX@ : %f\n", f1);
-
- f1 = nextafter@FSUFFIX@(1.5,2.0);
- fprintf( stdout, "nextafter@FSUFFIX@ : %f\n", f1);
-
- f1 = pow@FSUFFIX@(3.01, 2.0);
- fprintf( stdout, "pow@FSUFFIX@ : %f\n", f1);
-
- f1 = remainder@FSUFFIX@(3.01,2.0);
- fprintf( stdout, "remainder@FSUFFIX@ : %f\n", f1);
-
- f1 = remquo@FSUFFIX@(29.0,3.0,&i1);
- fprintf( stdout, "remquo@FSUFFIX@ : %f\n", f1);
-
- f1 = rint@FSUFFIX@(0.5);
- fprintf( stdout, "rint@FSUFFIX@ : %f\n", f1);
- f1 = rint@FSUFFIX@(-0.5);
- fprintf( stdout, "rint@FSUFFIX@ : %f\n", f1);
-
- f1 = round@FSUFFIX@(0.5);
- fprintf( stdout, "round@FSUFFIX@ : %f\n", f1);
- f1 = round@FSUFFIX@(-0.5);
- fprintf( stdout, "round@FSUFFIX@ : %f\n", f1);
-
- f1 = scalbln@FSUFFIX@(1.2,3);
- fprintf( stdout, "scalbln@FSUFFIX@ : %f\n", f1);
-
- f1 = scalbn@FSUFFIX@(1.2,3);
- fprintf( stdout, "scalbn@FSUFFIX@ : %f\n", f1);
-
- /* no type-specific variant */
- i1 = signbit(1.0);
- fprintf( stdout, "signbit : %i\n", i1);
-
- f1 = sin@FSUFFIX@(M_PI_4);
- fprintf( stdout, "sin@FSUFFIX@ : %f\n", f1);
-
- f1 = sinh@FSUFFIX@(M_PI_4);
- fprintf( stdout, "sinh@FSUFFIX@ : %f\n", f1);
-
- f1 = sqrt@FSUFFIX@(9.0);
- fprintf( stdout, "sqrt@FSUFFIX@ : %f\n", f1);
-
- f1 = tan@FSUFFIX@(M_PI_4);
- fprintf( stdout, "tan@FSUFFIX@ : %f\n", f1);
-
- f1 = tanh@FSUFFIX@(M_PI_4);
- fprintf( stdout, "tanh@FSUFFIX@ : %f\n", f1);
-
- f1 = tgamma@FSUFFIX@(2.1);
- fprintf( stdout, "tgamma@FSUFFIX@ : %f\n", f1);
-
- f1 = trunc@FSUFFIX@(3.5);
- fprintf( stdout, "trunc@FSUFFIX@ : %f\n", f1);
-
- f1 = y0@FSUFFIX@(1.2);
- fprintf( stdout, "y0@FSUFFIX@ : %f\n", f1);
-
- f1 = y1@FSUFFIX@(1.2);
- fprintf( stdout, "y1@FSUFFIX@ : %f\n", f1);
-
- f1 = yn@FSUFFIX@(3,1.2);
- fprintf( stdout, "yn@FSUFFIX@ : %f\n", f1);
-#endif
-}
diff --git a/testsuites/libtests/mathf/Makefile.am b/testsuites/libtests/mathf/Makefile.am
index 0834145292..e4bd7ba10c 100644
--- a/testsuites/libtests/mathf/Makefile.am
+++ b/testsuites/libtests/mathf/Makefile.am
@@ -1,12 +1,5 @@
rtems_tests_PROGRAMS = mathf
mathf_SOURCES = init.c domathf.c
-EXTRA_DIST = $(srcdir)/../math/domath.in
-
-$(srcdir)/domathf.c: $(srcdir)/../math/domath.in
- sed -e 's,[@]FTYPE[@],float,' \
- -e 's,[@]FSUFFIX[@],f,g' \
- -e 's,[@]FGUARD[@],NO_FLOAT,' \
- $(srcdir)/../math/domath.in > $(srcdir)/domathf.c
dist_rtems_tests_DATA = mathf.scn
@@ -14,6 +7,7 @@ include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
+mathf_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/math
mathf_LDADD = -lm
LINK_OBJS = $(mathf_OBJECTS) $(mathf_LDADD)
diff --git a/testsuites/libtests/mathf/domathf.c b/testsuites/libtests/mathf/domathf.c
index b5db14d63a..3aece952d7 100644
--- a/testsuites/libtests/mathf/domathf.c
+++ b/testsuites/libtests/mathf/domathf.c
@@ -11,277 +11,15 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+ #include "config.h"
#endif
-#include <math.h>
-#include <stdio.h>
-
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
-#endif
-
-#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
+#ifdef NO_FLOAT
+ #define PROVIDE_EMPTY_FUNC
#endif
-extern void domathf (void);
-
-void
-domathf (void)
-{
-#ifndef NO_FLOAT
- float f1;
- float f2;
-
- int i1;
-
- f1 = acosf(0.0);
- fprintf( stdout, "acosf : %f\n", f1);
-
- f1 = acoshf(0.0);
- fprintf( stdout, "acoshf : %f\n", f1);
-
- f1 = asinf(1.0);
- fprintf( stdout, "asinf : %f\n", f1);
-
- f1 = asinhf(1.0);
- fprintf( stdout, "asinhf : %f\n", f1);
-
- f1 = atanf(M_PI_4);
- fprintf( stdout, "atanf : %f\n", f1);
-
- f1 = atan2f(2.3, 2.3);
- fprintf( stdout, "atan2f : %f\n", f1);
-
- f1 = atanhf(1.0);
- fprintf( stdout, "atanhf : %f\n", f1);
-
- f1 = cbrtf(27.0);
- fprintf( stdout, "cbrtf : %f\n", f1);
-
- f1 = ceilf(3.5);
- fprintf( stdout, "ceilf : %f\n", f1);
-
- f1 = copysignf(3.5, -2.5);
- fprintf( stdout, "copysignf : %f\n", f1);
-
- f1 = cosf(M_PI_2);
- fprintf( stdout, "cosf : %f\n", f1);
-
- f1 = coshf(M_PI_2);
- fprintf( stdout, "coshf : %f\n", f1);
-
- f1 = erff(42.0);
- fprintf( stdout, "erff : %f\n", f1);
-
- f1 = erfcf(42.0);
- fprintf( stdout, "erfcf : %f\n", f1);
-
- f1 = expf(0.42);
- fprintf( stdout, "expf : %f\n", f1);
-
- f1 = exp2f(0.42);
- fprintf( stdout, "exp2f : %f\n", f1);
-
- f1 = expm1f(0.00042);
- fprintf( stdout, "expm1f : %f\n", f1);
-
- f1 = fabsf(-1.123);
- fprintf( stdout, "fabsf : %f\n", f1);
-
- f1 = fdimf(1.123, 2.123);
- fprintf( stdout, "fdimf : %f\n", f1);
-
- f1 = floorf(0.5);
- fprintf( stdout, "floorf : %f\n", f1);
- f1 = floorf(-0.5);
- fprintf( stdout, "floorf : %f\n", f1);
-
- f1 = fmaf(2.1, 2.2, 3.01);
- fprintf( stdout, "fmaf : %f\n", f1);
-
- f1 = fmaxf(-0.42, 0.42);
- fprintf( stdout, "fmaxf : %f\n", f1);
-
- f1 = fminf(-0.42, 0.42);
- fprintf( stdout, "fminf : %f\n", f1);
-
- f1 = fmodf(42.0, 3.0);
- fprintf( stdout, "fmodf : %f\n", f1);
-
- /* no type-specific variant */
- i1 = fpclassify(1.0);
- fprintf( stdout, "fpclassify : %d\n", i1);
-
- f1 = frexpf(42.0, &i1);
- fprintf( stdout, "frexpf : %f\n", f1);
-
- f1 = hypotf(42.0, 42.0);
- fprintf( stdout, "hypotf : %f\n", f1);
-
- i1 = ilogbf(42.0);
- fprintf( stdout, "ilogbf : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isfinite(3.0);
- fprintf( stdout, "isfinite : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isgreater(3.0, 3.1);
- fprintf( stdout, "isgreater : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isgreaterequal(3.0, 3.1);
- fprintf( stdout, "isgreaterequal : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isinf(3.0);
- fprintf( stdout, "isinf : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isless(3.0, 3.1);
- fprintf( stdout, "isless : %d\n", i1);
-
- /* no type-specific variant */
- i1 = islessequal(3.0, 3.1);
- fprintf( stdout, "islessequal : %d\n", i1);
-
- /* no type-specific variant */
- i1 = islessgreater(3.0, 3.1);
- fprintf( stdout, "islessgreater : %d\n", i1);
+#define SUFFIX f
+#define FTYPE float
+#define PRI "%f"
- /* no type-specific variant */
- i1 = isnan(0.0);
- fprintf( stdout, "isnan : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isnormal(3.0);
- fprintf( stdout, "isnormal : %d\n", i1);
-
- /* no type-specific variant */
- f1 = isunordered(1.0, 2.0);
- fprintf( stdout, "isunordered : %d\n", i1);
-
- f1 = j0f(1.2);
- fprintf( stdout, "j0f : %f\n", f1);
-
- f1 = j1f(1.2);
- fprintf( stdout, "j1f : %f\n", f1);
-
- f1 = jnf(2,1.2);
- fprintf( stdout, "jnf : %f\n", f1);
-
- f1 = ldexpf(1.2,3);
- fprintf( stdout, "ldexpf : %f\n", f1);
-
- f1 = lgammaf(42.0);
- fprintf( stdout, "lgammaf : %f\n", f1);
-
- f1 = llrintf(-0.5);
- fprintf( stdout, "llrintf : %f\n", f1);
- f1 = llrintf(0.5);
- fprintf( stdout, "llrintf : %f\n", f1);
-
- f1 = llroundf(-0.5);
- fprintf( stdout, "lroundf : %f\n", f1);
- f1 = llroundf(0.5);
- fprintf( stdout, "lroundf : %f\n", f1);
-
- f1 = logf(42.0);
- fprintf( stdout, "logf : %f\n", f1);
-
- f1 = log10f(42.0);
- fprintf( stdout, "log10f : %f\n", f1);
-
- f1 = log1pf(42.0);
- fprintf( stdout, "log1pf : %f\n", f1);
-
- f1 = log2f(42.0);
- fprintf( stdout, "log2f : %f\n", f1);
-
- f1 = logbf(42.0);
- fprintf( stdout, "logbf : %f\n", f1);
-
- f1 = lrintf(-0.5);
- fprintf( stdout, "lrintf : %f\n", f1);
- f1 = lrintf(0.5);
- fprintf( stdout, "lrintf : %f\n", f1);
-
- f1 = lroundf(-0.5);
- fprintf( stdout, "lroundf : %f\n", f1);
- f1 = lroundf(0.5);
- fprintf( stdout, "lroundf : %f\n", f1);
-
- f1 = modff(42.0,&f2);
- fprintf( stdout, "lmodff : %f\n", f1);
-
- f1 = nanf("");
- fprintf( stdout, "nanf : %f\n", f1);
-
- f1 = nearbyintf(1.5);
- fprintf( stdout, "nearbyintf : %f\n", f1);
-
- f1 = nextafterf(1.5,2.0);
- fprintf( stdout, "nextafterf : %f\n", f1);
-
- f1 = powf(3.01, 2.0);
- fprintf( stdout, "powf : %f\n", f1);
-
- f1 = remainderf(3.01,2.0);
- fprintf( stdout, "remainderf : %f\n", f1);
-
- f1 = remquof(29.0,3.0,&i1);
- fprintf( stdout, "remquof : %f\n", f1);
-
- f1 = rintf(0.5);
- fprintf( stdout, "rintf : %f\n", f1);
- f1 = rintf(-0.5);
- fprintf( stdout, "rintf : %f\n", f1);
-
- f1 = roundf(0.5);
- fprintf( stdout, "roundf : %f\n", f1);
- f1 = roundf(-0.5);
- fprintf( stdout, "roundf : %f\n", f1);
-
- f1 = scalblnf(1.2,3);
- fprintf( stdout, "scalblnf : %f\n", f1);
-
- f1 = scalbnf(1.2,3);
- fprintf( stdout, "scalbnf : %f\n", f1);
-
- /* no type-specific variant */
- i1 = signbit(1.0);
- fprintf( stdout, "signbit : %i\n", i1);
-
- f1 = sinf(M_PI_4);
- fprintf( stdout, "sinf : %f\n", f1);
-
- f1 = sinhf(M_PI_4);
- fprintf( stdout, "sinhf : %f\n", f1);
-
- f1 = sqrtf(9.0);
- fprintf( stdout, "sqrtf : %f\n", f1);
-
- f1 = tanf(M_PI_4);
- fprintf( stdout, "tanf : %f\n", f1);
-
- f1 = tanhf(M_PI_4);
- fprintf( stdout, "tanhf : %f\n", f1);
-
- f1 = tgammaf(2.1);
- fprintf( stdout, "tgammaf : %f\n", f1);
-
- f1 = truncf(3.5);
- fprintf( stdout, "truncf : %f\n", f1);
-
- f1 = y0f(1.2);
- fprintf( stdout, "y0f : %f\n", f1);
-
- f1 = y1f(1.2);
- fprintf( stdout, "y1f : %f\n", f1);
-
- f1 = ynf(3,1.2);
- fprintf( stdout, "ynf : %f\n", f1);
-#endif
-}
+#include <domath.h>
diff --git a/testsuites/libtests/mathl/Makefile.am b/testsuites/libtests/mathl/Makefile.am
index 23d21d65c0..b7a823460c 100644
--- a/testsuites/libtests/mathl/Makefile.am
+++ b/testsuites/libtests/mathl/Makefile.am
@@ -4,14 +4,7 @@ EXTRA_DIST = $(srcdir)/../math/domath.in
# FIXME: Skip long double, not yet supported in newlib
# => This test currently is a nop
-mathl_CPPFLAGS = $(AM_CPPFLAGS) -DNO_LONG_DOUBLE
-
-$(srcdir)/domathl.c: $(srcdir)/../math/domath.in
- sed -e 's,[@]FTYPE[@],long double,' \
- -e 's,[@]FSUFFIX[@],l,g' \
- -e 's,%f,%Lf,g' \
- -e 's,[@]FGUARD[@],NO_LONG_DOUBLE,' \
- $(srcdir)/../math/domath.in > $(srcdir)/domathl.c
+mathl_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/math -DNO_LONG_DOUBLE
dist_rtems_tests_DATA = mathl.scn
diff --git a/testsuites/libtests/mathl/domathl.c b/testsuites/libtests/mathl/domathl.c
index 3ff381d712..d0758dcc74 100644
--- a/testsuites/libtests/mathl/domathl.c
+++ b/testsuites/libtests/mathl/domathl.c
@@ -11,277 +11,15 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+ #include "config.h"
#endif
-#include <math.h>
-#include <stdio.h>
-
-#ifndef M_PI_2
-#define M_PI_2 1.57079632679489661923
-#endif
-
-#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
+#ifdef NO_LONG_DOUBLE
+ #define PROVIDE_EMPTY_FUNC
#endif
-extern void domathl (void);
-
-void
-domathl (void)
-{
-#ifndef NO_LONG_DOUBLE
- long double f1;
- long double f2;
-
- int i1;
-
- f1 = acosl(0.0);
- fprintf( stdout, "acosl : %Lf\n", f1);
-
- f1 = acoshl(0.0);
- fprintf( stdout, "acoshl : %Lf\n", f1);
-
- f1 = asinl(1.0);
- fprintf( stdout, "asinl : %Lf\n", f1);
-
- f1 = asinhl(1.0);
- fprintf( stdout, "asinhl : %Lf\n", f1);
-
- f1 = atanl(M_PI_4);
- fprintf( stdout, "atanl : %Lf\n", f1);
-
- f1 = atan2l(2.3, 2.3);
- fprintf( stdout, "atan2l : %Lf\n", f1);
-
- f1 = atanhl(1.0);
- fprintf( stdout, "atanhl : %Lf\n", f1);
-
- f1 = cbrtl(27.0);
- fprintf( stdout, "cbrtl : %Lf\n", f1);
-
- f1 = ceill(3.5);
- fprintf( stdout, "ceill : %Lf\n", f1);
-
- f1 = copysignl(3.5, -2.5);
- fprintf( stdout, "copysignl : %Lf\n", f1);
-
- f1 = cosl(M_PI_2);
- fprintf( stdout, "cosl : %Lf\n", f1);
-
- f1 = coshl(M_PI_2);
- fprintf( stdout, "coshl : %Lf\n", f1);
-
- f1 = erfl(42.0);
- fprintf( stdout, "erfl : %Lf\n", f1);
-
- f1 = erfcl(42.0);
- fprintf( stdout, "erfcl : %Lf\n", f1);
-
- f1 = expl(0.42);
- fprintf( stdout, "expl : %Lf\n", f1);
-
- f1 = exp2l(0.42);
- fprintf( stdout, "exp2l : %Lf\n", f1);
-
- f1 = expm1l(0.00042);
- fprintf( stdout, "expm1l : %Lf\n", f1);
-
- f1 = fabsl(-1.123);
- fprintf( stdout, "fabsl : %Lf\n", f1);
-
- f1 = fdiml(1.123, 2.123);
- fprintf( stdout, "fdiml : %Lf\n", f1);
-
- f1 = floorl(0.5);
- fprintf( stdout, "floorl : %Lf\n", f1);
- f1 = floorl(-0.5);
- fprintf( stdout, "floorl : %Lf\n", f1);
-
- f1 = fmal(2.1, 2.2, 3.01);
- fprintf( stdout, "fmal : %Lf\n", f1);
-
- f1 = fmaxl(-0.42, 0.42);
- fprintf( stdout, "fmaxl : %Lf\n", f1);
-
- f1 = fminl(-0.42, 0.42);
- fprintf( stdout, "fminl : %Lf\n", f1);
-
- f1 = fmodl(42.0, 3.0);
- fprintf( stdout, "fmodl : %Lf\n", f1);
-
- /* no type-specific variant */
- i1 = fpclassify(1.0);
- fprintf( stdout, "fpclassify : %d\n", i1);
-
- f1 = frexpl(42.0, &i1);
- fprintf( stdout, "frexpl : %Lf\n", f1);
-
- f1 = hypotl(42.0, 42.0);
- fprintf( stdout, "hypotl : %Lf\n", f1);
-
- i1 = ilogbl(42.0);
- fprintf( stdout, "ilogbl : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isfinite(3.0);
- fprintf( stdout, "isfinite : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isgreater(3.0, 3.1);
- fprintf( stdout, "isgreater : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isgreaterequal(3.0, 3.1);
- fprintf( stdout, "isgreaterequal : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isinf(3.0);
- fprintf( stdout, "isinf : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isless(3.0, 3.1);
- fprintf( stdout, "isless : %d\n", i1);
-
- /* no type-specific variant */
- i1 = islessequal(3.0, 3.1);
- fprintf( stdout, "islessequal : %d\n", i1);
-
- /* no type-specific variant */
- i1 = islessgreater(3.0, 3.1);
- fprintf( stdout, "islessgreater : %d\n", i1);
+#define SUFFIX l
+#define FTYPE long double
+#define PRI "%Lf"
- /* no type-specific variant */
- i1 = isnan(0.0);
- fprintf( stdout, "isnan : %d\n", i1);
-
- /* no type-specific variant */
- i1 = isnormal(3.0);
- fprintf( stdout, "isnormal : %d\n", i1);
-
- /* no type-specific variant */
- f1 = isunordered(1.0, 2.0);
- fprintf( stdout, "isunordered : %d\n", i1);
-
- f1 = j0l(1.2);
- fprintf( stdout, "j0l : %Lf\n", f1);
-
- f1 = j1l(1.2);
- fprintf( stdout, "j1l : %Lf\n", f1);
-
- f1 = jnl(2,1.2);
- fprintf( stdout, "jnl : %Lf\n", f1);
-
- f1 = ldexpl(1.2,3);
- fprintf( stdout, "ldexpl : %Lf\n", f1);
-
- f1 = lgammal(42.0);
- fprintf( stdout, "lgammal : %Lf\n", f1);
-
- f1 = llrintl(-0.5);
- fprintf( stdout, "llrintl : %Lf\n", f1);
- f1 = llrintl(0.5);
- fprintf( stdout, "llrintl : %Lf\n", f1);
-
- f1 = llroundl(-0.5);
- fprintf( stdout, "lroundl : %Lf\n", f1);
- f1 = llroundl(0.5);
- fprintf( stdout, "lroundl : %Lf\n", f1);
-
- f1 = logl(42.0);
- fprintf( stdout, "logl : %Lf\n", f1);
-
- f1 = log10l(42.0);
- fprintf( stdout, "log10l : %Lf\n", f1);
-
- f1 = log1pl(42.0);
- fprintf( stdout, "log1pl : %Lf\n", f1);
-
- f1 = log2l(42.0);
- fprintf( stdout, "log2l : %Lf\n", f1);
-
- f1 = logbl(42.0);
- fprintf( stdout, "logbl : %Lf\n", f1);
-
- f1 = lrintl(-0.5);
- fprintf( stdout, "lrintl : %Lf\n", f1);
- f1 = lrintl(0.5);
- fprintf( stdout, "lrintl : %Lf\n", f1);
-
- f1 = lroundl(-0.5);
- fprintf( stdout, "lroundl : %Lf\n", f1);
- f1 = lroundl(0.5);
- fprintf( stdout, "lroundl : %Lf\n", f1);
-
- f1 = modfl(42.0,&f2);
- fprintf( stdout, "lmodfl : %Lf\n", f1);
-
- f1 = nanl("");
- fprintf( stdout, "nanl : %Lf\n", f1);
-
- f1 = nearbyintl(1.5);
- fprintf( stdout, "nearbyintl : %Lf\n", f1);
-
- f1 = nextafterl(1.5,2.0);
- fprintf( stdout, "nextafterl : %Lf\n", f1);
-
- f1 = powl(3.01, 2.0);
- fprintf( stdout, "powl : %Lf\n", f1);
-
- f1 = remainderl(3.01,2.0);
- fprintf( stdout, "remainderl : %Lf\n", f1);
-
- f1 = remquol(29.0,3.0,&i1);
- fprintf( stdout, "remquol : %Lf\n", f1);
-
- f1 = rintl(0.5);
- fprintf( stdout, "rintl : %Lf\n", f1);
- f1 = rintl(-0.5);
- fprintf( stdout, "rintl : %Lf\n", f1);
-
- f1 = roundl(0.5);
- fprintf( stdout, "roundl : %Lf\n", f1);
- f1 = roundl(-0.5);
- fprintf( stdout, "roundl : %Lf\n", f1);
-
- f1 = scalblnl(1.2,3);
- fprintf( stdout, "scalblnl : %Lf\n", f1);
-
- f1 = scalbnl(1.2,3);
- fprintf( stdout, "scalbnl : %Lf\n", f1);
-
- /* no type-specific variant */
- i1 = signbit(1.0);
- fprintf( stdout, "signbit : %i\n", i1);
-
- f1 = sinl(M_PI_4);
- fprintf( stdout, "sinl : %Lf\n", f1);
-
- f1 = sinhl(M_PI_4);
- fprintf( stdout, "sinhl : %Lf\n", f1);
-
- f1 = sqrtl(9.0);
- fprintf( stdout, "sqrtl : %Lf\n", f1);
-
- f1 = tanl(M_PI_4);
- fprintf( stdout, "tanl : %Lf\n", f1);
-
- f1 = tanhl(M_PI_4);
- fprintf( stdout, "tanhl : %Lf\n", f1);
-
- f1 = tgammal(2.1);
- fprintf( stdout, "tgammal : %Lf\n", f1);
-
- f1 = truncl(3.5);
- fprintf( stdout, "truncl : %Lf\n", f1);
-
- f1 = y0l(1.2);
- fprintf( stdout, "y0l : %Lf\n", f1);
-
- f1 = y1l(1.2);
- fprintf( stdout, "y1l : %Lf\n", f1);
-
- f1 = ynl(3,1.2);
- fprintf( stdout, "ynl : %Lf\n", f1);
-#endif
-}
+#include <domath.h>