tools/llvm: Do not build with symbols
[minix3.git] / tests / lib / libm / t_ceil.c
blobcefc6c6b1555364ce5fdf06e12601e50fefd359f
1 /* $NetBSD: t_ceil.c,v 1.9 2013/11/13 12:58:11 joerg 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_ceil.c,v 1.9 2013/11/13 12:58:11 joerg Exp $");
34 #include <atf-c.h>
35 #include <math.h>
36 #include <limits.h>
37 #include <stdio.h>
39 #ifdef __vax__
40 #define SMALL_NUM 1.0e-38
41 #else
42 #define SMALL_NUM 1.0e-40
43 #endif
46 * ceil(3)
48 ATF_TC(ceil_basic);
49 ATF_TC_HEAD(ceil_basic, tc)
51 atf_tc_set_md_var(tc, "descr", "A basic test of ceil(3)");
54 ATF_TC_BODY(ceil_basic, tc)
56 const double x = 0.999999999999999;
57 const double y = 0.000000000000001;
59 ATF_CHECK(fabs(ceil(x) - 1) < SMALL_NUM);
60 ATF_CHECK(fabs(ceil(y) - 1) < SMALL_NUM);
63 ATF_TC(ceil_nan);
64 ATF_TC_HEAD(ceil_nan, tc)
66 atf_tc_set_md_var(tc, "descr", "Test ceil(NaN) == NaN");
69 ATF_TC_BODY(ceil_nan, tc)
71 #ifndef __vax__
72 const double x = 0.0L / 0.0L;
74 ATF_CHECK(isnan(ceil(x)) != 0);
75 #endif
78 ATF_TC(ceil_inf_neg);
79 ATF_TC_HEAD(ceil_inf_neg, tc)
81 atf_tc_set_md_var(tc, "descr", "Test ceil(-Inf) == -Inf");
84 ATF_TC_BODY(ceil_inf_neg, tc)
86 #ifndef __vax__
87 const double x = -1.0L / 0.0L;
88 double y = ceil(x);
90 if (isinf(y) == 0 || signbit(y) == 0)
91 atf_tc_fail_nonfatal("ceil(-Inf) != -Inf");
92 #endif
95 ATF_TC(ceil_inf_pos);
96 ATF_TC_HEAD(ceil_inf_pos, tc)
98 atf_tc_set_md_var(tc, "descr", "Test ceil(+Inf) == +Inf");
101 ATF_TC_BODY(ceil_inf_pos, tc)
103 #ifndef __vax__
104 const double x = 1.0L / 0.0L;
105 double y = ceil(x);
107 if (isinf(y) == 0 || signbit(y) != 0)
108 atf_tc_fail_nonfatal("ceil(+Inf) != +Inf");
109 #endif
112 ATF_TC(ceil_zero_neg);
113 ATF_TC_HEAD(ceil_zero_neg, tc)
115 atf_tc_set_md_var(tc, "descr", "Test ceil(-0.0) == -0.0");
118 ATF_TC_BODY(ceil_zero_neg, tc)
120 #ifndef __vax__
121 const double x = -0.0L;
122 double y = ceil(x);
124 if (fabs(y) > 0.0 || signbit(y) == 0)
125 atf_tc_fail_nonfatal("ceil(-0.0) != -0.0");
126 #endif
129 ATF_TC(ceil_zero_pos);
130 ATF_TC_HEAD(ceil_zero_pos, tc)
132 atf_tc_set_md_var(tc, "descr", "Test ceil(+0.0) == +0.0");
135 ATF_TC_BODY(ceil_zero_pos, tc)
137 #ifndef __vax__
138 const double x = 0.0L;
139 double y = ceil(x);
141 if (fabs(y) > 0.0 || signbit(y) != 0)
142 atf_tc_fail_nonfatal("ceil(+0.0) != +0.0");
143 #endif
147 * ceilf(3)
149 ATF_TC(ceilf_basic);
150 ATF_TC_HEAD(ceilf_basic, tc)
152 atf_tc_set_md_var(tc, "descr", "A basic test of ceilf(3)");
155 ATF_TC_BODY(ceilf_basic, tc)
157 const float x = 0.9999999;
158 const float y = 0.0000001;
160 ATF_CHECK(fabsf(ceilf(x) - 1) < SMALL_NUM);
161 ATF_CHECK(fabsf(ceilf(y) - 1) < SMALL_NUM);
164 ATF_TC(ceilf_nan);
165 ATF_TC_HEAD(ceilf_nan, tc)
167 atf_tc_set_md_var(tc, "descr", "Test ceilf(NaN) == NaN");
170 ATF_TC_BODY(ceilf_nan, tc)
172 #ifndef __vax__
173 const float x = 0.0L / 0.0L;
175 ATF_CHECK(isnan(ceilf(x)) != 0);
176 #endif
179 ATF_TC(ceilf_inf_neg);
180 ATF_TC_HEAD(ceilf_inf_neg, tc)
182 atf_tc_set_md_var(tc, "descr", "Test ceilf(-Inf) == -Inf");
185 ATF_TC_BODY(ceilf_inf_neg, tc)
187 #ifndef __vax__
188 const float x = -1.0L / 0.0L;
189 float y = ceilf(x);
191 if (isinf(y) == 0 || signbit(y) == 0)
192 atf_tc_fail_nonfatal("ceilf(-Inf) != -Inf");
193 #endif
196 ATF_TC(ceilf_inf_pos);
197 ATF_TC_HEAD(ceilf_inf_pos, tc)
199 atf_tc_set_md_var(tc, "descr", "Test ceilf(+Inf) == +Inf");
202 ATF_TC_BODY(ceilf_inf_pos, tc)
204 #ifndef __vax__
205 const float x = 1.0L / 0.0L;
206 float y = ceilf(x);
208 if (isinf(y) == 0 || signbit(y) != 0)
209 atf_tc_fail_nonfatal("ceilf(+Inf) != +Inf");
210 #endif
213 ATF_TC(ceilf_zero_neg);
214 ATF_TC_HEAD(ceilf_zero_neg, tc)
216 atf_tc_set_md_var(tc, "descr", "Test ceilf(-0.0) == -0.0");
219 ATF_TC_BODY(ceilf_zero_neg, tc)
221 #ifndef __vax__
222 const float x = -0.0L;
223 float y = ceilf(x);
225 if (fabsf(y) > 0.0 || signbit(y) == 0)
226 atf_tc_fail_nonfatal("ceilf(-0.0) != -0.0");
227 #endif
230 ATF_TC(ceilf_zero_pos);
231 ATF_TC_HEAD(ceilf_zero_pos, tc)
233 atf_tc_set_md_var(tc, "descr", "Test ceilf(+0.0) == +0.0");
236 ATF_TC_BODY(ceilf_zero_pos, tc)
238 #ifndef __vax__
239 const float x = 0.0L;
240 float y = ceilf(x);
242 if (fabsf(y) > 0.0 || signbit(y) != 0)
243 atf_tc_fail_nonfatal("ceilf(+0.0) != +0.0");
244 #endif
248 * ceill(3)
250 ATF_TC(ceill_basic);
251 ATF_TC_HEAD(ceill_basic, tc)
253 atf_tc_set_md_var(tc, "descr", "A basic test of ceill(3)");
256 ATF_TC_BODY(ceill_basic, tc)
258 const long double x = 0.9999999;
259 const long double y = 0.0000001;
261 ATF_CHECK(fabsl(ceill(x) - 1) < SMALL_NUM);
262 ATF_CHECK(fabsl(ceill(y) - 1) < SMALL_NUM);
265 ATF_TC(ceill_nan);
266 ATF_TC_HEAD(ceill_nan, tc)
268 atf_tc_set_md_var(tc, "descr", "Test ceill(NaN) == NaN");
271 ATF_TC_BODY(ceill_nan, tc)
273 #ifndef __vax__
274 const long double x = 0.0L / 0.0L;
276 ATF_CHECK(isnan(ceill(x)) != 0);
277 #endif
280 ATF_TC(ceill_inf_neg);
281 ATF_TC_HEAD(ceill_inf_neg, tc)
283 atf_tc_set_md_var(tc, "descr", "Test ceill(-Inf) == -Inf");
286 ATF_TC_BODY(ceill_inf_neg, tc)
288 #ifndef __vax__
289 const long double x = -1.0L / 0.0L;
290 long double y = ceill(x);
292 if (isinf(y) == 0 || signbit(y) == 0)
293 atf_tc_fail_nonfatal("ceill(-Inf) != -Inf");
294 #endif
297 ATF_TC(ceill_inf_pos);
298 ATF_TC_HEAD(ceill_inf_pos, tc)
300 atf_tc_set_md_var(tc, "descr", "Test ceill(+Inf) == +Inf");
303 ATF_TC_BODY(ceill_inf_pos, tc)
305 #ifndef __vax__
306 const long double x = 1.0L / 0.0L;
307 long double y = ceill(x);
309 if (isinf(y) == 0 || signbit(y) != 0)
310 atf_tc_fail_nonfatal("ceill(+Inf) != +Inf");
311 #endif
314 ATF_TC(ceill_zero_neg);
315 ATF_TC_HEAD(ceill_zero_neg, tc)
317 atf_tc_set_md_var(tc, "descr", "Test ceill(-0.0) == -0.0");
320 ATF_TC_BODY(ceill_zero_neg, tc)
322 #ifndef __vax__
323 const long double x = -0.0L;
324 long double y = ceill(x);
326 if (fabsl(y) > 0.0 || signbit(y) == 0)
327 atf_tc_fail_nonfatal("ceill(-0.0) != -0.0");
328 #endif
331 ATF_TC(ceill_zero_pos);
332 ATF_TC_HEAD(ceill_zero_pos, tc)
334 atf_tc_set_md_var(tc, "descr", "Test ceill(+0.0) == +0.0");
337 ATF_TC_BODY(ceill_zero_pos, tc)
339 #ifndef __vax__
340 const long double x = 0.0L;
341 long double y = ceill(x);
343 if (fabsl(y) > 0.0 || signbit(y) != 0)
344 atf_tc_fail_nonfatal("ceill(+0.0) != +0.0");
345 #endif
349 * floor(3)
351 ATF_TC(floor_basic);
352 ATF_TC_HEAD(floor_basic, tc)
354 atf_tc_set_md_var(tc, "descr", "A basic test of floor(3)");
357 ATF_TC_BODY(floor_basic, tc)
359 const double x = 0.999999999999999;
360 const double y = 0.000000000000001;
362 ATF_CHECK(floor(x) < SMALL_NUM);
363 ATF_CHECK(floor(y) < SMALL_NUM);
366 ATF_TC(floor_nan);
367 ATF_TC_HEAD(floor_nan, tc)
369 atf_tc_set_md_var(tc, "descr", "Test floor(NaN) == NaN");
372 ATF_TC_BODY(floor_nan, tc)
374 #ifndef __vax__
375 const double x = 0.0L / 0.0L;
377 ATF_CHECK(isnan(floor(x)) != 0);
378 #endif
381 ATF_TC(floor_inf_neg);
382 ATF_TC_HEAD(floor_inf_neg, tc)
384 atf_tc_set_md_var(tc, "descr", "Test floor(-Inf) == -Inf");
387 ATF_TC_BODY(floor_inf_neg, tc)
389 #ifndef __vax__
390 const double x = -1.0L / 0.0L;
391 double y = floor(x);
393 if (isinf(y) == 0 || signbit(y) == 0)
394 atf_tc_fail_nonfatal("floor(-Inf) != -Inf");
395 #endif
398 ATF_TC(floor_inf_pos);
399 ATF_TC_HEAD(floor_inf_pos, tc)
401 atf_tc_set_md_var(tc, "descr", "Test floor(+Inf) == +Inf");
404 ATF_TC_BODY(floor_inf_pos, tc)
406 #ifndef __vax__
407 const double x = 1.0L / 0.0L;
408 double y = floor(x);
410 if (isinf(y) == 0 || signbit(y) != 0)
411 atf_tc_fail_nonfatal("floor(+Inf) != +Inf");
412 #endif
415 ATF_TC(floor_zero_neg);
416 ATF_TC_HEAD(floor_zero_neg, tc)
418 atf_tc_set_md_var(tc, "descr", "Test floor(-0.0) == -0.0");
421 ATF_TC_BODY(floor_zero_neg, tc)
423 #ifndef __vax__
424 const double x = -0.0L;
425 double y = floor(x);
427 if (fabs(y) > 0.0 || signbit(y) == 0)
428 atf_tc_fail_nonfatal("floor(-0.0) != -0.0");
429 #endif
432 ATF_TC(floor_zero_pos);
433 ATF_TC_HEAD(floor_zero_pos, tc)
435 atf_tc_set_md_var(tc, "descr", "Test floor(+0.0) == +0.0");
438 ATF_TC_BODY(floor_zero_pos, tc)
440 #ifndef __vax__
441 const double x = 0.0L;
442 double y = floor(x);
444 if (fabs(y) > 0.0 || signbit(y) != 0)
445 atf_tc_fail_nonfatal("floor(+0.0) != +0.0");
446 #endif
450 * floorf(3)
452 ATF_TC(floorf_basic);
453 ATF_TC_HEAD(floorf_basic, tc)
455 atf_tc_set_md_var(tc, "descr", "A basic test of floorf(3)");
458 ATF_TC_BODY(floorf_basic, tc)
460 const float x = 0.9999999;
461 const float y = 0.0000001;
463 ATF_CHECK(floorf(x) < SMALL_NUM);
464 ATF_CHECK(floorf(y) < SMALL_NUM);
467 ATF_TC(floorf_nan);
468 ATF_TC_HEAD(floorf_nan, tc)
470 atf_tc_set_md_var(tc, "descr", "Test floorf(NaN) == NaN");
473 ATF_TC_BODY(floorf_nan, tc)
475 #ifndef __vax__
476 const float x = 0.0L / 0.0L;
478 ATF_CHECK(isnan(floorf(x)) != 0);
479 #endif
482 ATF_TC(floorf_inf_neg);
483 ATF_TC_HEAD(floorf_inf_neg, tc)
485 atf_tc_set_md_var(tc, "descr", "Test floorf(-Inf) == -Inf");
488 ATF_TC_BODY(floorf_inf_neg, tc)
490 #ifndef __vax__
491 const float x = -1.0L / 0.0L;
492 float y = floorf(x);
494 if (isinf(y) == 0 || signbit(y) == 0)
495 atf_tc_fail_nonfatal("floorf(-Inf) != -Inf");
496 #endif
499 ATF_TC(floorf_inf_pos);
500 ATF_TC_HEAD(floorf_inf_pos, tc)
502 atf_tc_set_md_var(tc, "descr", "Test floorf(+Inf) == +Inf");
505 ATF_TC_BODY(floorf_inf_pos, tc)
507 #ifndef __vax__
508 const float x = 1.0L / 0.0L;
509 float y = floorf(x);
511 if (isinf(y) == 0 || signbit(y) != 0)
512 atf_tc_fail_nonfatal("floorf(+Inf) != +Inf");
513 #endif
516 ATF_TC(floorf_zero_neg);
517 ATF_TC_HEAD(floorf_zero_neg, tc)
519 atf_tc_set_md_var(tc, "descr", "Test floorf(-0.0) == -0.0");
522 ATF_TC_BODY(floorf_zero_neg, tc)
524 #ifndef __vax__
525 const float x = -0.0L;
526 float y = floorf(x);
528 if (fabsf(y) > 0.0 || signbit(y) == 0)
529 atf_tc_fail_nonfatal("floorf(-0.0) != -0.0");
530 #endif
533 ATF_TC(floorf_zero_pos);
534 ATF_TC_HEAD(floorf_zero_pos, tc)
536 atf_tc_set_md_var(tc, "descr", "Test floorf(+0.0) == +0.0");
539 ATF_TC_BODY(floorf_zero_pos, tc)
541 #ifndef __vax__
542 const float x = 0.0L;
543 float y = floorf(x);
545 if (fabsf(y) > 0.0 || signbit(y) != 0)
546 atf_tc_fail_nonfatal("floorf(+0.0) != +0.0");
547 #endif
551 * floorl(3)
553 ATF_TC(floorl_basic);
554 ATF_TC_HEAD(floorl_basic, tc)
556 atf_tc_set_md_var(tc, "descr", "A basic test of floorl(3)");
559 ATF_TC_BODY(floorl_basic, tc)
561 const long double x = 0.9999999;
562 const long double y = 0.0000001;
564 ATF_CHECK(floorl(x) < SMALL_NUM);
565 ATF_CHECK(floorl(y) < SMALL_NUM);
568 ATF_TC(floorl_nan);
569 ATF_TC_HEAD(floorl_nan, tc)
571 atf_tc_set_md_var(tc, "descr", "Test floorl(NaN) == NaN");
574 ATF_TC_BODY(floorl_nan, tc)
576 #ifndef __vax__
577 const long double x = 0.0L / 0.0L;
579 ATF_CHECK(isnan(floorl(x)) != 0);
580 #endif
583 ATF_TC(floorl_inf_neg);
584 ATF_TC_HEAD(floorl_inf_neg, tc)
586 atf_tc_set_md_var(tc, "descr", "Test floorl(-Inf) == -Inf");
589 ATF_TC_BODY(floorl_inf_neg, tc)
591 #ifndef __vax__
592 const long double x = -1.0L / 0.0L;
593 long double y = floorl(x);
595 if (isinf(y) == 0 || signbit(y) == 0)
596 atf_tc_fail_nonfatal("floorl(-Inf) != -Inf");
597 #endif
600 ATF_TC(floorl_inf_pos);
601 ATF_TC_HEAD(floorl_inf_pos, tc)
603 atf_tc_set_md_var(tc, "descr", "Test floorl(+Inf) == +Inf");
606 ATF_TC_BODY(floorl_inf_pos, tc)
608 #ifndef __vax__
609 const long double x = 1.0L / 0.0L;
610 long double y = floorl(x);
612 if (isinf(y) == 0 || signbit(y) != 0)
613 atf_tc_fail_nonfatal("floorl(+Inf) != +Inf");
614 #endif
617 ATF_TC(floorl_zero_neg);
618 ATF_TC_HEAD(floorl_zero_neg, tc)
620 atf_tc_set_md_var(tc, "descr", "Test floorl(-0.0) == -0.0");
623 ATF_TC_BODY(floorl_zero_neg, tc)
625 #ifndef __vax__
626 const long double x = -0.0L;
627 long double y = floorl(x);
629 if (fabsl(y) > 0.0 || signbit(y) == 0)
630 atf_tc_fail_nonfatal("floorl(-0.0) != -0.0");
631 #endif
634 ATF_TC(floorl_zero_pos);
635 ATF_TC_HEAD(floorl_zero_pos, tc)
637 atf_tc_set_md_var(tc, "descr", "Test floorl(+0.0) == +0.0");
640 ATF_TC_BODY(floorl_zero_pos, tc)
642 #ifndef __vax__
643 const long double x = 0.0L;
644 long double y = floorl(x);
646 if (fabsl(y) > 0.0 || signbit(y) != 0)
647 atf_tc_fail_nonfatal("floorl(+0.0) != +0.0");
648 #endif
652 * trunc(3)
654 ATF_TC(trunc_basic);
655 ATF_TC_HEAD(trunc_basic, tc)
657 atf_tc_set_md_var(tc, "descr", "A basic test of trunc(3)");
660 ATF_TC_BODY(trunc_basic, tc)
662 const double x = 0.999999999999999;
663 const double y = 0.000000000000001;
665 ATF_CHECK(trunc(x) < SMALL_NUM);
666 ATF_CHECK(trunc(y) < SMALL_NUM);
669 ATF_TC(trunc_nan);
670 ATF_TC_HEAD(trunc_nan, tc)
672 atf_tc_set_md_var(tc, "descr", "Test trunc(NaN) == NaN");
675 ATF_TC_BODY(trunc_nan, tc)
677 #ifndef __vax__
678 const double x = 0.0L / 0.0L;
680 ATF_CHECK(isnan(trunc(x)) != 0);
681 #endif
684 ATF_TC(trunc_inf_neg);
685 ATF_TC_HEAD(trunc_inf_neg, tc)
687 atf_tc_set_md_var(tc, "descr", "Test trunc(-Inf) == -Inf");
690 ATF_TC_BODY(trunc_inf_neg, tc)
692 #ifndef __vax__
693 const double x = -1.0L / 0.0L;
694 double y = trunc(x);
696 if (isinf(y) == 0 || signbit(y) == 0)
697 atf_tc_fail_nonfatal("trunc(-Inf) != -Inf");
698 #endif
701 ATF_TC(trunc_inf_pos);
702 ATF_TC_HEAD(trunc_inf_pos, tc)
704 atf_tc_set_md_var(tc, "descr", "Test trunc(+Inf) == +Inf");
707 ATF_TC_BODY(trunc_inf_pos, tc)
709 #ifndef __vax__
710 const double x = 1.0L / 0.0L;
711 double y = trunc(x);
713 if (isinf(y) == 0 || signbit(y) != 0)
714 atf_tc_fail_nonfatal("trunc(+Inf) != +Inf");
715 #endif
718 ATF_TC(trunc_zero_neg);
719 ATF_TC_HEAD(trunc_zero_neg, tc)
721 atf_tc_set_md_var(tc, "descr", "Test trunc(-0.0) == -0.0");
724 ATF_TC_BODY(trunc_zero_neg, tc)
726 #ifndef __vax__
727 const double x = -0.0L;
728 double y = trunc(x);
730 if (fabs(y) > 0.0 || signbit(y) == 0)
731 atf_tc_fail_nonfatal("trunc(-0.0) != -0.0");
732 #endif
735 ATF_TC(trunc_zero_pos);
736 ATF_TC_HEAD(trunc_zero_pos, tc)
738 atf_tc_set_md_var(tc, "descr", "Test trunc(+0.0) == +0.0");
741 ATF_TC_BODY(trunc_zero_pos, tc)
743 #ifndef __vax__
744 const double x = 0.0L;
745 double y = trunc(x);
747 if (fabs(y) > 0.0 || signbit(y) != 0)
748 atf_tc_fail_nonfatal("trunc(+0.0) != +0.0");
749 #endif
753 * truncf(3)
755 ATF_TC(truncf_basic);
756 ATF_TC_HEAD(truncf_basic, tc)
758 atf_tc_set_md_var(tc, "descr", "A basic test of truncf(3)");
761 ATF_TC_BODY(truncf_basic, tc)
763 const float x = 0.9999999;
764 const float y = 0.0000001;
766 ATF_CHECK(truncf(x) < SMALL_NUM);
767 ATF_CHECK(truncf(y) < SMALL_NUM);
770 ATF_TC(truncf_nan);
771 ATF_TC_HEAD(truncf_nan, tc)
773 atf_tc_set_md_var(tc, "descr", "Test truncf(NaN) == NaN");
776 ATF_TC_BODY(truncf_nan, tc)
778 #ifndef __vax__
779 const float x = 0.0L / 0.0L;
781 ATF_CHECK(isnan(truncf(x)) != 0);
782 #endif
785 ATF_TC(truncf_inf_neg);
786 ATF_TC_HEAD(truncf_inf_neg, tc)
788 atf_tc_set_md_var(tc, "descr", "Test truncf(-Inf) == -Inf");
791 ATF_TC_BODY(truncf_inf_neg, tc)
793 #ifndef __vax__
794 const float x = -1.0L / 0.0L;
795 float y = truncf(x);
797 if (isinf(y) == 0 || signbit(y) == 0)
798 atf_tc_fail_nonfatal("truncf(-Inf) != -Inf");
799 #endif
802 ATF_TC(truncf_inf_pos);
803 ATF_TC_HEAD(truncf_inf_pos, tc)
805 atf_tc_set_md_var(tc, "descr", "Test truncf(+Inf) == +Inf");
808 ATF_TC_BODY(truncf_inf_pos, tc)
810 #ifndef __vax__
811 const float x = 1.0L / 0.0L;
812 float y = truncf(x);
814 if (isinf(y) == 0 || signbit(y) != 0)
815 atf_tc_fail_nonfatal("truncf(+Inf) != +Inf");
816 #endif
819 ATF_TC(truncf_zero_neg);
820 ATF_TC_HEAD(truncf_zero_neg, tc)
822 atf_tc_set_md_var(tc, "descr", "Test truncf(-0.0) == -0.0");
825 ATF_TC_BODY(truncf_zero_neg, tc)
827 #ifndef __vax__
828 const float x = -0.0L;
829 float y = truncf(x);
831 if (fabsf(y) > 0.0 || signbit(y) == 0)
832 atf_tc_fail_nonfatal("truncf(-0.0) != -0.0");
833 #endif
836 ATF_TC(truncf_zero_pos);
837 ATF_TC_HEAD(truncf_zero_pos, tc)
839 atf_tc_set_md_var(tc, "descr", "Test truncf(+0.0) == +0.0");
842 ATF_TC_BODY(truncf_zero_pos, tc)
844 #ifndef __vax__
845 const float x = 0.0L;
846 float y = truncf(x);
848 if (fabsf(y) > 0.0 || signbit(y) != 0)
849 atf_tc_fail_nonfatal("truncf(+0.0) != +0.0");
850 #endif
854 * truncl(3)
856 ATF_TC(truncl_basic);
857 ATF_TC_HEAD(truncl_basic, tc)
859 atf_tc_set_md_var(tc, "descr", "A basic test of truncl(3)");
862 ATF_TC_BODY(truncl_basic, tc)
864 const long double x = 0.9999999;
865 const long double y = 0.0000001;
867 ATF_CHECK(truncl(x) < SMALL_NUM);
868 ATF_CHECK(truncl(y) < SMALL_NUM);
871 ATF_TC(truncl_nan);
872 ATF_TC_HEAD(truncl_nan, tc)
874 atf_tc_set_md_var(tc, "descr", "Test truncl(NaN) == NaN");
877 ATF_TC_BODY(truncl_nan, tc)
879 #ifndef __vax__
880 const long double x = 0.0L / 0.0L;
882 ATF_CHECK(isnan(truncl(x)) != 0);
883 #endif
886 ATF_TC(truncl_inf_neg);
887 ATF_TC_HEAD(truncl_inf_neg, tc)
889 atf_tc_set_md_var(tc, "descr", "Test truncl(-Inf) == -Inf");
892 ATF_TC_BODY(truncl_inf_neg, tc)
894 #ifndef __vax__
895 const long double x = -1.0L / 0.0L;
896 long double y = truncl(x);
898 if (isinf(y) == 0 || signbit(y) == 0)
899 atf_tc_fail_nonfatal("truncl(-Inf) != -Inf");
900 #endif
903 ATF_TC(truncl_inf_pos);
904 ATF_TC_HEAD(truncl_inf_pos, tc)
906 atf_tc_set_md_var(tc, "descr", "Test truncl(+Inf) == +Inf");
909 ATF_TC_BODY(truncl_inf_pos, tc)
911 #ifndef __vax__
912 const long double x = 1.0L / 0.0L;
913 long double y = truncl(x);
915 if (isinf(y) == 0 || signbit(y) != 0)
916 atf_tc_fail_nonfatal("truncl(+Inf) != +Inf");
917 #endif
920 ATF_TC(truncl_zero_neg);
921 ATF_TC_HEAD(truncl_zero_neg, tc)
923 atf_tc_set_md_var(tc, "descr", "Test truncl(-0.0) == -0.0");
926 ATF_TC_BODY(truncl_zero_neg, tc)
928 #ifndef __vax__
929 const long double x = -0.0L;
930 long double y = truncl(x);
932 if (fabsl(y) > 0.0 || signbit(y) == 0)
933 atf_tc_fail_nonfatal("truncl(-0.0) != -0.0");
934 #endif
937 ATF_TC(truncl_zero_pos);
938 ATF_TC_HEAD(truncl_zero_pos, tc)
940 atf_tc_set_md_var(tc, "descr", "Test truncl(+0.0) == +0.0");
943 ATF_TC_BODY(truncl_zero_pos, tc)
945 #ifndef __vax__
946 const long double x = 0.0L;
947 long double y = truncl(x);
949 if (fabsl(y) > 0.0 || signbit(y) != 0)
950 atf_tc_fail_nonfatal("truncl(+0.0) != +0.0");
951 #endif
954 ATF_TP_ADD_TCS(tp)
957 ATF_TP_ADD_TC(tp, ceil_basic);
958 ATF_TP_ADD_TC(tp, ceil_nan);
959 ATF_TP_ADD_TC(tp, ceil_inf_neg);
960 ATF_TP_ADD_TC(tp, ceil_inf_pos);
961 ATF_TP_ADD_TC(tp, ceil_zero_neg);
962 ATF_TP_ADD_TC(tp, ceil_zero_pos);
964 ATF_TP_ADD_TC(tp, ceilf_basic);
965 ATF_TP_ADD_TC(tp, ceilf_nan);
966 ATF_TP_ADD_TC(tp, ceilf_inf_neg);
967 ATF_TP_ADD_TC(tp, ceilf_inf_pos);
968 ATF_TP_ADD_TC(tp, ceilf_zero_neg);
969 ATF_TP_ADD_TC(tp, ceilf_zero_pos);
971 ATF_TP_ADD_TC(tp, ceill_basic);
972 ATF_TP_ADD_TC(tp, ceill_nan);
973 ATF_TP_ADD_TC(tp, ceill_inf_neg);
974 ATF_TP_ADD_TC(tp, ceill_inf_pos);
975 ATF_TP_ADD_TC(tp, ceill_zero_neg);
976 ATF_TP_ADD_TC(tp, ceill_zero_pos);
978 ATF_TP_ADD_TC(tp, floor_basic);
979 ATF_TP_ADD_TC(tp, floor_nan);
980 ATF_TP_ADD_TC(tp, floor_inf_neg);
981 ATF_TP_ADD_TC(tp, floor_inf_pos);
982 ATF_TP_ADD_TC(tp, floor_zero_neg);
983 ATF_TP_ADD_TC(tp, floor_zero_pos);
985 ATF_TP_ADD_TC(tp, floorf_basic);
986 ATF_TP_ADD_TC(tp, floorf_nan);
987 ATF_TP_ADD_TC(tp, floorf_inf_neg);
988 ATF_TP_ADD_TC(tp, floorf_inf_pos);
989 ATF_TP_ADD_TC(tp, floorf_zero_neg);
990 ATF_TP_ADD_TC(tp, floorf_zero_pos);
992 ATF_TP_ADD_TC(tp, floorl_basic);
993 ATF_TP_ADD_TC(tp, floorl_nan);
994 ATF_TP_ADD_TC(tp, floorl_inf_neg);
995 ATF_TP_ADD_TC(tp, floorl_inf_pos);
996 ATF_TP_ADD_TC(tp, floorl_zero_neg);
997 ATF_TP_ADD_TC(tp, floorl_zero_pos);
999 ATF_TP_ADD_TC(tp, trunc_basic);
1000 ATF_TP_ADD_TC(tp, trunc_nan);
1001 ATF_TP_ADD_TC(tp, trunc_inf_neg);
1002 ATF_TP_ADD_TC(tp, trunc_inf_pos);
1003 ATF_TP_ADD_TC(tp, trunc_zero_neg);
1004 ATF_TP_ADD_TC(tp, trunc_zero_pos);
1006 ATF_TP_ADD_TC(tp, truncf_basic);
1007 ATF_TP_ADD_TC(tp, truncf_nan);
1008 ATF_TP_ADD_TC(tp, truncf_inf_neg);
1009 ATF_TP_ADD_TC(tp, truncf_inf_pos);
1010 ATF_TP_ADD_TC(tp, truncf_zero_neg);
1011 ATF_TP_ADD_TC(tp, truncf_zero_pos);
1013 ATF_TP_ADD_TC(tp, truncl_basic);
1014 ATF_TP_ADD_TC(tp, truncl_nan);
1015 ATF_TP_ADD_TC(tp, truncl_inf_neg);
1016 ATF_TP_ADD_TC(tp, truncl_inf_pos);
1017 ATF_TP_ADD_TC(tp, truncl_zero_neg);
1018 ATF_TP_ADD_TC(tp, truncl_zero_pos);
1020 return atf_no_error();