diff options
| author | cvs2svn <admin@example.com> | 2025-08-02 06:16:35 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2025-08-02 06:16:35 +0000 |
| commit | a397c95f8aea58533e72379d6e0de12683ecd0dc (patch) | |
| tree | 45ccaccd0ce2ea01650f0a9f5e9268a656e17e51 /src/regress/lib/libc/ldexp/ldexp_test.c | |
| parent | a79e90e7342954ae2287db505811ca3c1cd336d7 (diff) | |
| download | openbsd-tb_20250802.tar.gz openbsd-tb_20250802.tar.bz2 openbsd-tb_20250802.zip | |
This commit was manufactured by cvs2git to create tag 'tb_20250802'.tb_20250802
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 | } | ||
