diff options
author | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
commit | eb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch) | |
tree | edb6da6af7e865d488dc1a29309f1e1ec226e603 /src/regress/lib/libc/ldexp/ldexp_test.c | |
parent | 247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff) | |
download | openbsd-tb_20250414.tar.gz openbsd-tb_20250414.tar.bz2 openbsd-tb_20250414.zip |
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to 'src/regress/lib/libc/ldexp/ldexp_test.c')
-rw-r--r-- | src/regress/lib/libc/ldexp/ldexp_test.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/regress/lib/libc/ldexp/ldexp_test.c b/src/regress/lib/libc/ldexp/ldexp_test.c deleted file mode 100644 index 75031e3083..0000000000 --- a/src/regress/lib/libc/ldexp/ldexp_test.c +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /* $OpenBSD: ldexp_test.c,v 1.1 2017/10/15 12:15:30 visa Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 2017 Visa Hankala | ||
5 | * | ||
6 | * Permission to use, copy, modify, and distribute this software for any | ||
7 | * purpose with or without fee is hereby granted, provided that the above | ||
8 | * copyright notice and this permission notice appear in all copies. | ||
9 | * | ||
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
17 | */ | ||
18 | |||
19 | #include <assert.h> | ||
20 | #include <math.h> | ||
21 | |||
22 | int | ||
23 | main(int argc, char *argv[]) | ||
24 | { | ||
25 | double f; | ||
26 | |||
27 | /* | ||
28 | * Test that the result has the correct sign. | ||
29 | * Assumes IEEE 754 double-precision arithmetics. | ||
30 | */ | ||
31 | |||
32 | assert(ldexp(1.0, -1022) > 0.0); /* IEEE 754 minimum normal positive */ | ||
33 | assert(ldexp(1.0, -1023) > 0.0); /* subnormal positive */ | ||
34 | assert(ldexp(1.0, -1024) > 0.0); /* subnormal positive */ | ||
35 | assert(ldexp(1.0, -1074) > 0.0); /* minimum subnormal positive */ | ||
36 | assert(ldexp(1.0, -1075) >= 0.0); /* zero */ | ||
37 | assert(ldexp(ldexp(1.0, -1022), -53) >= 0.0); /* zero */ | ||
38 | |||
39 | assert(ldexp(1.0, 1023) > 0.0); /* normal positive */ | ||
40 | |||
41 | f = ldexp(1.0, 1024); /* infinite positive */ | ||
42 | assert(isinf(f)); | ||
43 | assert(!signbit(f)); | ||
44 | |||
45 | f = ldexp(ldexp(1.0, 1023), 1); /* infinite positive */ | ||
46 | assert(isinf(f)); | ||
47 | assert(!signbit(f)); | ||
48 | |||
49 | assert(ldexp(-1.0, -1022) < 0.0); /* IEEE 754 maximum normal negative */ | ||
50 | assert(ldexp(-1.0, -1023) < 0.0); /* subnormal negative */ | ||
51 | assert(ldexp(-1.0, -1024) < 0.0); /* subnormal negative */ | ||
52 | assert(ldexp(-1.0, -1074) < 0.0); /* maximum subnormal negative */ | ||
53 | assert(ldexp(-1.0, -1075) <= 0.0); /* zero */ | ||
54 | assert(ldexp(ldexp(-1.0, -1022), -53) <= 0.0); /* zero */ | ||
55 | |||
56 | assert(ldexp(-1.0, 1023) < 0.0); /* normal negative */ | ||
57 | |||
58 | f = ldexp(-1.0, 1024); /* infinite negative */ | ||
59 | assert(isinf(f)); | ||
60 | assert(signbit(f)); | ||
61 | |||
62 | f = ldexp(ldexp(-1.0, 1023), 1); /* infinite negative */ | ||
63 | assert(isinf(f)); | ||
64 | assert(signbit(f)); | ||
65 | |||
66 | f = ldexp(NAN, 0); | ||
67 | assert(isnan(f)); | ||
68 | assert(!signbit(f)); | ||
69 | |||
70 | f = ldexp(-NAN, 0); | ||
71 | assert(isnan(f)); | ||
72 | assert(signbit(f)); | ||
73 | |||
74 | return 0; | ||
75 | } | ||