tools/llvm: Do not build with symbols
[minix3.git] / tests / lib / libm / t_log.c
blob4d03443bd7297bfe8742665b118a622858bec77f
1 /* $NetBSD: t_log.c,v 1.8 2012/04/08 09:36:04 jruoho Exp $ */
3 /*-
4 * Copyright (c) 2011 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jukka Ruohonen.
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.
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.
31 #include <sys/cdefs.h>
32 __RCSID("$NetBSD: t_log.c,v 1.8 2012/04/08 09:36:04 jruoho Exp $");
34 #include <atf-c.h>
35 #include <atf-c/config.h>
37 #include <math.h>
38 #include <stdio.h>
39 #include <string.h>
42 * log10(3)
44 ATF_TC(log10_base);
45 ATF_TC_HEAD(log10_base, tc)
47 atf_tc_set_md_var(tc, "descr", "Test log10(10) == 1");
50 ATF_TC_BODY(log10_base, tc)
52 ATF_CHECK(log10(10.0) == 1.0);
55 ATF_TC(log10_nan);
56 ATF_TC_HEAD(log10_nan, tc)
58 atf_tc_set_md_var(tc, "descr", "Test log10(NaN) == NaN");
61 ATF_TC_BODY(log10_nan, tc)
63 #ifndef __vax__
64 const double x = 0.0L / 0.0L;
66 ATF_CHECK(isnan(x) != 0);
67 ATF_CHECK(isnan(log10(x)) != 0);
68 #endif
71 ATF_TC(log10_inf_neg);
72 ATF_TC_HEAD(log10_inf_neg, tc)
74 atf_tc_set_md_var(tc, "descr", "Test log10(-Inf) == NaN");
77 ATF_TC_BODY(log10_inf_neg, tc)
79 #ifndef __vax__
80 const double x = -1.0L / 0.0L;
81 const double y = log10(x);
83 ATF_CHECK(isnan(y) != 0);
84 #endif
87 ATF_TC(log10_inf_pos);
88 ATF_TC_HEAD(log10_inf_pos, tc)
90 atf_tc_set_md_var(tc, "descr", "Test log10(+Inf) == +Inf");
93 ATF_TC_BODY(log10_inf_pos, tc)
95 #ifndef __vax__
96 const double x = 1.0L / 0.0L;
98 ATF_CHECK(log10(x) == x);
99 #endif
102 ATF_TC(log10_one_pos);
103 ATF_TC_HEAD(log10_one_pos, tc)
105 atf_tc_set_md_var(tc, "descr", "Test log10(1.0) == +0.0");
108 ATF_TC_BODY(log10_one_pos, tc)
110 #ifndef __vax__
111 const double x = log10(1.0);
112 const double y = 0.0L;
114 ATF_CHECK(x == y);
115 ATF_CHECK(signbit(x) == 0);
116 ATF_CHECK(signbit(y) == 0);
117 #endif
120 ATF_TC(log10_zero_neg);
121 ATF_TC_HEAD(log10_zero_neg, tc)
123 atf_tc_set_md_var(tc, "descr", "Test log10(-0.0) == -HUGE_VAL");
126 ATF_TC_BODY(log10_zero_neg, tc)
128 #ifndef __vax__
129 const double x = -0.0L;
131 ATF_CHECK(log10(x) == -HUGE_VAL);
132 #endif
135 ATF_TC(log10_zero_pos);
136 ATF_TC_HEAD(log10_zero_pos, tc)
138 atf_tc_set_md_var(tc, "descr", "Test log10(+0.0) == -HUGE_VAL");
141 ATF_TC_BODY(log10_zero_pos, tc)
143 #ifndef __vax__
144 const double x = 0.0L;
146 ATF_CHECK(log10(x) == -HUGE_VAL);
147 #endif
151 * log10f(3)
153 ATF_TC(log10f_base);
154 ATF_TC_HEAD(log10f_base, tc)
156 atf_tc_set_md_var(tc, "descr", "Test log10f(10) == 1");
159 ATF_TC_BODY(log10f_base, tc)
161 ATF_CHECK(log10f(10.0) == 1.0);
164 ATF_TC(log10f_nan);
165 ATF_TC_HEAD(log10f_nan, tc)
167 atf_tc_set_md_var(tc, "descr", "Test log10f(NaN) == NaN");
170 ATF_TC_BODY(log10f_nan, tc)
172 #ifndef __vax__
173 const float x = 0.0L / 0.0L;
175 ATF_CHECK(isnan(x) != 0);
176 ATF_CHECK(isnan(log10f(x)) != 0);
177 #endif
180 ATF_TC(log10f_inf_neg);
181 ATF_TC_HEAD(log10f_inf_neg, tc)
183 atf_tc_set_md_var(tc, "descr", "Test log10f(-Inf) == NaN");
186 ATF_TC_BODY(log10f_inf_neg, tc)
188 #ifndef __vax__
189 const float x = -1.0L / 0.0L;
190 const float y = log10f(x);
192 ATF_CHECK(isnan(y) != 0);
193 #endif
196 ATF_TC(log10f_inf_pos);
197 ATF_TC_HEAD(log10f_inf_pos, tc)
199 atf_tc_set_md_var(tc, "descr", "Test log10f(+Inf) == +Inf");
202 ATF_TC_BODY(log10f_inf_pos, tc)
204 #ifndef __vax__
205 const float x = 1.0L / 0.0L;
207 if (strcmp(atf_config_get("atf_arch"), "alpha") == 0)
208 atf_tc_expect_fail("PR port-alpha/46301");
210 ATF_CHECK(log10f(x) == x);
211 #endif
214 ATF_TC(log10f_one_pos);
215 ATF_TC_HEAD(log10f_one_pos, tc)
217 atf_tc_set_md_var(tc, "descr", "Test log10f(1.0) == +0.0");
220 ATF_TC_BODY(log10f_one_pos, tc)
222 #ifndef __vax__
223 const float x = log10f(1.0);
224 const float y = 0.0L;
226 ATF_CHECK(x == y);
227 ATF_CHECK(signbit(x) == 0);
228 ATF_CHECK(signbit(y) == 0);
229 #endif
232 ATF_TC(log10f_zero_neg);
233 ATF_TC_HEAD(log10f_zero_neg, tc)
235 atf_tc_set_md_var(tc, "descr", "Test log10f(-0.0) == -HUGE_VALF");
238 ATF_TC_BODY(log10f_zero_neg, tc)
240 #ifndef __vax__
241 const float x = -0.0L;
243 ATF_CHECK(log10f(x) == -HUGE_VALF);
244 #endif
247 ATF_TC(log10f_zero_pos);
248 ATF_TC_HEAD(log10f_zero_pos, tc)
250 atf_tc_set_md_var(tc, "descr", "Test log10f(+0.0) == -HUGE_VALF");
253 ATF_TC_BODY(log10f_zero_pos, tc)
255 #ifndef __vax__
256 const float x = 0.0L;
258 ATF_CHECK(log10f(x) == -HUGE_VALF);
259 #endif
263 * log1p(3)
265 ATF_TC(log1p_nan);
266 ATF_TC_HEAD(log1p_nan, tc)
268 atf_tc_set_md_var(tc, "descr", "Test log1p(NaN) == NaN");
271 ATF_TC_BODY(log1p_nan, tc)
273 #ifndef __vax__
274 const double x = 0.0L / 0.0L;
276 ATF_CHECK(isnan(x) != 0);
277 ATF_CHECK(isnan(log1p(x)) != 0);
278 #endif
281 ATF_TC(log1p_inf_neg);
282 ATF_TC_HEAD(log1p_inf_neg, tc)
284 atf_tc_set_md_var(tc, "descr", "Test log1p(-Inf) == NaN");
287 ATF_TC_BODY(log1p_inf_neg, tc)
289 #ifndef __vax__
290 const double x = -1.0L / 0.0L;
291 const double y = log1p(x);
293 if (isnan(y) == 0) {
294 atf_tc_expect_fail("PR lib/45362");
295 atf_tc_fail("log1p(-Inf) != NaN");
297 #endif
300 ATF_TC(log1p_inf_pos);
301 ATF_TC_HEAD(log1p_inf_pos, tc)
303 atf_tc_set_md_var(tc, "descr", "Test log1p(+Inf) == +Inf");
306 ATF_TC_BODY(log1p_inf_pos, tc)
308 #ifndef __vax__
309 const double x = 1.0L / 0.0L;
311 ATF_CHECK(log1p(x) == x);
312 #endif
315 ATF_TC(log1p_one_neg);
316 ATF_TC_HEAD(log1p_one_neg, tc)
318 atf_tc_set_md_var(tc, "descr", "Test log1p(-1.0) == -HUGE_VAL");
321 ATF_TC_BODY(log1p_one_neg, tc)
323 #ifndef __vax__
324 const double x = log1p(-1.0);
326 if (x != -HUGE_VAL) {
327 atf_tc_expect_fail("PR lib/45362");
328 atf_tc_fail("log1p(-1.0) != -HUGE_VAL");
330 #endif
333 ATF_TC(log1p_zero_neg);
334 ATF_TC_HEAD(log1p_zero_neg, tc)
336 atf_tc_set_md_var(tc, "descr", "Test log1p(-0.0) == -0.0");
339 ATF_TC_BODY(log1p_zero_neg, tc)
341 #ifndef __vax__
342 const double x = -0.0L;
344 ATF_CHECK(log1p(x) == x);
345 #endif
348 ATF_TC(log1p_zero_pos);
349 ATF_TC_HEAD(log1p_zero_pos, tc)
351 atf_tc_set_md_var(tc, "descr", "Test log1p(+0.0) == +0.0");
354 ATF_TC_BODY(log1p_zero_pos, tc)
356 #ifndef __vax__
357 const double x = 0.0L;
359 ATF_CHECK(log1p(x) == x);
360 #endif
364 * log1pf(3)
366 ATF_TC(log1pf_nan);
367 ATF_TC_HEAD(log1pf_nan, tc)
369 atf_tc_set_md_var(tc, "descr", "Test log1pf(NaN) == NaN");
372 ATF_TC_BODY(log1pf_nan, tc)
374 #ifndef __vax__
375 const float x = 0.0L / 0.0L;
377 ATF_CHECK(isnan(x) != 0);
378 ATF_CHECK(isnan(log1pf(x)) != 0);
379 #endif
382 ATF_TC(log1pf_inf_neg);
383 ATF_TC_HEAD(log1pf_inf_neg, tc)
385 atf_tc_set_md_var(tc, "descr", "Test log1pf(-Inf) == NaN");
388 ATF_TC_BODY(log1pf_inf_neg, tc)
390 #ifndef __vax__
391 const float x = -1.0L / 0.0L;
392 const float y = log1pf(x);
394 if (isnan(y) == 0) {
395 atf_tc_expect_fail("PR lib/45362");
396 atf_tc_fail("log1pf(-Inf) != NaN");
398 #endif
401 ATF_TC(log1pf_inf_pos);
402 ATF_TC_HEAD(log1pf_inf_pos, tc)
404 atf_tc_set_md_var(tc, "descr", "Test log1pf(+Inf) == +Inf");
407 ATF_TC_BODY(log1pf_inf_pos, tc)
409 #ifndef __vax__
410 const float x = 1.0L / 0.0L;
412 ATF_CHECK(log1pf(x) == x);
413 #endif
416 ATF_TC(log1pf_one_neg);
417 ATF_TC_HEAD(log1pf_one_neg, tc)
419 atf_tc_set_md_var(tc, "descr", "Test log1pf(-1.0) == -HUGE_VALF");
422 ATF_TC_BODY(log1pf_one_neg, tc)
424 #ifndef __vax__
425 const float x = log1pf(-1.0);
427 if (x != -HUGE_VALF) {
428 atf_tc_expect_fail("PR lib/45362");
429 atf_tc_fail("log1pf(-1.0) != -HUGE_VALF");
431 #endif
434 ATF_TC(log1pf_zero_neg);
435 ATF_TC_HEAD(log1pf_zero_neg, tc)
437 atf_tc_set_md_var(tc, "descr", "Test log1pf(-0.0) == -0.0");
440 ATF_TC_BODY(log1pf_zero_neg, tc)
442 #ifndef __vax__
443 const float x = -0.0L;
445 ATF_CHECK(log1pf(x) == x);
446 #endif
449 ATF_TC(log1pf_zero_pos);
450 ATF_TC_HEAD(log1pf_zero_pos, tc)
452 atf_tc_set_md_var(tc, "descr", "Test log1pf(+0.0) == +0.0");
455 ATF_TC_BODY(log1pf_zero_pos, tc)
457 #ifndef __vax__
458 const float x = 0.0L;
460 ATF_CHECK(log1pf(x) == x);
461 #endif
465 * log2(3)
467 ATF_TC(log2_base);
468 ATF_TC_HEAD(log2_base, tc)
470 atf_tc_set_md_var(tc, "descr", "Test log2(2) == 1");
473 ATF_TC_BODY(log2_base, tc)
475 ATF_CHECK(log2(2.0) == 1.0);
478 ATF_TC(log2_nan);
479 ATF_TC_HEAD(log2_nan, tc)
481 atf_tc_set_md_var(tc, "descr", "Test log2(NaN) == NaN");
484 ATF_TC_BODY(log2_nan, tc)
486 #ifndef __vax__
487 const double x = 0.0L / 0.0L;
489 ATF_CHECK(isnan(x) != 0);
490 ATF_CHECK(isnan(log2(x)) != 0);
491 #endif
494 ATF_TC(log2_inf_neg);
495 ATF_TC_HEAD(log2_inf_neg, tc)
497 atf_tc_set_md_var(tc, "descr", "Test log2(-Inf) == NaN");
500 ATF_TC_BODY(log2_inf_neg, tc)
502 #ifndef __vax__
503 const double x = -1.0L / 0.0L;
504 const double y = log2(x);
506 ATF_CHECK(isnan(y) != 0);
507 #endif
510 ATF_TC(log2_inf_pos);
511 ATF_TC_HEAD(log2_inf_pos, tc)
513 atf_tc_set_md_var(tc, "descr", "Test log2(+Inf) == +Inf");
516 ATF_TC_BODY(log2_inf_pos, tc)
518 #ifndef __vax__
519 const double x = 1.0L / 0.0L;
521 ATF_CHECK(log2(x) == x);
522 #endif
525 ATF_TC(log2_one_pos);
526 ATF_TC_HEAD(log2_one_pos, tc)
528 atf_tc_set_md_var(tc, "descr", "Test log2(1.0) == +0.0");
531 ATF_TC_BODY(log2_one_pos, tc)
533 #ifndef __vax__
534 const double x = log2(1.0);
535 const double y = 0.0L;
537 ATF_CHECK(x == y);
538 ATF_CHECK(signbit(x) == 0);
539 ATF_CHECK(signbit(y) == 0);
540 #endif
543 ATF_TC(log2_zero_neg);
544 ATF_TC_HEAD(log2_zero_neg, tc)
546 atf_tc_set_md_var(tc, "descr", "Test log2(-0.0) == -HUGE_VAL");
549 ATF_TC_BODY(log2_zero_neg, tc)
551 #ifndef __vax__
552 const double x = -0.0L;
554 ATF_CHECK(log2(x) == -HUGE_VAL);
555 #endif
558 ATF_TC(log2_zero_pos);
559 ATF_TC_HEAD(log2_zero_pos, tc)
561 atf_tc_set_md_var(tc, "descr", "Test log2(+0.0) == -HUGE_VAL");
564 ATF_TC_BODY(log2_zero_pos, tc)
566 #ifndef __vax__
567 const double x = 0.0L;
569 ATF_CHECK(log2(x) == -HUGE_VAL);
570 #endif
574 * log2f(3)
576 ATF_TC(log2f_base);
577 ATF_TC_HEAD(log2f_base, tc)
579 atf_tc_set_md_var(tc, "descr", "Test log2f(2) == 1");
582 ATF_TC_BODY(log2f_base, tc)
584 ATF_CHECK(log2f(2.0) == 1.0);
587 ATF_TC(log2f_nan);
588 ATF_TC_HEAD(log2f_nan, tc)
590 atf_tc_set_md_var(tc, "descr", "Test log2f(NaN) == NaN");
593 ATF_TC_BODY(log2f_nan, tc)
595 #ifndef __vax__
596 const float x = 0.0L / 0.0L;
598 ATF_CHECK(isnan(x) != 0);
599 ATF_CHECK(isnan(log2f(x)) != 0);
600 #endif
603 ATF_TC(log2f_inf_neg);
604 ATF_TC_HEAD(log2f_inf_neg, tc)
606 atf_tc_set_md_var(tc, "descr", "Test log2f(-Inf) == NaN");
609 ATF_TC_BODY(log2f_inf_neg, tc)
611 #ifndef __vax__
612 const float x = -1.0L / 0.0L;
613 const float y = log2f(x);
615 ATF_CHECK(isnan(y) != 0);
616 #endif
619 ATF_TC(log2f_inf_pos);
620 ATF_TC_HEAD(log2f_inf_pos, tc)
622 atf_tc_set_md_var(tc, "descr", "Test log2f(+Inf) == +Inf");
625 ATF_TC_BODY(log2f_inf_pos, tc)
627 #ifndef __vax__
628 const float x = 1.0L / 0.0L;
630 if (strcmp(atf_config_get("atf_arch"), "alpha") == 0)
631 atf_tc_expect_fail("PR port-alpha/46301");
633 ATF_CHECK(log2f(x) == x);
634 #endif
637 ATF_TC(log2f_one_pos);
638 ATF_TC_HEAD(log2f_one_pos, tc)
640 atf_tc_set_md_var(tc, "descr", "Test log2f(1.0) == +0.0");
643 ATF_TC_BODY(log2f_one_pos, tc)
645 #ifndef __vax__
646 const float x = log2f(1.0);
647 const float y = 0.0L;
649 ATF_CHECK(x == y);
650 ATF_CHECK(signbit(x) == 0);
651 ATF_CHECK(signbit(y) == 0);
652 #endif
655 ATF_TC(log2f_zero_neg);
656 ATF_TC_HEAD(log2f_zero_neg, tc)
658 atf_tc_set_md_var(tc, "descr", "Test log2f(-0.0) == -HUGE_VALF");
661 ATF_TC_BODY(log2f_zero_neg, tc)
663 #ifndef __vax__
664 const float x = -0.0L;
666 ATF_CHECK(log2f(x) == -HUGE_VALF);
667 #endif
670 ATF_TC(log2f_zero_pos);
671 ATF_TC_HEAD(log2f_zero_pos, tc)
673 atf_tc_set_md_var(tc, "descr", "Test log2f(+0.0) == -HUGE_VALF");
676 ATF_TC_BODY(log2f_zero_pos, tc)
678 #ifndef __vax__
679 const float x = 0.0L;
681 ATF_CHECK(log2f(x) == -HUGE_VALF);
682 #endif
686 * log(3)
688 ATF_TC(log_base);
689 ATF_TC_HEAD(log_base, tc)
691 atf_tc_set_md_var(tc, "descr", "Test log(e) == 1");
694 ATF_TC_BODY(log_base, tc)
696 const double eps = 1.0e-38;
698 if (fabs(log(M_E) - 1.0) > eps)
699 atf_tc_fail_nonfatal("log(e) != 1");
702 ATF_TC(log_nan);
703 ATF_TC_HEAD(log_nan, tc)
705 atf_tc_set_md_var(tc, "descr", "Test log(NaN) == NaN");
708 ATF_TC_BODY(log_nan, tc)
710 #ifndef __vax__
711 const double x = 0.0L / 0.0L;
713 ATF_CHECK(isnan(x) != 0);
714 ATF_CHECK(isnan(log(x)) != 0);
715 #endif
718 ATF_TC(log_inf_neg);
719 ATF_TC_HEAD(log_inf_neg, tc)
721 atf_tc_set_md_var(tc, "descr", "Test log(-Inf) == NaN");
724 ATF_TC_BODY(log_inf_neg, tc)
726 #ifndef __vax__
727 const double x = -1.0L / 0.0L;
728 const double y = log(x);
730 ATF_CHECK(isnan(y) != 0);
731 #endif
734 ATF_TC(log_inf_pos);
735 ATF_TC_HEAD(log_inf_pos, tc)
737 atf_tc_set_md_var(tc, "descr", "Test log(+Inf) == +Inf");
740 ATF_TC_BODY(log_inf_pos, tc)
742 #ifndef __vax__
743 const double x = 1.0L / 0.0L;
745 ATF_CHECK(log(x) == x);
746 #endif
749 ATF_TC(log_one_pos);
750 ATF_TC_HEAD(log_one_pos, tc)
752 atf_tc_set_md_var(tc, "descr", "Test log(1.0) == +0.0");
755 ATF_TC_BODY(log_one_pos, tc)
757 #ifndef __vax__
758 const double x = log(1.0);
759 const double y = 0.0L;
761 ATF_CHECK(x == y);
762 ATF_CHECK(signbit(x) == 0);
763 ATF_CHECK(signbit(y) == 0);
764 #endif
767 ATF_TC(log_zero_neg);
768 ATF_TC_HEAD(log_zero_neg, tc)
770 atf_tc_set_md_var(tc, "descr", "Test log(-0.0) == -HUGE_VAL");
773 ATF_TC_BODY(log_zero_neg, tc)
775 #ifndef __vax__
776 const double x = -0.0L;
778 ATF_CHECK(log(x) == -HUGE_VAL);
779 #endif
782 ATF_TC(log_zero_pos);
783 ATF_TC_HEAD(log_zero_pos, tc)
785 atf_tc_set_md_var(tc, "descr", "Test log(+0.0) == -HUGE_VAL");
788 ATF_TC_BODY(log_zero_pos, tc)
790 #ifndef __vax__
791 const double x = 0.0L;
793 ATF_CHECK(log(x) == -HUGE_VAL);
794 #endif
798 * logf(3)
800 ATF_TC(logf_base);
801 ATF_TC_HEAD(logf_base, tc)
803 atf_tc_set_md_var(tc, "descr", "Test logf(e) == 1");
806 ATF_TC_BODY(logf_base, tc)
808 const float eps = 1.0e-7;
810 if (fabsf(logf(M_E) - 1.0) > eps)
811 atf_tc_fail_nonfatal("logf(e) != 1");
814 ATF_TC(logf_nan);
815 ATF_TC_HEAD(logf_nan, tc)
817 atf_tc_set_md_var(tc, "descr", "Test logf(NaN) == NaN");
820 ATF_TC_BODY(logf_nan, tc)
822 #ifndef __vax__
823 const float x = 0.0L / 0.0L;
825 ATF_CHECK(isnan(x) != 0);
826 ATF_CHECK(isnan(logf(x)) != 0);
827 #endif
830 ATF_TC(logf_inf_neg);
831 ATF_TC_HEAD(logf_inf_neg, tc)
833 atf_tc_set_md_var(tc, "descr", "Test logf(-Inf) == NaN");
836 ATF_TC_BODY(logf_inf_neg, tc)
838 #ifndef __vax__
839 const float x = -1.0L / 0.0L;
840 const float y = logf(x);
842 ATF_CHECK(isnan(y) != 0);
843 #endif
846 ATF_TC(logf_inf_pos);
847 ATF_TC_HEAD(logf_inf_pos, tc)
849 atf_tc_set_md_var(tc, "descr", "Test logf(+Inf) == +Inf");
852 ATF_TC_BODY(logf_inf_pos, tc)
854 #ifndef __vax__
855 const float x = 1.0L / 0.0L;
857 if (strcmp(atf_config_get("atf_arch"), "alpha") == 0)
858 atf_tc_expect_fail("PR port-alpha/46301");
860 ATF_CHECK(logf(x) == x);
861 #endif
864 ATF_TC(logf_one_pos);
865 ATF_TC_HEAD(logf_one_pos, tc)
867 atf_tc_set_md_var(tc, "descr", "Test logf(1.0) == +0.0");
870 ATF_TC_BODY(logf_one_pos, tc)
872 #ifndef __vax__
873 const float x = logf(1.0);
874 const float y = 0.0L;
876 ATF_CHECK(x == y);
877 ATF_CHECK(signbit(x) == 0);
878 ATF_CHECK(signbit(y) == 0);
879 #endif
882 ATF_TC(logf_zero_neg);
883 ATF_TC_HEAD(logf_zero_neg, tc)
885 atf_tc_set_md_var(tc, "descr", "Test logf(-0.0) == -HUGE_VALF");
888 ATF_TC_BODY(logf_zero_neg, tc)
890 #ifndef __vax__
891 const float x = -0.0L;
893 ATF_CHECK(logf(x) == -HUGE_VALF);
894 #endif
897 ATF_TC(logf_zero_pos);
898 ATF_TC_HEAD(logf_zero_pos, tc)
900 atf_tc_set_md_var(tc, "descr", "Test logf(+0.0) == -HUGE_VALF");
903 ATF_TC_BODY(logf_zero_pos, tc)
905 #ifndef __vax__
906 const float x = 0.0L;
908 ATF_CHECK(logf(x) == -HUGE_VALF);
909 #endif
912 ATF_TP_ADD_TCS(tp)
915 ATF_TP_ADD_TC(tp, log10_base);
916 ATF_TP_ADD_TC(tp, log10_nan);
917 ATF_TP_ADD_TC(tp, log10_inf_neg);
918 ATF_TP_ADD_TC(tp, log10_inf_pos);
919 ATF_TP_ADD_TC(tp, log10_one_pos);
920 ATF_TP_ADD_TC(tp, log10_zero_neg);
921 ATF_TP_ADD_TC(tp, log10_zero_pos);
923 ATF_TP_ADD_TC(tp, log10f_base);
924 ATF_TP_ADD_TC(tp, log10f_nan);
925 ATF_TP_ADD_TC(tp, log10f_inf_neg);
926 ATF_TP_ADD_TC(tp, log10f_inf_pos);
927 ATF_TP_ADD_TC(tp, log10f_one_pos);
928 ATF_TP_ADD_TC(tp, log10f_zero_neg);
929 ATF_TP_ADD_TC(tp, log10f_zero_pos);
931 ATF_TP_ADD_TC(tp, log1p_nan);
932 ATF_TP_ADD_TC(tp, log1p_inf_neg);
933 ATF_TP_ADD_TC(tp, log1p_inf_pos);
934 ATF_TP_ADD_TC(tp, log1p_one_neg);
935 ATF_TP_ADD_TC(tp, log1p_zero_neg);
936 ATF_TP_ADD_TC(tp, log1p_zero_pos);
938 ATF_TP_ADD_TC(tp, log1pf_nan);
939 ATF_TP_ADD_TC(tp, log1pf_inf_neg);
940 ATF_TP_ADD_TC(tp, log1pf_inf_pos);
941 ATF_TP_ADD_TC(tp, log1pf_one_neg);
942 ATF_TP_ADD_TC(tp, log1pf_zero_neg);
943 ATF_TP_ADD_TC(tp, log1pf_zero_pos);
945 ATF_TP_ADD_TC(tp, log2_base);
946 ATF_TP_ADD_TC(tp, log2_nan);
947 ATF_TP_ADD_TC(tp, log2_inf_neg);
948 ATF_TP_ADD_TC(tp, log2_inf_pos);
949 ATF_TP_ADD_TC(tp, log2_one_pos);
950 ATF_TP_ADD_TC(tp, log2_zero_neg);
951 ATF_TP_ADD_TC(tp, log2_zero_pos);
953 ATF_TP_ADD_TC(tp, log2f_base);
954 ATF_TP_ADD_TC(tp, log2f_nan);
955 ATF_TP_ADD_TC(tp, log2f_inf_neg);
956 ATF_TP_ADD_TC(tp, log2f_inf_pos);
957 ATF_TP_ADD_TC(tp, log2f_one_pos);
958 ATF_TP_ADD_TC(tp, log2f_zero_neg);
959 ATF_TP_ADD_TC(tp, log2f_zero_pos);
961 ATF_TP_ADD_TC(tp, log_base);
962 ATF_TP_ADD_TC(tp, log_nan);
963 ATF_TP_ADD_TC(tp, log_inf_neg);
964 ATF_TP_ADD_TC(tp, log_inf_pos);
965 ATF_TP_ADD_TC(tp, log_one_pos);
966 ATF_TP_ADD_TC(tp, log_zero_neg);
967 ATF_TP_ADD_TC(tp, log_zero_pos);
969 ATF_TP_ADD_TC(tp, logf_base);
970 ATF_TP_ADD_TC(tp, logf_nan);
971 ATF_TP_ADD_TC(tp, logf_inf_neg);
972 ATF_TP_ADD_TC(tp, logf_inf_pos);
973 ATF_TP_ADD_TC(tp, logf_one_pos);
974 ATF_TP_ADD_TC(tp, logf_zero_neg);
975 ATF_TP_ADD_TC(tp, logf_zero_pos);
977 return atf_no_error();