diff options
author | deraadt <> | 1995-10-18 08:49:34 +0000 |
---|---|---|
committer | deraadt <> | 1995-10-18 08:49:34 +0000 |
commit | a4f79641824cbf9f60ca9d1168d1fcc46717a82a (patch) | |
tree | 3a9a60a6831189695ecfa7eb6904bce69aec0bcb /src/regress/lib/libc/ieeefp/round | |
parent | 0527d29da443886d92e9a418180c5b25a5f8d270 (diff) | |
download | openbsd-a4f79641824cbf9f60ca9d1168d1fcc46717a82a.tar.gz openbsd-a4f79641824cbf9f60ca9d1168d1fcc46717a82a.tar.bz2 openbsd-a4f79641824cbf9f60ca9d1168d1fcc46717a82a.zip |
initial import of NetBSD tree
Diffstat (limited to 'src/regress/lib/libc/ieeefp/round')
-rw-r--r-- | src/regress/lib/libc/ieeefp/round/Makefile | 12 | ||||
-rw-r--r-- | src/regress/lib/libc/ieeefp/round/round.c | 44 |
2 files changed, 56 insertions, 0 deletions
diff --git a/src/regress/lib/libc/ieeefp/round/Makefile b/src/regress/lib/libc/ieeefp/round/Makefile new file mode 100644 index 0000000000..571133436c --- /dev/null +++ b/src/regress/lib/libc/ieeefp/round/Makefile | |||
@@ -0,0 +1,12 @@ | |||
1 | # $NetBSD: Makefile,v 1.1 1995/04/26 00:27:27 jtc Exp $ | ||
2 | |||
3 | PROG= round | ||
4 | SRCS= round.c | ||
5 | NOMAN= | ||
6 | |||
7 | install: | ||
8 | |||
9 | regress: ${PROG} | ||
10 | ./${PROG} | ||
11 | |||
12 | .include <bsd.prog.mk> | ||
diff --git a/src/regress/lib/libc/ieeefp/round/round.c b/src/regress/lib/libc/ieeefp/round/round.c new file mode 100644 index 0000000000..b9fcd9771e --- /dev/null +++ b/src/regress/lib/libc/ieeefp/round/round.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /* $NetBSD: round.c,v 1.1 1995/04/26 00:27:28 jtc Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Written by J.T. Conklin, Apr 18, 1995 | ||
5 | * Public domain. | ||
6 | */ | ||
7 | |||
8 | #include <assert.h> | ||
9 | #include <stdlib.h> | ||
10 | #include <ieeefp.h> | ||
11 | #include <float.h> | ||
12 | |||
13 | int | ||
14 | main() | ||
15 | { | ||
16 | /* | ||
17 | * This test would be better if it actually performed some | ||
18 | * calculations to verify the selected rounding mode. But | ||
19 | * this is probably acceptable since the fp{get,set}round | ||
20 | * functions usually just get or set the processors fpu | ||
21 | * control word. | ||
22 | */ | ||
23 | |||
24 | assert(fpgetround() == FP_RN); | ||
25 | assert(FLT_ROUNDS == 1); | ||
26 | |||
27 | assert(fpsetround(FP_RP) == FP_RN); | ||
28 | assert(fpgetround() == FP_RP); | ||
29 | assert(FLT_ROUNDS == 2); | ||
30 | |||
31 | assert(fpsetround(FP_RM) == FP_RP); | ||
32 | assert(fpgetround() == FP_RM); | ||
33 | assert(FLT_ROUNDS == 3); | ||
34 | |||
35 | assert(fpsetround(FP_RZ) == FP_RM); | ||
36 | assert(fpgetround() == FP_RZ); | ||
37 | assert(FLT_ROUNDS == 0); | ||
38 | |||
39 | assert(fpsetround(FP_RN) == FP_RZ); | ||
40 | assert(fpgetround() == FP_RN); | ||
41 | assert(FLT_ROUNDS == 1); | ||
42 | |||
43 | exit(0); | ||
44 | } | ||