Subject: Re: lib/17630: atof(3) lacks of some precision
To: <>
From: David Laight <>
List: netbsd-bugs
Date: 07/18/2002 12:29:39
Well IEEE Std 1003.1-2001 says:

    "The call atof(str) shall be equivalent to:

    strtod(str,(char **)NULL),

    except that the handling of errors may differ. If the value cannot
    be represented, the behavior is undefined."

Note the "may differ".  Also be aware that (IIRC) 'undefined' means
exactly that - reformatting the hard disk is valid 'undefined'

It also adds:

    "The atof() function is subsumed by strtod() but is retained
    because it is used extensively in existing code.  If the number is
    not known to be in range, strtod() should be used because atof()
    is not required to perform any error checking."

You could have nore fun deciding whether strtod() conforms to
IEEE 1003.1-2001 - and then fixing it.


David Laight: