Module Name:    src
Committed By:   jruoho
Date:           Sun Sep 18 05:19:18 UTC 2011

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/tests/lib/libm: Makefile
Added Files:
        src/tests/lib/libm: t_exp.c

Log Message:
IEEE checks for the exponential family.


To generate a diff of this commit:
cvs rdiff -u -r1.388 -r1.389 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libm/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_exp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.388 src/distrib/sets/lists/tests/mi:1.389
--- src/distrib/sets/lists/tests/mi:1.388	Sat Sep 17 18:08:36 2011
+++ src/distrib/sets/lists/tests/mi	Sun Sep 18 05:19:18 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.388 2011/09/17 18:08:36 jruoho Exp $
+# $NetBSD: mi,v 1.389 2011/09/18 05:19:18 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -552,6 +552,7 @@
 ./usr/libdata/debug/usr/tests/lib/libm/t_ceil.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_cos.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_erf.debug			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libm/t_exp.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_floor.debug			tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libm/t_infinity.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_ldexp.debug			tests-lib-debug		debug,atf
@@ -2266,6 +2267,7 @@
 ./usr/tests/lib/libm/t_ceil			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_cos			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_erf			tests-lib-tests		atf
+./usr/tests/lib/libm/t_exp			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_floor			tests-obsolete		obsolete
 ./usr/tests/lib/libm/t_infinity			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_ldexp			tests-lib-tests		atf

Index: src/tests/lib/libm/Makefile
diff -u src/tests/lib/libm/Makefile:1.12 src/tests/lib/libm/Makefile:1.13
--- src/tests/lib/libm/Makefile:1.12	Sat Sep 17 18:08:35 2011
+++ src/tests/lib/libm/Makefile	Sun Sep 18 05:19:18 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2011/09/17 18:08:35 jruoho Exp $
+# $NetBSD: Makefile,v 1.13 2011/09/18 05:19:18 jruoho Exp $
 
 .include <bsd.own.mk>
 
@@ -10,6 +10,7 @@
 TESTS_C+=	t_ceil
 TESTS_C+=	t_cos
 TESTS_C+=	t_erf
+TESTS_C+=	t_exp
 TESTS_C+=	t_infinity
 TESTS_C+=	t_ldexp
 TESTS_C+=	t_log

Added files:

Index: src/tests/lib/libm/t_exp.c
diff -u /dev/null src/tests/lib/libm/t_exp.c:1.1
--- /dev/null	Sun Sep 18 05:19:19 2011
+++ src/tests/lib/libm/t_exp.c	Sun Sep 18 05:19:18 2011
@@ -0,0 +1,684 @@
+/* $NetBSD: t_exp.c,v 1.1 2011/09/18 05:19:18 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jukka Ruohonen.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <atf-c.h>
+#include <math.h>
+
+/*
+ * exp2(3)
+ */
+ATF_TC(exp2_nan);
+ATF_TC_HEAD(exp2_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2(NaN) == NaN");
+}
+
+ATF_TC_BODY(exp2_nan, tc)
+{
+#ifndef __vax__
+	const double x = 0.0L / 0.0L;
+
+	if (isnan(exp2(x)) == 0)
+		atf_tc_fail_nonfatal("exp2(NaN) != NaN");
+#endif
+}
+
+ATF_TC(exp2_inf_neg);
+ATF_TC_HEAD(exp2_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2(-Inf) == +0.0");
+}
+
+ATF_TC_BODY(exp2_inf_neg, tc)
+{
+#ifndef __vax__
+	const double x = -1.0L / 0.0L;
+	double y = exp2(x);
+
+	if (fabs(y) > 0.0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("exp2(-Inf) != +0.0");
+#endif
+}
+
+ATF_TC(exp2_inf_pos);
+ATF_TC_HEAD(exp2_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2(+Inf) == +Inf");
+}
+
+ATF_TC_BODY(exp2_inf_pos, tc)
+{
+#ifndef __vax__
+	const double x = 1.0L / 0.0L;
+	double y = exp2(x);
+
+	if (isinf(y) == 0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("exp2(+Inf) != +Inf");
+#endif
+}
+
+ATF_TC(exp2_product);
+ATF_TC_HEAD(exp2_product, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2(x + y) == exp2(x) * exp2(y)");
+}
+
+ATF_TC_BODY(exp2_product, tc)
+{
+#ifndef __vax__
+	const double x[] = { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 };
+	const double y[] = { 8.8, 7.7, 6.6, 5.5, 4.4, 3.3, 2.2, 1.1, 0.0 };
+	const double eps = 1.0e-11;
+	size_t i;
+
+	for (i = 0; i < __arraycount(x); i++) {
+
+		if (fabs(exp2(x[i] + y[i]) - (exp2(x[i]) * exp2(y[i]))) > eps)
+			atf_tc_fail_nonfatal("exp2(%0.01f + %0.01f) != exp2("
+			    "%0.01f) * exp2(%0.01f)", x[i], y[i], x[i], y[i]);
+	}
+#endif
+}
+
+ATF_TC(exp2_zero_neg);
+ATF_TC_HEAD(exp2_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2(-0.0) == 1.0");
+}
+
+ATF_TC_BODY(exp2_zero_neg, tc)
+{
+#ifndef __vax__
+	const double x = -0.0L;
+
+	if (fabs(exp2(x) - 1.0) > 0.0)
+		atf_tc_fail_nonfatal("exp2(-0.0) != 1.0");
+#endif
+}
+
+ATF_TC(exp2_zero_pos);
+ATF_TC_HEAD(exp2_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2(+0.0) == 1.0");
+}
+
+ATF_TC_BODY(exp2_zero_pos, tc)
+{
+#ifndef __vax__
+	const double x = 0.0L;
+
+	if (fabs(exp2(x) - 1.0) > 0.0)
+		atf_tc_fail_nonfatal("exp2(+0.0) != 1.0");
+#endif
+}
+
+/*
+ * exp2f(3)
+ */
+ATF_TC(exp2f_nan);
+ATF_TC_HEAD(exp2f_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2f(NaN) == NaN");
+}
+
+ATF_TC_BODY(exp2f_nan, tc)
+{
+#ifndef __vax__
+	const float x = 0.0L / 0.0L;
+
+	if (isnan(exp2f(x)) == 0)
+		atf_tc_fail_nonfatal("exp2f(NaN) != NaN");
+#endif
+}
+
+ATF_TC(exp2f_inf_neg);
+ATF_TC_HEAD(exp2f_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2f(-Inf) == +0.0");
+}
+
+ATF_TC_BODY(exp2f_inf_neg, tc)
+{
+#ifndef __vax__
+	const float x = -1.0L / 0.0L;
+	float y = exp2f(x);
+
+	if (fabsf(y) > 0.0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("exp2f(-Inf) != +0.0");
+#endif
+}
+
+ATF_TC(exp2f_inf_pos);
+ATF_TC_HEAD(exp2f_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2f(+Inf) == +Inf");
+}
+
+ATF_TC_BODY(exp2f_inf_pos, tc)
+{
+#ifndef __vax__
+	const float x = 1.0L / 0.0L;
+	float y = exp2f(x);
+
+	if (isinf(y) == 0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("exp2f(+Inf) != +Inf");
+#endif
+}
+
+ATF_TC(exp2f_product);
+ATF_TC_HEAD(exp2f_product, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2f(x+y) == exp2f(x) * exp2f(y)");
+}
+
+ATF_TC_BODY(exp2f_product, tc)
+{
+#ifndef __vax__
+	const float x[] = { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 };
+	const float y[] = { 8.8, 7.7, 6.6, 5.5, 4.4, 3.3, 2.2, 1.1, 0.0 };
+	const float eps = 1.0e-2;
+	size_t i;
+
+	for (i = 0; i < __arraycount(x); i++) {
+
+		if (fabsf(exp2f(x[i] + y[i]) -
+			(exp2f(x[i]) * exp2f(y[i]))) > eps)
+			atf_tc_fail_nonfatal("exp2f(%0.01f + %0.01f) != exp2f("
+			    "%0.01f) * exp2f(%0.01f)", x[i], y[i], x[i], y[i]);
+	}
+#endif
+}
+
+ATF_TC(exp2f_zero_neg);
+ATF_TC_HEAD(exp2f_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2f(-0.0) == 1.0");
+}
+
+ATF_TC_BODY(exp2f_zero_neg, tc)
+{
+#ifndef __vax__
+	const float x = -0.0L;
+
+	if (fabsf(exp2f(x) - 1.0) > 0.0)
+		atf_tc_fail_nonfatal("exp2f(-0.0) != 1.0");
+#endif
+}
+
+ATF_TC(exp2f_zero_pos);
+ATF_TC_HEAD(exp2f_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp2f(+0.0) == 1.0");
+}
+
+ATF_TC_BODY(exp2f_zero_pos, tc)
+{
+#ifndef __vax__
+	const float x = 0.0L;
+
+	if (fabsf(exp2f(x) - 1.0) > 0.0)
+		atf_tc_fail_nonfatal("exp2f(+0.0) != 1.0");
+#endif
+}
+
+/*
+ * exp(3)
+ */
+ATF_TC(exp_nan);
+ATF_TC_HEAD(exp_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp(NaN) == NaN");
+}
+
+ATF_TC_BODY(exp_nan, tc)
+{
+#ifndef __vax__
+	const double x = 0.0L / 0.0L;
+
+	if (isnan(exp(x)) == 0)
+		atf_tc_fail_nonfatal("exp(NaN) != NaN");
+#endif
+}
+
+ATF_TC(exp_inf_neg);
+ATF_TC_HEAD(exp_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp(-Inf) == +0.0");
+}
+
+ATF_TC_BODY(exp_inf_neg, tc)
+{
+#ifndef __vax__
+	const double x = -1.0L / 0.0L;
+	double y = exp(x);
+
+	if (fabs(y) > 0.0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("exp(-Inf) != +0.0");
+#endif
+}
+
+ATF_TC(exp_inf_pos);
+ATF_TC_HEAD(exp_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp(+Inf) == +Inf");
+}
+
+ATF_TC_BODY(exp_inf_pos, tc)
+{
+#ifndef __vax__
+	const double x = 1.0L / 0.0L;
+	double y = exp(x);
+
+	if (isinf(y) == 0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("exp(+Inf) != +Inf");
+#endif
+}
+
+ATF_TC(exp_product);
+ATF_TC_HEAD(exp_product, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp(x + y) == exp(x) * exp(y)");
+}
+
+ATF_TC_BODY(exp_product, tc)
+{
+#ifndef __vax__
+	const double x[] = { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 };
+	const double y[] = { 8.8, 7.7, 6.6, 5.5, 4.4, 3.3, 2.2, 1.1, 0.0 };
+	const double eps = 1.0e-11;
+	size_t i;
+
+	for (i = 0; i < __arraycount(x); i++) {
+
+		if (fabs(exp(x[i] + y[i]) - (exp(x[i]) * exp(y[i]))) > eps)
+			atf_tc_fail_nonfatal("exp(%0.01f + %0.01f) != exp("
+			    "%0.01f) * exp(%0.01f)", x[i], y[i], x[i], y[i]);
+	}
+#endif
+}
+
+ATF_TC(exp_zero_neg);
+ATF_TC_HEAD(exp_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp(-0.0) == 1.0");
+}
+
+ATF_TC_BODY(exp_zero_neg, tc)
+{
+#ifndef __vax__
+	const double x = -0.0L;
+
+	if (fabs(exp(x) - 1.0) > 0.0)
+		atf_tc_fail_nonfatal("exp(-0.0) != 1.0");
+#endif
+}
+
+ATF_TC(exp_zero_pos);
+ATF_TC_HEAD(exp_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test exp(+0.0) == 1.0");
+}
+
+ATF_TC_BODY(exp_zero_pos, tc)
+{
+#ifndef __vax__
+	const double x = 0.0L;
+
+	if (fabs(exp(x) - 1.0) > 0.0)
+		atf_tc_fail_nonfatal("exp(+0.0) != 1.0");
+#endif
+}
+
+/*
+ * expf(3)
+ */
+ATF_TC(expf_nan);
+ATF_TC_HEAD(expf_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expf(NaN) == NaN");
+}
+
+ATF_TC_BODY(expf_nan, tc)
+{
+#ifndef __vax__
+	const float x = 0.0L / 0.0L;
+
+	if (isnan(expf(x)) == 0)
+		atf_tc_fail_nonfatal("expf(NaN) != NaN");
+#endif
+}
+
+ATF_TC(expf_inf_neg);
+ATF_TC_HEAD(expf_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expf(-Inf) == +0.0");
+}
+
+ATF_TC_BODY(expf_inf_neg, tc)
+{
+#ifndef __vax__
+	const float x = -1.0L / 0.0L;
+	float y = expf(x);
+
+	if (fabsf(y) > 0.0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("expf(-Inf) != +0.0");
+#endif
+}
+
+ATF_TC(expf_inf_pos);
+ATF_TC_HEAD(expf_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expf(+Inf) == +Inf");
+}
+
+ATF_TC_BODY(expf_inf_pos, tc)
+{
+#ifndef __vax__
+	const float x = 1.0L / 0.0L;
+	float y = expf(x);
+
+	if (isinf(y) == 0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("expf(+Inf) != +Inf");
+#endif
+}
+
+ATF_TC(expf_product);
+ATF_TC_HEAD(expf_product, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expf(x+y) == expf(x) * expf(y)");
+}
+
+ATF_TC_BODY(expf_product, tc)
+{
+#ifndef __vax__
+	const float x[] = { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 };
+	const float y[] = { 8.8, 7.7, 6.6, 5.5, 4.4, 3.3, 2.2, 1.1, 0.0 };
+	const float eps = 1.0e-2;
+	size_t i;
+
+	for (i = 0; i < __arraycount(x); i++) {
+
+		if (fabsf(expf(x[i] + y[i]) - (expf(x[i]) * expf(y[i]))) > eps)
+			atf_tc_fail_nonfatal("expf(%0.01f + %0.01f) != expf("
+			    "%0.01f) * expf(%0.01f)", x[i], y[i], x[i], y[i]);
+	}
+#endif
+}
+
+ATF_TC(expf_zero_neg);
+ATF_TC_HEAD(expf_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expf(-0.0) == 1.0");
+}
+
+ATF_TC_BODY(expf_zero_neg, tc)
+{
+#ifndef __vax__
+	const float x = -0.0L;
+
+	if (fabsf(expf(x) - 1.0) > 0.0)
+		atf_tc_fail_nonfatal("expf(-0.0) != 1.0");
+#endif
+}
+
+ATF_TC(expf_zero_pos);
+ATF_TC_HEAD(expf_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expf(+0.0) == 1.0");
+}
+
+ATF_TC_BODY(expf_zero_pos, tc)
+{
+#ifndef __vax__
+	const float x = 0.0L;
+
+	if (fabsf(expf(x) - 1.0) > 0.0)
+		atf_tc_fail_nonfatal("expf(+0.0) != 1.0");
+#endif
+}
+
+/*
+ * expm1(3)
+ */
+ATF_TC(expm1_nan);
+ATF_TC_HEAD(expm1_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1(NaN) == NaN");
+}
+
+ATF_TC_BODY(expm1_nan, tc)
+{
+#ifndef __vax__
+	const double x = 0.0L / 0.0L;
+
+	if (isnan(expm1(x)) == 0)
+		atf_tc_fail_nonfatal("expm1(NaN) != NaN");
+#endif
+}
+
+ATF_TC(expm1_inf_neg);
+ATF_TC_HEAD(expm1_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1(-Inf) == -1");
+}
+
+ATF_TC_BODY(expm1_inf_neg, tc)
+{
+#ifndef __vax__
+	const double x = -1.0L / 0.0L;
+
+	if (expm1(x) != -1.0)
+		atf_tc_fail_nonfatal("expm1(-Inf) != -1.0");
+#endif
+}
+
+ATF_TC(expm1_inf_pos);
+ATF_TC_HEAD(expm1_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1(+Inf) == +Inf");
+}
+
+ATF_TC_BODY(expm1_inf_pos, tc)
+{
+#ifndef __vax__
+	const double x = 1.0L / 0.0L;
+	double y = expm1(x);
+
+	if (isinf(y) == 0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("expm1(+Inf) != +Inf");
+#endif
+}
+
+ATF_TC(expm1_zero_neg);
+ATF_TC_HEAD(expm1_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1(-0.0) == -0.0");
+}
+
+ATF_TC_BODY(expm1_zero_neg, tc)
+{
+#ifndef __vax__
+	const double x = -0.0L;
+	double y = expm1(x);
+
+	if (fabs(y) > 0.0 || signbit(y) == 0)
+		atf_tc_fail_nonfatal("expm1(-0.0) != -0.0");
+#endif
+}
+
+ATF_TC(expm1_zero_pos);
+ATF_TC_HEAD(expm1_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1(+0.0) == 1.0");
+}
+
+ATF_TC_BODY(expm1_zero_pos, tc)
+{
+#ifndef __vax__
+	const double x = 0.0L;
+	double y = expm1(x);
+
+	if (fabs(y) > 0.0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("expm1(+0.0) != +0.0");
+#endif
+}
+
+/*
+ * expm1f(3)
+ */
+ATF_TC(expm1f_nan);
+ATF_TC_HEAD(expm1f_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1f(NaN) == NaN");
+}
+
+ATF_TC_BODY(expm1f_nan, tc)
+{
+#ifndef __vax__
+	const float x = 0.0L / 0.0L;
+
+	if (isnan(expm1f(x)) == 0)
+		atf_tc_fail_nonfatal("expm1f(NaN) != NaN");
+#endif
+}
+
+ATF_TC(expm1f_inf_neg);
+ATF_TC_HEAD(expm1f_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1f(-Inf) == -1");
+}
+
+ATF_TC_BODY(expm1f_inf_neg, tc)
+{
+#ifndef __vax__
+	const float x = -1.0L / 0.0L;
+
+	if (expm1f(x) != -1.0)
+		atf_tc_fail_nonfatal("expm1f(-Inf) != -1.0");
+#endif
+}
+
+ATF_TC(expm1f_inf_pos);
+ATF_TC_HEAD(expm1f_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1f(+Inf) == +Inf");
+}
+
+ATF_TC_BODY(expm1f_inf_pos, tc)
+{
+#ifndef __vax__
+	const float x = 1.0L / 0.0L;
+	float y = expm1f(x);
+
+	if (isinf(y) == 0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("expm1f(+Inf) != +Inf");
+#endif
+}
+
+ATF_TC(expm1f_zero_neg);
+ATF_TC_HEAD(expm1f_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1f(-0.0) == -0.0");
+}
+
+ATF_TC_BODY(expm1f_zero_neg, tc)
+{
+#ifndef __vax__
+	const float x = -0.0L;
+	float y = expm1f(x);
+
+	if (fabsf(y) > 0.0 || signbit(y) == 0)
+		atf_tc_fail_nonfatal("expm1f(-0.0) != -0.0");
+#endif
+}
+
+ATF_TC(expm1f_zero_pos);
+ATF_TC_HEAD(expm1f_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test expm1f(+0.0) == 1.0");
+}
+
+ATF_TC_BODY(expm1f_zero_pos, tc)
+{
+#ifndef __vax__
+	const float x = 0.0L;
+	float y = expm1f(x);
+
+	if (fabsf(y) > 0.0 || signbit(y) != 0)
+		atf_tc_fail_nonfatal("expm1f(+0.0) != +0.0");
+#endif
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_ADD_TC(tp, exp2_nan);
+	ATF_TP_ADD_TC(tp, exp2_inf_neg);
+	ATF_TP_ADD_TC(tp, exp2_inf_pos);
+	ATF_TP_ADD_TC(tp, exp2_product);
+	ATF_TP_ADD_TC(tp, exp2_zero_neg);
+	ATF_TP_ADD_TC(tp, exp2_zero_pos);
+
+	ATF_TP_ADD_TC(tp, exp2f_nan);
+	ATF_TP_ADD_TC(tp, exp2f_inf_neg);
+	ATF_TP_ADD_TC(tp, exp2f_inf_pos);
+	ATF_TP_ADD_TC(tp, exp2f_product);
+	ATF_TP_ADD_TC(tp, exp2f_zero_neg);
+	ATF_TP_ADD_TC(tp, exp2f_zero_pos);
+
+	ATF_TP_ADD_TC(tp, exp_nan);
+	ATF_TP_ADD_TC(tp, exp_inf_neg);
+	ATF_TP_ADD_TC(tp, exp_inf_pos);
+	ATF_TP_ADD_TC(tp, exp_product);
+	ATF_TP_ADD_TC(tp, exp_zero_neg);
+	ATF_TP_ADD_TC(tp, exp_zero_pos);
+
+	ATF_TP_ADD_TC(tp, expf_nan);
+	ATF_TP_ADD_TC(tp, expf_inf_neg);
+	ATF_TP_ADD_TC(tp, expf_inf_pos);
+	ATF_TP_ADD_TC(tp, expf_product);
+	ATF_TP_ADD_TC(tp, expf_zero_neg);
+	ATF_TP_ADD_TC(tp, expf_zero_pos);
+
+	ATF_TP_ADD_TC(tp, expm1_nan);
+	ATF_TP_ADD_TC(tp, expm1_inf_neg);
+	ATF_TP_ADD_TC(tp, expm1_inf_pos);
+	ATF_TP_ADD_TC(tp, expm1_zero_neg);
+	ATF_TP_ADD_TC(tp, expm1_zero_pos);
+
+	ATF_TP_ADD_TC(tp, expm1f_nan);
+	ATF_TP_ADD_TC(tp, expm1f_inf_neg);
+	ATF_TP_ADD_TC(tp, expm1f_inf_pos);
+	ATF_TP_ADD_TC(tp, expm1f_zero_neg);
+	ATF_TP_ADD_TC(tp, expm1f_zero_pos);
+
+	return atf_no_error();
+}

Reply via email to