xref: /freebsd/lib/msun/tests/cexp_test.c (revision a2f733ab)
14dc607e7SEnji Cooper /*-
24dc607e7SEnji Cooper  * Copyright (c) 2008-2011 David Schultz <das@FreeBSD.org>
34dc607e7SEnji Cooper  * All rights reserved.
44dc607e7SEnji Cooper  *
54dc607e7SEnji Cooper  * Redistribution and use in source and binary forms, with or without
64dc607e7SEnji Cooper  * modification, are permitted provided that the following conditions
74dc607e7SEnji Cooper  * are met:
84dc607e7SEnji Cooper  * 1. Redistributions of source code must retain the above copyright
94dc607e7SEnji Cooper  *    notice, this list of conditions and the following disclaimer.
104dc607e7SEnji Cooper  * 2. Redistributions in binary form must reproduce the above copyright
114dc607e7SEnji Cooper  *    notice, this list of conditions and the following disclaimer in the
124dc607e7SEnji Cooper  *    documentation and/or other materials provided with the distribution.
134dc607e7SEnji Cooper  *
144dc607e7SEnji Cooper  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
154dc607e7SEnji Cooper  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
164dc607e7SEnji Cooper  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
174dc607e7SEnji Cooper  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
184dc607e7SEnji Cooper  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
194dc607e7SEnji Cooper  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
204dc607e7SEnji Cooper  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
214dc607e7SEnji Cooper  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
224dc607e7SEnji Cooper  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
234dc607e7SEnji Cooper  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
244dc607e7SEnji Cooper  * SUCH DAMAGE.
254dc607e7SEnji Cooper  */
264dc607e7SEnji Cooper 
274dc607e7SEnji Cooper /*
284dc607e7SEnji Cooper  * Tests for corner cases in cexp*().
294dc607e7SEnji Cooper  */
304dc607e7SEnji Cooper 
314dc607e7SEnji Cooper #include <sys/param.h>
324dc607e7SEnji Cooper 
334dc607e7SEnji Cooper #include <complex.h>
344dc607e7SEnji Cooper #include <fenv.h>
354dc607e7SEnji Cooper #include <float.h>
364dc607e7SEnji Cooper #include <math.h>
374dc607e7SEnji Cooper #include <stdio.h>
384dc607e7SEnji Cooper 
394dc607e7SEnji Cooper #include "test-utils.h"
404dc607e7SEnji Cooper 
414dc607e7SEnji Cooper #pragma STDC FENV_ACCESS	ON
424dc607e7SEnji Cooper #pragma	STDC CX_LIMITED_RANGE	OFF
434dc607e7SEnji Cooper 
444dc607e7SEnji Cooper /*
454dc607e7SEnji Cooper  * Test that a function returns the correct value and sets the
464dc607e7SEnji Cooper  * exception flags correctly. The exceptmask specifies which
474dc607e7SEnji Cooper  * exceptions we should check. We need to be lenient for several
484dc607e7SEnji Cooper  * reasons, but mainly because on some architectures it's impossible
494dc607e7SEnji Cooper  * to raise FE_OVERFLOW without raising FE_INEXACT. In some cases,
504dc607e7SEnji Cooper  * whether cexp() raises an invalid exception is unspecified.
514dc607e7SEnji Cooper  *
524dc607e7SEnji Cooper  * These are macros instead of functions so that assert provides more
534dc607e7SEnji Cooper  * meaningful error messages.
544dc607e7SEnji Cooper  *
554dc607e7SEnji Cooper  * XXX The volatile here is to avoid gcc's bogus constant folding and work
564dc607e7SEnji Cooper  *     around the lack of support for the FENV_ACCESS pragma.
574dc607e7SEnji Cooper  */
58740890beSDimitry Andric #define	test_t(type, func, z, result, exceptmask, excepts, checksign)	\
59740890beSDimitry Andric do {									\
604dc607e7SEnji Cooper 	volatile long double complex _d = z;				\
61740890beSDimitry Andric 	volatile type complex _r = result;				\
62133bc645SAlex Richardson 	ATF_REQUIRE_EQ(0, feclearexcept(FE_ALL_EXCEPT));		\
63b424e003SAlex Richardson 	CHECK_CFPEQUAL_CS((func)(_d), (_r), (checksign));		\
64133bc645SAlex Richardson 	CHECK_FP_EXCEPTIONS_MSG(excepts, exceptmask, "for %s(%s)",	\
65133bc645SAlex Richardson 	    #func, #z);							\
664dc607e7SEnji Cooper } while (0)
674dc607e7SEnji Cooper 
68740890beSDimitry Andric #define	test(func, z, result, exceptmask, excepts, checksign)		\
69740890beSDimitry Andric 	test_t(double, func, z, result, exceptmask, excepts, checksign)
70740890beSDimitry Andric 
71740890beSDimitry Andric #define	test_f(func, z, result, exceptmask, excepts, checksign)		\
72740890beSDimitry Andric 	test_t(float, func, z, result, exceptmask, excepts, checksign)
73740890beSDimitry Andric 
744dc607e7SEnji Cooper /* Test within a given tolerance. */
754dc607e7SEnji Cooper #define	test_tol(func, z, result, tol)	do {			\
76b424e003SAlex Richardson 	CHECK_CFPEQUAL_TOL((func)(z), (result), (tol),		\
77b424e003SAlex Richardson 	    FPE_ABS_ZERO | CS_BOTH);				\
784dc607e7SEnji Cooper } while (0)
794dc607e7SEnji Cooper 
804dc607e7SEnji Cooper /* Test all the functions that compute cexp(x). */
814dc607e7SEnji Cooper #define	testall(x, result, exceptmask, excepts, checksign)	do {	\
824dc607e7SEnji Cooper 	test(cexp, x, result, exceptmask, excepts, checksign);		\
83740890beSDimitry Andric 	test_f(cexpf, x, result, exceptmask, excepts, checksign);	\
844dc607e7SEnji Cooper } while (0)
854dc607e7SEnji Cooper 
864dc607e7SEnji Cooper /*
874dc607e7SEnji Cooper  * Test all the functions that compute cexp(x), within a given tolerance.
884dc607e7SEnji Cooper  * The tolerance is specified in ulps.
894dc607e7SEnji Cooper  */
904dc607e7SEnji Cooper #define	testall_tol(x, result, tol)				do {	\
914dc607e7SEnji Cooper 	test_tol(cexp, x, result, tol * DBL_ULP());			\
924dc607e7SEnji Cooper 	test_tol(cexpf, x, result, tol * FLT_ULP());			\
934dc607e7SEnji Cooper } while (0)
944dc607e7SEnji Cooper 
954dc607e7SEnji Cooper /* Various finite non-zero numbers to test. */
964dc607e7SEnji Cooper static const float finites[] =
974dc607e7SEnji Cooper { -42.0e20, -1.0, -1.0e-10, -0.0, 0.0, 1.0e-10, 1.0, 42.0e20 };
984dc607e7SEnji Cooper 
994dc607e7SEnji Cooper 
1004dc607e7SEnji Cooper /* Tests for 0 */
101133bc645SAlex Richardson ATF_TC_WITHOUT_HEAD(zero);
ATF_TC_BODY(zero,tc)102133bc645SAlex Richardson ATF_TC_BODY(zero, tc)
1034dc607e7SEnji Cooper {
1044dc607e7SEnji Cooper 
1054dc607e7SEnji Cooper 	/* cexp(0) = 1, no exceptions raised */
1064dc607e7SEnji Cooper 	testall(0.0, 1.0, ALL_STD_EXCEPT, 0, 1);
1074dc607e7SEnji Cooper 	testall(-0.0, 1.0, ALL_STD_EXCEPT, 0, 1);
1084dc607e7SEnji Cooper 	testall(CMPLXL(0.0, -0.0), CMPLXL(1.0, -0.0), ALL_STD_EXCEPT, 0, 1);
1094dc607e7SEnji Cooper 	testall(CMPLXL(-0.0, -0.0), CMPLXL(1.0, -0.0), ALL_STD_EXCEPT, 0, 1);
1104dc607e7SEnji Cooper }
1114dc607e7SEnji Cooper 
1124dc607e7SEnji Cooper /*
1134dc607e7SEnji Cooper  * Tests for NaN.  The signs of the results are indeterminate unless the
1144dc607e7SEnji Cooper  * imaginary part is 0.
1154dc607e7SEnji Cooper  */
116133bc645SAlex Richardson ATF_TC_WITHOUT_HEAD(nan);
ATF_TC_BODY(nan,tc)117133bc645SAlex Richardson ATF_TC_BODY(nan, tc)
1184dc607e7SEnji Cooper {
119abe427afSEnji Cooper 	unsigned i;
1204dc607e7SEnji Cooper 
1214dc607e7SEnji Cooper 	/* cexp(x + NaNi) = NaN + NaNi and optionally raises invalid */
1224dc607e7SEnji Cooper 	/* cexp(NaN + yi) = NaN + NaNi and optionally raises invalid (|y|>0) */
1234dc607e7SEnji Cooper 	for (i = 0; i < nitems(finites); i++) {
1244dc607e7SEnji Cooper 		testall(CMPLXL(finites[i], NAN), CMPLXL(NAN, NAN),
1254dc607e7SEnji Cooper 			ALL_STD_EXCEPT & ~FE_INVALID, 0, 0);
1264dc607e7SEnji Cooper 		if (finites[i] == 0.0)
1274dc607e7SEnji Cooper 			continue;
1284dc607e7SEnji Cooper 		/* XXX FE_INEXACT shouldn't be raised here */
1294dc607e7SEnji Cooper 		testall(CMPLXL(NAN, finites[i]), CMPLXL(NAN, NAN),
1304dc607e7SEnji Cooper 			ALL_STD_EXCEPT & ~(FE_INVALID | FE_INEXACT), 0, 0);
1314dc607e7SEnji Cooper 	}
1324dc607e7SEnji Cooper 
1334dc607e7SEnji Cooper 	/* cexp(NaN +- 0i) = NaN +- 0i */
1344dc607e7SEnji Cooper 	testall(CMPLXL(NAN, 0.0), CMPLXL(NAN, 0.0), ALL_STD_EXCEPT, 0, 1);
1354dc607e7SEnji Cooper 	testall(CMPLXL(NAN, -0.0), CMPLXL(NAN, -0.0), ALL_STD_EXCEPT, 0, 1);
1364dc607e7SEnji Cooper 
1374dc607e7SEnji Cooper 	/* cexp(inf + NaN i) = inf + nan i */
1384dc607e7SEnji Cooper 	testall(CMPLXL(INFINITY, NAN), CMPLXL(INFINITY, NAN),
1394dc607e7SEnji Cooper 		ALL_STD_EXCEPT, 0, 0);
1404dc607e7SEnji Cooper 	/* cexp(-inf + NaN i) = 0 */
1414dc607e7SEnji Cooper 	testall(CMPLXL(-INFINITY, NAN), CMPLXL(0.0, 0.0),
1424dc607e7SEnji Cooper 		ALL_STD_EXCEPT, 0, 0);
1434dc607e7SEnji Cooper 	/* cexp(NaN + NaN i) = NaN + NaN i */
1444dc607e7SEnji Cooper 	testall(CMPLXL(NAN, NAN), CMPLXL(NAN, NAN),
1454dc607e7SEnji Cooper 		ALL_STD_EXCEPT, 0, 0);
1464dc607e7SEnji Cooper }
1474dc607e7SEnji Cooper 
148133bc645SAlex Richardson ATF_TC_WITHOUT_HEAD(inf);
ATF_TC_BODY(inf,tc)149133bc645SAlex Richardson ATF_TC_BODY(inf, tc)
1504dc607e7SEnji Cooper {
151abe427afSEnji Cooper 	unsigned i;
1524dc607e7SEnji Cooper 
1534dc607e7SEnji Cooper 	/* cexp(x + inf i) = NaN + NaNi and raises invalid */
1544dc607e7SEnji Cooper 	for (i = 0; i < nitems(finites); i++) {
1554dc607e7SEnji Cooper 		testall(CMPLXL(finites[i], INFINITY), CMPLXL(NAN, NAN),
1564dc607e7SEnji Cooper 			ALL_STD_EXCEPT, FE_INVALID, 1);
1574dc607e7SEnji Cooper 	}
1584dc607e7SEnji Cooper 	/* cexp(-inf + yi) = 0 * (cos(y) + sin(y)i) */
1594dc607e7SEnji Cooper 	/* XXX shouldn't raise an inexact exception */
1604dc607e7SEnji Cooper 	testall(CMPLXL(-INFINITY, M_PI_4), CMPLXL(0.0, 0.0),
1614dc607e7SEnji Cooper 		ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
1624dc607e7SEnji Cooper 	testall(CMPLXL(-INFINITY, 3 * M_PI_4), CMPLXL(-0.0, 0.0),
1634dc607e7SEnji Cooper 		ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
1644dc607e7SEnji Cooper 	testall(CMPLXL(-INFINITY, 5 * M_PI_4), CMPLXL(-0.0, -0.0),
1654dc607e7SEnji Cooper 		ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
1664dc607e7SEnji Cooper 	testall(CMPLXL(-INFINITY, 7 * M_PI_4), CMPLXL(0.0, -0.0),
1674dc607e7SEnji Cooper 		ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
1684dc607e7SEnji Cooper 	testall(CMPLXL(-INFINITY, 0.0), CMPLXL(0.0, 0.0),
1694dc607e7SEnji Cooper 		ALL_STD_EXCEPT, 0, 1);
1704dc607e7SEnji Cooper 	testall(CMPLXL(-INFINITY, -0.0), CMPLXL(0.0, -0.0),
1714dc607e7SEnji Cooper 		ALL_STD_EXCEPT, 0, 1);
1724dc607e7SEnji Cooper 	/* cexp(inf + yi) = inf * (cos(y) + sin(y)i) (except y=0) */
1734dc607e7SEnji Cooper 	/* XXX shouldn't raise an inexact exception */
1744dc607e7SEnji Cooper 	testall(CMPLXL(INFINITY, M_PI_4), CMPLXL(INFINITY, INFINITY),
1754dc607e7SEnji Cooper 		ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
1764dc607e7SEnji Cooper 	testall(CMPLXL(INFINITY, 3 * M_PI_4), CMPLXL(-INFINITY, INFINITY),
1774dc607e7SEnji Cooper 		ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
1784dc607e7SEnji Cooper 	testall(CMPLXL(INFINITY, 5 * M_PI_4), CMPLXL(-INFINITY, -INFINITY),
1794dc607e7SEnji Cooper 		ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
1804dc607e7SEnji Cooper 	testall(CMPLXL(INFINITY, 7 * M_PI_4), CMPLXL(INFINITY, -INFINITY),
1814dc607e7SEnji Cooper 		ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
1824dc607e7SEnji Cooper 	/* cexp(inf + 0i) = inf + 0i */
1834dc607e7SEnji Cooper 	testall(CMPLXL(INFINITY, 0.0), CMPLXL(INFINITY, 0.0),
1844dc607e7SEnji Cooper 		ALL_STD_EXCEPT, 0, 1);
1854dc607e7SEnji Cooper 	testall(CMPLXL(INFINITY, -0.0), CMPLXL(INFINITY, -0.0),
1864dc607e7SEnji Cooper 		ALL_STD_EXCEPT, 0, 1);
1874dc607e7SEnji Cooper }
1884dc607e7SEnji Cooper 
189133bc645SAlex Richardson ATF_TC_WITHOUT_HEAD(reals);
ATF_TC_BODY(reals,tc)190133bc645SAlex Richardson ATF_TC_BODY(reals, tc)
1914dc607e7SEnji Cooper {
192abe427afSEnji Cooper 	unsigned i;
1934dc607e7SEnji Cooper 
1944dc607e7SEnji Cooper 	for (i = 0; i < nitems(finites); i++) {
1954dc607e7SEnji Cooper 		/* XXX could check exceptions more meticulously */
1964dc607e7SEnji Cooper 		test(cexp, CMPLXL(finites[i], 0.0),
1974dc607e7SEnji Cooper 		     CMPLXL(exp(finites[i]), 0.0),
1984dc607e7SEnji Cooper 		     FE_INVALID | FE_DIVBYZERO, 0, 1);
1994dc607e7SEnji Cooper 		test(cexp, CMPLXL(finites[i], -0.0),
2004dc607e7SEnji Cooper 		     CMPLXL(exp(finites[i]), -0.0),
2014dc607e7SEnji Cooper 		     FE_INVALID | FE_DIVBYZERO, 0, 1);
202740890beSDimitry Andric 		test_f(cexpf, CMPLXL(finites[i], 0.0),
2034dc607e7SEnji Cooper 		     CMPLXL(expf(finites[i]), 0.0),
2044dc607e7SEnji Cooper 		     FE_INVALID | FE_DIVBYZERO, 0, 1);
205740890beSDimitry Andric 		test_f(cexpf, CMPLXL(finites[i], -0.0),
2064dc607e7SEnji Cooper 		     CMPLXL(expf(finites[i]), -0.0),
2074dc607e7SEnji Cooper 		     FE_INVALID | FE_DIVBYZERO, 0, 1);
2084dc607e7SEnji Cooper 	}
2094dc607e7SEnji Cooper }
2104dc607e7SEnji Cooper 
211133bc645SAlex Richardson ATF_TC_WITHOUT_HEAD(imaginaries);
ATF_TC_BODY(imaginaries,tc)212133bc645SAlex Richardson ATF_TC_BODY(imaginaries, tc)
2134dc607e7SEnji Cooper {
214abe427afSEnji Cooper 	unsigned i;
2154dc607e7SEnji Cooper 
2164dc607e7SEnji Cooper 	for (i = 0; i < nitems(finites); i++) {
2174dc607e7SEnji Cooper 		test(cexp, CMPLXL(0.0, finites[i]),
2184dc607e7SEnji Cooper 		     CMPLXL(cos(finites[i]), sin(finites[i])),
2194dc607e7SEnji Cooper 		     ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
2204dc607e7SEnji Cooper 		test(cexp, CMPLXL(-0.0, finites[i]),
2214dc607e7SEnji Cooper 		     CMPLXL(cos(finites[i]), sin(finites[i])),
2224dc607e7SEnji Cooper 		     ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
223740890beSDimitry Andric 		test_f(cexpf, CMPLXL(0.0, finites[i]),
2244dc607e7SEnji Cooper 		     CMPLXL(cosf(finites[i]), sinf(finites[i])),
2254dc607e7SEnji Cooper 		     ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
226740890beSDimitry Andric 		test_f(cexpf, CMPLXL(-0.0, finites[i]),
2274dc607e7SEnji Cooper 		     CMPLXL(cosf(finites[i]), sinf(finites[i])),
2284dc607e7SEnji Cooper 		     ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
2294dc607e7SEnji Cooper 	}
2304dc607e7SEnji Cooper }
2314dc607e7SEnji Cooper 
232133bc645SAlex Richardson ATF_TC_WITHOUT_HEAD(small);
ATF_TC_BODY(small,tc)233133bc645SAlex Richardson ATF_TC_BODY(small, tc)
2344dc607e7SEnji Cooper {
2354dc607e7SEnji Cooper 	static const double tests[] = {
2364dc607e7SEnji Cooper 	     /* csqrt(a + bI) = x + yI */
2374dc607e7SEnji Cooper 	     /* a	b	x			y */
2384dc607e7SEnji Cooper 		 1.0,	M_PI_4,	M_SQRT2 * 0.5 * M_E,	M_SQRT2 * 0.5 * M_E,
2394dc607e7SEnji Cooper 		-1.0,	M_PI_4,	M_SQRT2 * 0.5 / M_E,	M_SQRT2 * 0.5 / M_E,
2404dc607e7SEnji Cooper 		 2.0,	M_PI_2,	0.0,			M_E * M_E,
2414dc607e7SEnji Cooper 		 M_LN2,	M_PI,	-2.0,			0.0,
2424dc607e7SEnji Cooper 	};
2434dc607e7SEnji Cooper 	double a, b;
2444dc607e7SEnji Cooper 	double x, y;
245abe427afSEnji Cooper 	unsigned i;
2464dc607e7SEnji Cooper 
2474dc607e7SEnji Cooper 	for (i = 0; i < nitems(tests); i += 4) {
2484dc607e7SEnji Cooper 		a = tests[i];
2494dc607e7SEnji Cooper 		b = tests[i + 1];
2504dc607e7SEnji Cooper 		x = tests[i + 2];
2514dc607e7SEnji Cooper 		y = tests[i + 3];
2524dc607e7SEnji Cooper 		test_tol(cexp, CMPLXL(a, b), CMPLXL(x, y), 3 * DBL_ULP());
2534dc607e7SEnji Cooper 
2544dc607e7SEnji Cooper 		/* float doesn't have enough precision to pass these tests */
2554dc607e7SEnji Cooper 		if (x == 0 || y == 0)
2564dc607e7SEnji Cooper 			continue;
2574dc607e7SEnji Cooper 		test_tol(cexpf, CMPLXL(a, b), CMPLXL(x, y), 1 * FLT_ULP());
2584dc607e7SEnji Cooper         }
2594dc607e7SEnji Cooper }
2604dc607e7SEnji Cooper 
2614dc607e7SEnji Cooper /* Test inputs with a real part r that would overflow exp(r). */
262133bc645SAlex Richardson ATF_TC_WITHOUT_HEAD(large);
ATF_TC_BODY(large,tc)263133bc645SAlex Richardson ATF_TC_BODY(large, tc)
2644dc607e7SEnji Cooper {
2654dc607e7SEnji Cooper 
2664dc607e7SEnji Cooper 	test_tol(cexp, CMPLXL(709.79, 0x1p-1074),
2674dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 8.94674309915433533273e-16), DBL_ULP());
2684dc607e7SEnji Cooper 	test_tol(cexp, CMPLXL(1000, 0x1p-1074),
2694dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 9.73344457300016401328e+110), DBL_ULP());
2704dc607e7SEnji Cooper 	test_tol(cexp, CMPLXL(1400, 0x1p-1074),
2714dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 5.08228858149196559681e+284), DBL_ULP());
2724dc607e7SEnji Cooper 	test_tol(cexp, CMPLXL(900, 0x1.23456789abcdep-1020),
2734dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 7.42156649354218408074e+83), DBL_ULP());
2744dc607e7SEnji Cooper 	test_tol(cexp, CMPLXL(1300, 0x1.23456789abcdep-1020),
2754dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 3.87514844965996756704e+257), DBL_ULP());
2764dc607e7SEnji Cooper 
2774dc607e7SEnji Cooper 	test_tol(cexpf, CMPLXL(88.73, 0x1p-149),
2784dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 4.80265603e-07), 2 * FLT_ULP());
2794dc607e7SEnji Cooper 	test_tol(cexpf, CMPLXL(90, 0x1p-149),
2804dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 1.7101492622e-06f), 2 * FLT_ULP());
2814dc607e7SEnji Cooper 	test_tol(cexpf, CMPLXL(192, 0x1p-149),
2824dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 3.396809344e+38f), 2 * FLT_ULP());
2834dc607e7SEnji Cooper 	test_tol(cexpf, CMPLXL(120, 0x1.234568p-120),
2844dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 1.1163382522e+16f), 2 * FLT_ULP());
2854dc607e7SEnji Cooper 	test_tol(cexpf, CMPLXL(170, 0x1.234568p-120),
2864dc607e7SEnji Cooper 		 CMPLXL(INFINITY, 5.7878851079e+37f), 2 * FLT_ULP());
2874dc607e7SEnji Cooper }
2884dc607e7SEnji Cooper 
ATF_TP_ADD_TCS(tp)289133bc645SAlex Richardson ATF_TP_ADD_TCS(tp)
2904dc607e7SEnji Cooper {
291133bc645SAlex Richardson 	ATF_TP_ADD_TC(tp, zero);
292133bc645SAlex Richardson 	ATF_TP_ADD_TC(tp, nan);
293133bc645SAlex Richardson 	ATF_TP_ADD_TC(tp, inf);
294133bc645SAlex Richardson 	ATF_TP_ADD_TC(tp, reals);
295133bc645SAlex Richardson 	ATF_TP_ADD_TC(tp, imaginaries);
296133bc645SAlex Richardson 	ATF_TP_ADD_TC(tp, small);
297133bc645SAlex Richardson 	ATF_TP_ADD_TC(tp, large);
2984dc607e7SEnji Cooper 
299133bc645SAlex Richardson 	return (atf_no_error());
3004dc607e7SEnji Cooper }
301