xref: /netbsd-src/tests/lib/libm/t_exp.c (revision a00f9ab046124bbf3081dffae806f57bb67807b9)
1 /* $NetBSD: t_exp.c,v 1.5 2014/03/03 10:39:08 martin Exp $ */
2 
3 /*-
4  * Copyright (c) 2011 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Jukka Ruohonen.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #include <atf-c.h>
33 #include <math.h>
34 
35 /* y = exp(x) */
36 static const struct {
37 	double x;
38 	double y;
39 	double e;
40 } exp_values[] = {
41 	{  -10, 0.4539992976248485e-4, 1e-4, },
42 	{   -5, 0.6737946999085467e-2, 1e-2, },
43 	{   -1, 0.3678794411714423,    1e-1, },
44 	{ -0.1, 0.9048374180359595,    1e-1, },
45 	{    0, 1.0000000000000000,    1,    },
46 	{  0.1, 1.1051709180756477,    1,    },
47 	{    1, 2.7182818284590452,    1,    },
48 	{    5, 148.41315910257660,    1e2, },
49 	{   10, 22026.465794806718,    1e4, },
50 };
51 
52 /*
53  * exp2(3)
54  */
55 ATF_TC(exp2_nan);
56 ATF_TC_HEAD(exp2_nan, tc)
57 {
58 	atf_tc_set_md_var(tc, "descr", "Test exp2(NaN) == NaN");
59 }
60 
61 ATF_TC_BODY(exp2_nan, tc)
62 {
63 	const double x = 0.0L / 0.0L;
64 
65 	if (isnan(exp2(x)) == 0)
66 		atf_tc_fail_nonfatal("exp2(NaN) != NaN");
67 }
68 
69 ATF_TC(exp2_inf_neg);
70 ATF_TC_HEAD(exp2_inf_neg, tc)
71 {
72 	atf_tc_set_md_var(tc, "descr", "Test exp2(-Inf) == +0.0");
73 }
74 
75 ATF_TC_BODY(exp2_inf_neg, tc)
76 {
77 	const double x = -1.0L / 0.0L;
78 	double y = exp2(x);
79 
80 	if (fabs(y) > 0.0 || signbit(y) != 0)
81 		atf_tc_fail_nonfatal("exp2(-Inf) != +0.0");
82 }
83 
84 ATF_TC(exp2_inf_pos);
85 ATF_TC_HEAD(exp2_inf_pos, tc)
86 {
87 	atf_tc_set_md_var(tc, "descr", "Test exp2(+Inf) == +Inf");
88 }
89 
90 ATF_TC_BODY(exp2_inf_pos, tc)
91 {
92 	const double x = 1.0L / 0.0L;
93 	double y = exp2(x);
94 
95 	if (isinf(y) == 0 || signbit(y) != 0)
96 		atf_tc_fail_nonfatal("exp2(+Inf) != +Inf");
97 }
98 
99 ATF_TC(exp2_product);
100 ATF_TC_HEAD(exp2_product, tc)
101 {
102 	atf_tc_set_md_var(tc, "descr", "Test exp2(x + y) == exp2(x) * exp2(y)");
103 }
104 
105 ATF_TC_BODY(exp2_product, tc)
106 {
107 	const double x[] = { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 };
108 	const double y[] = { 8.8, 7.7, 6.6, 5.5, 4.4, 3.3, 2.2, 1.1, 0.0 };
109 	const double eps = 1.0e-11;
110 	size_t i;
111 
112 	for (i = 0; i < __arraycount(x); i++) {
113 
114 		if (fabs(exp2(x[i] + y[i]) - (exp2(x[i]) * exp2(y[i]))) > eps)
115 			atf_tc_fail_nonfatal("exp2(%0.01f + %0.01f) != exp2("
116 			    "%0.01f) * exp2(%0.01f)", x[i], y[i], x[i], y[i]);
117 	}
118 }
119 
120 ATF_TC(exp2_zero_neg);
121 ATF_TC_HEAD(exp2_zero_neg, tc)
122 {
123 	atf_tc_set_md_var(tc, "descr", "Test exp2(-0.0) == 1.0");
124 }
125 
126 ATF_TC_BODY(exp2_zero_neg, tc)
127 {
128 	const double x = -0.0L;
129 
130 	if (fabs(exp2(x) - 1.0) > 0.0)
131 		atf_tc_fail_nonfatal("exp2(-0.0) != 1.0");
132 }
133 
134 ATF_TC(exp2_zero_pos);
135 ATF_TC_HEAD(exp2_zero_pos, tc)
136 {
137 	atf_tc_set_md_var(tc, "descr", "Test exp2(+0.0) == 1.0");
138 }
139 
140 ATF_TC_BODY(exp2_zero_pos, tc)
141 {
142 	const double x = 0.0L;
143 
144 	if (fabs(exp2(x) - 1.0) > 0.0)
145 		atf_tc_fail_nonfatal("exp2(+0.0) != 1.0");
146 }
147 
148 /*
149  * exp2f(3)
150  */
151 ATF_TC(exp2f_nan);
152 ATF_TC_HEAD(exp2f_nan, tc)
153 {
154 	atf_tc_set_md_var(tc, "descr", "Test exp2f(NaN) == NaN");
155 }
156 
157 ATF_TC_BODY(exp2f_nan, tc)
158 {
159 	const float x = 0.0L / 0.0L;
160 
161 	if (isnan(exp2f(x)) == 0)
162 		atf_tc_fail_nonfatal("exp2f(NaN) != NaN");
163 }
164 
165 ATF_TC(exp2f_inf_neg);
166 ATF_TC_HEAD(exp2f_inf_neg, tc)
167 {
168 	atf_tc_set_md_var(tc, "descr", "Test exp2f(-Inf) == +0.0");
169 }
170 
171 ATF_TC_BODY(exp2f_inf_neg, tc)
172 {
173 	const float x = -1.0L / 0.0L;
174 	float y = exp2f(x);
175 
176 	if (fabsf(y) > 0.0 || signbit(y) != 0)
177 		atf_tc_fail_nonfatal("exp2f(-Inf) != +0.0");
178 }
179 
180 ATF_TC(exp2f_inf_pos);
181 ATF_TC_HEAD(exp2f_inf_pos, tc)
182 {
183 	atf_tc_set_md_var(tc, "descr", "Test exp2f(+Inf) == +Inf");
184 }
185 
186 ATF_TC_BODY(exp2f_inf_pos, tc)
187 {
188 	const float x = 1.0L / 0.0L;
189 	float y = exp2f(x);
190 
191 	if (isinf(y) == 0 || signbit(y) != 0)
192 		atf_tc_fail_nonfatal("exp2f(+Inf) != +Inf");
193 }
194 
195 ATF_TC(exp2f_product);
196 ATF_TC_HEAD(exp2f_product, tc)
197 {
198 	atf_tc_set_md_var(tc, "descr", "Test exp2f(x+y) == exp2f(x) * exp2f(y)");
199 }
200 
201 ATF_TC_BODY(exp2f_product, tc)
202 {
203 	const float x[] = { 0.0, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 };
204 	const float y[] = { 8.8, 7.7, 6.6, 5.5, 4.4, 3.3, 2.2, 1.1, 0.0 };
205 	const float eps = 1.0e-2;
206 	size_t i;
207 
208 	for (i = 0; i < __arraycount(x); i++) {
209 
210 		if (fabsf(exp2f(x[i] + y[i]) -
211 			(exp2f(x[i]) * exp2f(y[i]))) > eps)
212 			atf_tc_fail_nonfatal("exp2f(%0.01f + %0.01f) != exp2f("
213 			    "%0.01f) * exp2f(%0.01f)", x[i], y[i], x[i], y[i]);
214 	}
215 }
216 
217 ATF_TC(exp2f_zero_neg);
218 ATF_TC_HEAD(exp2f_zero_neg, tc)
219 {
220 	atf_tc_set_md_var(tc, "descr", "Test exp2f(-0.0) == 1.0");
221 }
222 
223 ATF_TC_BODY(exp2f_zero_neg, tc)
224 {
225 	const float x = -0.0L;
226 
227 	if (fabsf(exp2f(x) - 1.0f) > 0.0)
228 		atf_tc_fail_nonfatal("exp2f(-0.0) != 1.0");
229 }
230 
231 ATF_TC(exp2f_zero_pos);
232 ATF_TC_HEAD(exp2f_zero_pos, tc)
233 {
234 	atf_tc_set_md_var(tc, "descr", "Test exp2f(+0.0) == 1.0");
235 }
236 
237 ATF_TC_BODY(exp2f_zero_pos, tc)
238 {
239 	const float x = 0.0L;
240 
241 	if (fabsf(exp2f(x) - 1.0f) > 0.0)
242 		atf_tc_fail_nonfatal("exp2f(+0.0) != 1.0");
243 }
244 
245 /*
246  * exp(3)
247  */
248 ATF_TC(exp_nan);
249 ATF_TC_HEAD(exp_nan, tc)
250 {
251 	atf_tc_set_md_var(tc, "descr", "Test exp(NaN) == NaN");
252 }
253 
254 ATF_TC_BODY(exp_nan, tc)
255 {
256 	const double x = 0.0L / 0.0L;
257 
258 	if (isnan(exp(x)) == 0)
259 		atf_tc_fail_nonfatal("exp(NaN) != NaN");
260 }
261 
262 ATF_TC(exp_inf_neg);
263 ATF_TC_HEAD(exp_inf_neg, tc)
264 {
265 	atf_tc_set_md_var(tc, "descr", "Test exp(-Inf) == +0.0");
266 }
267 
268 ATF_TC_BODY(exp_inf_neg, tc)
269 {
270 	const double x = -1.0L / 0.0L;
271 	double y = exp(x);
272 
273 	if (fabs(y) > 0.0 || signbit(y) != 0)
274 		atf_tc_fail_nonfatal("exp(-Inf) != +0.0");
275 }
276 
277 ATF_TC(exp_inf_pos);
278 ATF_TC_HEAD(exp_inf_pos, tc)
279 {
280 	atf_tc_set_md_var(tc, "descr", "Test exp(+Inf) == +Inf");
281 }
282 
283 ATF_TC_BODY(exp_inf_pos, tc)
284 {
285 	const double x = 1.0L / 0.0L;
286 	double y = exp(x);
287 
288 	if (isinf(y) == 0 || signbit(y) != 0)
289 		atf_tc_fail_nonfatal("exp(+Inf) != +Inf");
290 }
291 
292 ATF_TC(exp_product);
293 ATF_TC_HEAD(exp_product, tc)
294 {
295 	atf_tc_set_md_var(tc, "descr", "Test some selected exp(x)");
296 }
297 
298 ATF_TC_BODY(exp_product, tc)
299 {
300 	double eps;
301 	double x;
302 	double y;
303 	size_t i;
304 
305 	for (i = 0; i < __arraycount(exp_values); i++) {
306 		x = exp_values[i].x;
307 		y = exp_values[i].y;
308 		eps = 1e-15 * exp_values[i].e;
309 
310 		if (fabs(exp(x) - y) > eps)
311 			atf_tc_fail_nonfatal("exp(%0.01f) != %18.18e", x, y);
312 	}
313 }
314 
315 ATF_TC(exp_zero_neg);
316 ATF_TC_HEAD(exp_zero_neg, tc)
317 {
318 	atf_tc_set_md_var(tc, "descr", "Test exp(-0.0) == 1.0");
319 }
320 
321 ATF_TC_BODY(exp_zero_neg, tc)
322 {
323 	const double x = -0.0L;
324 
325 	if (fabs(exp(x) - 1.0) > 0.0)
326 		atf_tc_fail_nonfatal("exp(-0.0) != 1.0");
327 }
328 
329 ATF_TC(exp_zero_pos);
330 ATF_TC_HEAD(exp_zero_pos, tc)
331 {
332 	atf_tc_set_md_var(tc, "descr", "Test exp(+0.0) == 1.0");
333 }
334 
335 ATF_TC_BODY(exp_zero_pos, tc)
336 {
337 	const double x = 0.0L;
338 
339 	if (fabs(exp(x) - 1.0) > 0.0)
340 		atf_tc_fail_nonfatal("exp(+0.0) != 1.0");
341 }
342 
343 /*
344  * expf(3)
345  */
346 ATF_TC(expf_nan);
347 ATF_TC_HEAD(expf_nan, tc)
348 {
349 	atf_tc_set_md_var(tc, "descr", "Test expf(NaN) == NaN");
350 }
351 
352 ATF_TC_BODY(expf_nan, tc)
353 {
354 	const float x = 0.0L / 0.0L;
355 
356 	if (isnan(expf(x)) == 0)
357 		atf_tc_fail_nonfatal("expf(NaN) != NaN");
358 }
359 
360 ATF_TC(expf_inf_neg);
361 ATF_TC_HEAD(expf_inf_neg, tc)
362 {
363 	atf_tc_set_md_var(tc, "descr", "Test expf(-Inf) == +0.0");
364 }
365 
366 ATF_TC_BODY(expf_inf_neg, tc)
367 {
368 	const float x = -1.0L / 0.0L;
369 	float y = expf(x);
370 
371 	if (fabsf(y) > 0.0 || signbit(y) != 0)
372 		atf_tc_fail_nonfatal("expf(-Inf) != +0.0");
373 }
374 
375 ATF_TC(expf_inf_pos);
376 ATF_TC_HEAD(expf_inf_pos, tc)
377 {
378 	atf_tc_set_md_var(tc, "descr", "Test expf(+Inf) == +Inf");
379 }
380 
381 ATF_TC_BODY(expf_inf_pos, tc)
382 {
383 	const float x = 1.0L / 0.0L;
384 	float y = expf(x);
385 
386 	if (isinf(y) == 0 || signbit(y) != 0)
387 		atf_tc_fail_nonfatal("expf(+Inf) != +Inf");
388 }
389 
390 ATF_TC(expf_product);
391 ATF_TC_HEAD(expf_product, tc)
392 {
393 	atf_tc_set_md_var(tc, "descr", "Test some selected expf(x)");
394 }
395 
396 ATF_TC_BODY(expf_product, tc)
397 {
398 	float eps;
399 	float x;
400 	float y;
401 	size_t i;
402 
403 	for (i = 0; i < __arraycount(exp_values); i++) {
404 		x = exp_values[i].x;
405 		y = exp_values[i].y;
406 		eps = 1e-6 * exp_values[i].e;
407 
408 		if (fabsf(expf(x) - y) > eps)
409 			atf_tc_fail_nonfatal("expf(%0.01f) != %18.18e", x, y);
410 	}
411 }
412 
413 ATF_TC(expf_zero_neg);
414 ATF_TC_HEAD(expf_zero_neg, tc)
415 {
416 	atf_tc_set_md_var(tc, "descr", "Test expf(-0.0) == 1.0");
417 }
418 
419 ATF_TC_BODY(expf_zero_neg, tc)
420 {
421 	const float x = -0.0L;
422 
423 	if (fabsf(expf(x) - 1.0f) > 0.0)
424 		atf_tc_fail_nonfatal("expf(-0.0) != 1.0");
425 }
426 
427 ATF_TC(expf_zero_pos);
428 ATF_TC_HEAD(expf_zero_pos, tc)
429 {
430 	atf_tc_set_md_var(tc, "descr", "Test expf(+0.0) == 1.0");
431 }
432 
433 ATF_TC_BODY(expf_zero_pos, tc)
434 {
435 	const float x = 0.0L;
436 
437 	if (fabsf(expf(x) - 1.0f) > 0.0)
438 		atf_tc_fail_nonfatal("expf(+0.0) != 1.0");
439 }
440 
441 /*
442  * expm1(3)
443  */
444 ATF_TC(expm1_nan);
445 ATF_TC_HEAD(expm1_nan, tc)
446 {
447 	atf_tc_set_md_var(tc, "descr", "Test expm1(NaN) == NaN");
448 }
449 
450 ATF_TC_BODY(expm1_nan, tc)
451 {
452 	const double x = 0.0L / 0.0L;
453 
454 	if (isnan(expm1(x)) == 0)
455 		atf_tc_fail_nonfatal("expm1(NaN) != NaN");
456 }
457 
458 ATF_TC(expm1_inf_neg);
459 ATF_TC_HEAD(expm1_inf_neg, tc)
460 {
461 	atf_tc_set_md_var(tc, "descr", "Test expm1(-Inf) == -1");
462 }
463 
464 ATF_TC_BODY(expm1_inf_neg, tc)
465 {
466 	const double x = -1.0L / 0.0L;
467 
468 	if (expm1(x) != -1.0)
469 		atf_tc_fail_nonfatal("expm1(-Inf) != -1.0");
470 }
471 
472 ATF_TC(expm1_inf_pos);
473 ATF_TC_HEAD(expm1_inf_pos, tc)
474 {
475 	atf_tc_set_md_var(tc, "descr", "Test expm1(+Inf) == +Inf");
476 }
477 
478 ATF_TC_BODY(expm1_inf_pos, tc)
479 {
480 	const double x = 1.0L / 0.0L;
481 	double y = expm1(x);
482 
483 	if (isinf(y) == 0 || signbit(y) != 0)
484 		atf_tc_fail_nonfatal("expm1(+Inf) != +Inf");
485 }
486 
487 ATF_TC(expm1_zero_neg);
488 ATF_TC_HEAD(expm1_zero_neg, tc)
489 {
490 	atf_tc_set_md_var(tc, "descr", "Test expm1(-0.0) == -0.0");
491 }
492 
493 ATF_TC_BODY(expm1_zero_neg, tc)
494 {
495 	const double x = -0.0L;
496 	double y = expm1(x);
497 
498 	if (fabs(y) > 0.0 || signbit(y) == 0)
499 		atf_tc_fail_nonfatal("expm1(-0.0) != -0.0");
500 }
501 
502 ATF_TC(expm1_zero_pos);
503 ATF_TC_HEAD(expm1_zero_pos, tc)
504 {
505 	atf_tc_set_md_var(tc, "descr", "Test expm1(+0.0) == 1.0");
506 }
507 
508 ATF_TC_BODY(expm1_zero_pos, tc)
509 {
510 	const double x = 0.0L;
511 	double y = expm1(x);
512 
513 	if (fabs(y) > 0.0 || signbit(y) != 0)
514 		atf_tc_fail_nonfatal("expm1(+0.0) != +0.0");
515 }
516 
517 /*
518  * expm1f(3)
519  */
520 ATF_TC(expm1f_nan);
521 ATF_TC_HEAD(expm1f_nan, tc)
522 {
523 	atf_tc_set_md_var(tc, "descr", "Test expm1f(NaN) == NaN");
524 }
525 
526 ATF_TC_BODY(expm1f_nan, tc)
527 {
528 	const float x = 0.0L / 0.0L;
529 
530 	if (isnan(expm1f(x)) == 0)
531 		atf_tc_fail_nonfatal("expm1f(NaN) != NaN");
532 }
533 
534 ATF_TC(expm1f_inf_neg);
535 ATF_TC_HEAD(expm1f_inf_neg, tc)
536 {
537 	atf_tc_set_md_var(tc, "descr", "Test expm1f(-Inf) == -1");
538 }
539 
540 ATF_TC_BODY(expm1f_inf_neg, tc)
541 {
542 	const float x = -1.0L / 0.0L;
543 
544 	if (expm1f(x) != -1.0)
545 		atf_tc_fail_nonfatal("expm1f(-Inf) != -1.0");
546 }
547 
548 ATF_TC(expm1f_inf_pos);
549 ATF_TC_HEAD(expm1f_inf_pos, tc)
550 {
551 	atf_tc_set_md_var(tc, "descr", "Test expm1f(+Inf) == +Inf");
552 }
553 
554 ATF_TC_BODY(expm1f_inf_pos, tc)
555 {
556 	const float x = 1.0L / 0.0L;
557 	float y = expm1f(x);
558 
559 	if (isinf(y) == 0 || signbit(y) != 0)
560 		atf_tc_fail_nonfatal("expm1f(+Inf) != +Inf");
561 }
562 
563 ATF_TC(expm1f_zero_neg);
564 ATF_TC_HEAD(expm1f_zero_neg, tc)
565 {
566 	atf_tc_set_md_var(tc, "descr", "Test expm1f(-0.0) == -0.0");
567 }
568 
569 ATF_TC_BODY(expm1f_zero_neg, tc)
570 {
571 	const float x = -0.0L;
572 	float y = expm1f(x);
573 
574 	if (fabsf(y) > 0.0 || signbit(y) == 0)
575 		atf_tc_fail_nonfatal("expm1f(-0.0) != -0.0");
576 }
577 
578 ATF_TC(expm1f_zero_pos);
579 ATF_TC_HEAD(expm1f_zero_pos, tc)
580 {
581 	atf_tc_set_md_var(tc, "descr", "Test expm1f(+0.0) == 1.0");
582 }
583 
584 ATF_TC_BODY(expm1f_zero_pos, tc)
585 {
586 	const float x = 0.0L;
587 	float y = expm1f(x);
588 
589 	if (fabsf(y) > 0.0 || signbit(y) != 0)
590 		atf_tc_fail_nonfatal("expm1f(+0.0) != +0.0");
591 }
592 
593 ATF_TP_ADD_TCS(tp)
594 {
595 
596 	ATF_TP_ADD_TC(tp, exp2_nan);
597 	ATF_TP_ADD_TC(tp, exp2_inf_neg);
598 	ATF_TP_ADD_TC(tp, exp2_inf_pos);
599 	ATF_TP_ADD_TC(tp, exp2_product);
600 	ATF_TP_ADD_TC(tp, exp2_zero_neg);
601 	ATF_TP_ADD_TC(tp, exp2_zero_pos);
602 
603 	ATF_TP_ADD_TC(tp, exp2f_nan);
604 	ATF_TP_ADD_TC(tp, exp2f_inf_neg);
605 	ATF_TP_ADD_TC(tp, exp2f_inf_pos);
606 	ATF_TP_ADD_TC(tp, exp2f_product);
607 	ATF_TP_ADD_TC(tp, exp2f_zero_neg);
608 	ATF_TP_ADD_TC(tp, exp2f_zero_pos);
609 
610 	ATF_TP_ADD_TC(tp, exp_nan);
611 	ATF_TP_ADD_TC(tp, exp_inf_neg);
612 	ATF_TP_ADD_TC(tp, exp_inf_pos);
613 	ATF_TP_ADD_TC(tp, exp_product);
614 	ATF_TP_ADD_TC(tp, exp_zero_neg);
615 	ATF_TP_ADD_TC(tp, exp_zero_pos);
616 
617 	ATF_TP_ADD_TC(tp, expf_nan);
618 	ATF_TP_ADD_TC(tp, expf_inf_neg);
619 	ATF_TP_ADD_TC(tp, expf_inf_pos);
620 	ATF_TP_ADD_TC(tp, expf_product);
621 	ATF_TP_ADD_TC(tp, expf_zero_neg);
622 	ATF_TP_ADD_TC(tp, expf_zero_pos);
623 
624 	ATF_TP_ADD_TC(tp, expm1_nan);
625 	ATF_TP_ADD_TC(tp, expm1_inf_neg);
626 	ATF_TP_ADD_TC(tp, expm1_inf_pos);
627 	ATF_TP_ADD_TC(tp, expm1_zero_neg);
628 	ATF_TP_ADD_TC(tp, expm1_zero_pos);
629 
630 	ATF_TP_ADD_TC(tp, expm1f_nan);
631 	ATF_TP_ADD_TC(tp, expm1f_inf_neg);
632 	ATF_TP_ADD_TC(tp, expm1f_inf_pos);
633 	ATF_TP_ADD_TC(tp, expm1f_zero_neg);
634 	ATF_TP_ADD_TC(tp, expm1f_zero_pos);
635 
636 	return atf_no_error();
637 }
638