|
Last change
on this file since 2089 was 2036, checked in by bird, 21 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
|
File size:
1.2 KB
|
| Rev | Line | |
|---|
| [2036] | 1 | #include <fenv.h>
|
|---|
| 2 | #include <math.h>
|
|---|
| 3 | #include <float.h>
|
|---|
| 4 | #include <stdlib.h>
|
|---|
| 5 | #include <stdio.h>
|
|---|
| 6 |
|
|---|
| 7 | int
|
|---|
| 8 | main (void)
|
|---|
| 9 | {
|
|---|
| 10 | int result = 0;
|
|---|
| 11 |
|
|---|
| 12 | float i = INFINITY;
|
|---|
| 13 | float m = FLT_MAX;
|
|---|
| 14 | feclearexcept (FE_ALL_EXCEPT);
|
|---|
| 15 | if (nextafterf (m, i) != i)
|
|---|
| 16 | {
|
|---|
| 17 | puts ("nextafterf+ failed");
|
|---|
| 18 | ++result;
|
|---|
| 19 | }
|
|---|
| 20 | if (fetestexcept (FE_OVERFLOW) == 0)
|
|---|
| 21 | {
|
|---|
| 22 | puts ("nextafterf+ did not overflow");
|
|---|
| 23 | ++result;
|
|---|
| 24 | }
|
|---|
| 25 | feclearexcept (FE_ALL_EXCEPT);
|
|---|
| 26 | if (nextafterf (-m, -i) != -i)
|
|---|
| 27 | {
|
|---|
| 28 | puts ("nextafterf- failed");
|
|---|
| 29 | ++result;
|
|---|
| 30 | }
|
|---|
| 31 | if (fetestexcept (FE_OVERFLOW) == 0)
|
|---|
| 32 | {
|
|---|
| 33 | puts ("nextafterf- did not overflow");
|
|---|
| 34 | ++result;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | double di = INFINITY;
|
|---|
| 38 | double dm = DBL_MAX;
|
|---|
| 39 | feclearexcept (FE_ALL_EXCEPT);
|
|---|
| 40 | if (nextafter (dm, di) != di)
|
|---|
| 41 | {
|
|---|
| 42 | puts ("nextafter+ failed");
|
|---|
| 43 | ++result;
|
|---|
| 44 | }
|
|---|
| 45 | if (fetestexcept (FE_OVERFLOW) == 0)
|
|---|
| 46 | {
|
|---|
| 47 | puts ("nextafter+ did not overflow");
|
|---|
| 48 | ++result;
|
|---|
| 49 | }
|
|---|
| 50 | feclearexcept (FE_ALL_EXCEPT);
|
|---|
| 51 | if (nextafter (-dm, -di) != -di)
|
|---|
| 52 | {
|
|---|
| 53 | puts ("nextafter failed");
|
|---|
| 54 | ++result;
|
|---|
| 55 | }
|
|---|
| 56 | if (fetestexcept (FE_OVERFLOW) == 0)
|
|---|
| 57 | {
|
|---|
| 58 | puts ("nextafter- did not overflow");
|
|---|
| 59 | ++result;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | return result;
|
|---|
| 63 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.