Hi,

this connects to the post I found here when encountering optimization problems with dlamch.f

http://icl.cs.utk.edu/lapack-forum/arch ... 00247.html

The page at

http://www.netlib.org/lapack-dev/lapack ... style.html

suggests that for DLAMCH('e') the Fortran90 intrinsic EPSILON can be used (LAPACK3E does that too). However, for IEEE754 singles and doubles it gives a different value than DLAMCH.

For double precision:

EPSILON(1.0d0) = 2.220446049250313E-016

DLAMCH('e') = 1.110223024625157E-016

This follows from the different definitions for epsilon; the Fortran (and common) definition of it being the smallest positive quantity so that 1+epsilon>1.

dlamch.f, however, defines it as (DLAMC2)

* The smallest positive number such that

* fl( 1.0 - EPS ) .LT. 1.0,

in which case epsilon can be twice as big, counting bits.

Questions:

1. Does it matter much which one is chosen? I'd imagine some subtle differences in the least significant bits of the mantissa depending on who is epsilon.

2, The code in dlamch.f actually computes EPS in DLAMC2, then ignores the result and instead computes it using:

IF( LRND ) THEN

RND = ONE

EPS = ( BASE**( 1-IT ) ) / 2

ELSE

RND = ZERO

EPS = BASE**( 1-IT )

END IF

where IT is the number of digits in the mantissa, BASE=2 on any computer I have used and LRND/RND specify the rounding mode. Is there a rationale behind this?

Bart