Sync usage with man page.
[netbsd-mini2440.git] / regress / lib / libc / ieeefp / round / round.c
blob0114777153f098ec24f00ece1cd9a512b1af0e7e
1 /* $NetBSD: round.c,v 1.2 1995/04/20 22:39:37 cgd Exp $ */
3 /*
4 * Written by J.T. Conklin, Apr 18, 1995
5 * Public domain.
6 */
8 #include <assert.h>
9 #include <stdlib.h>
10 #include <ieeefp.h>
11 #include <float.h>
13 int
14 main()
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.
24 assert(fpgetround() == FP_RN);
25 assert(FLT_ROUNDS == 1);
27 assert(fpsetround(FP_RP) == FP_RN);
28 assert(fpgetround() == FP_RP);
29 assert(FLT_ROUNDS == 2);
31 assert(fpsetround(FP_RM) == FP_RP);
32 assert(fpgetround() == FP_RM);
33 assert(FLT_ROUNDS == 3);
35 assert(fpsetround(FP_RZ) == FP_RM);
36 assert(fpgetround() == FP_RZ);
37 assert(FLT_ROUNDS == 0);
39 assert(fpsetround(FP_RN) == FP_RZ);
40 assert(fpgetround() == FP_RN);
41 assert(FLT_ROUNDS == 1);
43 exit(0);