| 1 |
double precision function epslon (x) |
| 2 |
double precision x |
| 3 |
c |
| 4 |
c estimate unit roundoff in quantities of size x. |
| 5 |
c |
| 6 |
double precision a,b,c,eps |
| 7 |
c |
| 8 |
c this program should function properly on all systems |
| 9 |
c satisfying the following two assumptions, |
| 10 |
c 1. the base used in representing floating point |
| 11 |
c numbers is not a power of three. |
| 12 |
c 2. the quantity a in statement 10 is represented to |
| 13 |
c the accuracy used in floating point variables |
| 14 |
c that are stored in memory. |
| 15 |
c the statement number 10 and the go to 10 are intended to |
| 16 |
c force optimizing compilers to generate code satisfying |
| 17 |
c assumption 2. |
| 18 |
c under these assumptions, it should be true that, |
| 19 |
c a is not exactly equal to four-thirds, |
| 20 |
c b has a zero for its last bit or digit, |
| 21 |
c c is not exactly equal to one, |
| 22 |
c eps measures the separation of 1.0 from |
| 23 |
c the next larger floating point number. |
| 24 |
c the developers of eispack would appreciate being informed |
| 25 |
c about any systems where these assumptions do not hold. |
| 26 |
c |
| 27 |
c this version dated 4/6/83. |
| 28 |
c |
| 29 |
a = 4.0d0/3.0d0 |
| 30 |
10 b = a - 1.0d0 |
| 31 |
c = b + b + b |
| 32 |
eps = dabs(c-1.0d0) |
| 33 |
if (eps .eq. 0.0d0) go to 10 |
| 34 |
epslon = eps*dabs(x) |
| 35 |
return |
| 36 |
end |