From e371ea9949ecc8897f4cb34437cc6590a0fc51f0 Mon Sep 17 00:00:00 2001 From: cvs2git Date: Fri, 18 Mar 2011 10:11:42 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'rtems-4-10-0'. Sprout from rtems-4-10-branch 2011-02-08 15:56:24 UTC Joel Sherrill 'Ensure all version instances say 4.10.' Cherrypick from rtems-4-10-branch 2011-03-18 10:11:41 UTC cvs2git 'This commit was manufactured by cvs2svn to create branch': cpukit/zlib/ChangeLog cpukit/zlib/ChangeLog.zlib cpukit/zlib/FAQ cpukit/zlib/Makefile.am cpukit/zlib/README cpukit/zlib/adler32.c cpukit/zlib/compress.c cpukit/zlib/crc32.c cpukit/zlib/deflate.c cpukit/zlib/deflate.h cpukit/zlib/doc/algorithm.txt cpukit/zlib/gzclose.c cpukit/zlib/gzguts.h cpukit/zlib/gzlib.c cpukit/zlib/gzread.c cpukit/zlib/gzwrite.c cpukit/zlib/infback.c cpukit/zlib/inffast.c cpukit/zlib/inflate.c cpukit/zlib/inflate.h cpukit/zlib/inftrees.c cpukit/zlib/inftrees.h cpukit/zlib/trees.c cpukit/zlib/uncompr.c cpukit/zlib/zconf.h cpukit/zlib/zlib.3 cpukit/zlib/zlib.h cpukit/zlib/zutil.c cpukit/zlib/zutil.h testsuites/libtests/mathf/.cvsignore testsuites/libtests/mathf/Makefile.am testsuites/libtests/mathf/domathf.c testsuites/libtests/mathf/init.c testsuites/libtests/mathf/mathf.scn --- testsuites/libtests/mathf/.cvsignore | 2 + testsuites/libtests/mathf/Makefile.am | 30 ++++ testsuites/libtests/mathf/domathf.c | 281 ++++++++++++++++++++++++++++++++++ testsuites/libtests/mathf/init.c | 62 ++++++++ testsuites/libtests/mathf/mathf.scn | 83 ++++++++++ 5 files changed, 458 insertions(+) create mode 100644 testsuites/libtests/mathf/.cvsignore create mode 100644 testsuites/libtests/mathf/Makefile.am create mode 100644 testsuites/libtests/mathf/domathf.c create mode 100644 testsuites/libtests/mathf/init.c create mode 100644 testsuites/libtests/mathf/mathf.scn (limited to 'testsuites/libtests/mathf') diff --git a/testsuites/libtests/mathf/.cvsignore b/testsuites/libtests/mathf/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/libtests/mathf/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/libtests/mathf/Makefile.am b/testsuites/libtests/mathf/Makefile.am new file mode 100644 index 0000000000..57b372e08f --- /dev/null +++ b/testsuites/libtests/mathf/Makefile.am @@ -0,0 +1,30 @@ +## +## $Id$ +## + +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 + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +mathf_LDADD = -lm + +LINK_OBJS = $(mathf_OBJECTS) $(mathf_LDADD) +LINK_LIBS = $(mathf_LDLIBS) + +mathf$(EXEEXT): $(mathf_OBJECTS) $(mathf_DEPENDENCIES) + @rm -f mathf$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/libtests/mathf/domathf.c b/testsuites/libtests/mathf/domathf.c new file mode 100644 index 0000000000..6d99ae1883 --- /dev/null +++ b/testsuites/libtests/mathf/domathf.c @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2010 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. + */ + +#include +#include + +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 +#endif + +#ifndef M_PI_4 +#define M_PI_4 0.78539816339744830962 +#endif + +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); + + /* 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 +} diff --git a/testsuites/libtests/mathf/init.c b/testsuites/libtests/mathf/init.c new file mode 100644 index 0000000000..7683ef5f3c --- /dev/null +++ b/testsuites/libtests/mathf/init.c @@ -0,0 +1,62 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if __rtems__ +#include /* for device driver prototypes */ +#endif + +#include +#include + +extern void domathf(void); + +#if __rtems__ +rtems_task Init( + rtems_task_argument ignored +) +#else +int main( void ) +#endif +{ + fprintf( stdout, "*** FLOAT MATH TEST ***\n" ); + + domathf(); + + fprintf( stdout, "*** END OF FLOAT MATH TEST ***\n" ); + exit( 0 ); +} + +#if __rtems__ +/* NOTICE: the clock driver is explicitly disabled */ +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT + +#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT +#include +#endif diff --git a/testsuites/libtests/mathf/mathf.scn b/testsuites/libtests/mathf/mathf.scn new file mode 100644 index 0000000000..1782a1fcf5 --- /dev/null +++ b/testsuites/libtests/mathf/mathf.scn @@ -0,0 +1,83 @@ +*** FLOAT MATH TEST *** +acosf : 1.570796 +acoshf : -nan +asinf : 1.570796 +asinhf : 0.881374 +atanf : 0.665774 +atan2f : 0.785398 +atanhf : inf +cbrtf : 3.000000 +ceilf : 4.000000 +copysignf : -3.500000 +cosf : -0.000000 +coshf : 2.509179 +erff : 1.000000 +erfcf : 0.000000 +expf : 1.521962 +exp2f : 1.337928 +expm1f : 0.000420 +fabsf : 1.123000 +fdimf : 0.000000 +floorf : 0.000000 +floorf : -1.000000 +fmaf : 7.630000 +fmaxf : 0.420000 +fminf : -0.420000 +fmodf : 0.000000 +fpclassify : 4 +frexpf : 0.656250 +hypotf : 59.396969 +ilogbf : 5 +isfinite : 1 +isgreater : 0 +isgreaterequal : 0 +isinf : 0 +isless : 1 +islessequal : 1 +islessgreater : 1 +isnan : 0 +isnormal : 1 +isunordered : 1 +j0f : 0.671133 +j1f : 0.498289 +jnf : 0.159349 +ldexpf : 9.600000 +lgammaf : 114.034218 +llrintf : 0.000000 +llrintf : 0.000000 +lroundf : -1.000000 +lroundf : 1.000000 +logf : 3.737670 +log10f : 1.623249 +log1pf : 3.761200 +log2f : 5.392317 +logbf : 5.000000 +lrintf : 0.000000 +lrintf : 0.000000 +lroundf : -1.000000 +lroundf : 1.000000 +lmodff : 0.000000 +nanf : nan +nearbyintf : 2.000000 +nextafterf : 1.500000 +powf : 9.060100 +remainderf : -0.990000 +remquof : -1.000000 +rintf : 0.000000 +rintf : -0.000000 +roundf : 1.000000 +roundf : -1.000000 +scalblnf : 9.600000 +scalbnf : 9.600000 +signbit : 0 +sinf : 0.707107 +sinhf : 0.868671 +sqrtf : 3.000000 +tanf : 1.000000 +tanhf : 0.655794 +tgammaf : 1.046486 +truncf : 3.000000 +y0f : 0.228083 +y1f : -0.621136 +ynf : -3.589899 +*** END OF FLOAT MATH TEST *** -- cgit v1.2.3