> From: Corinna Vinschen <[EMAIL PROTECTED]>
>
> On Wed, Mar 07, 2001 at 07:10:53PM +0900, Kenta MURATA wrote:
> >
> > I can't understand that log(x) returns -HUGE_VAL if x < 0.
> > Becaus, IEEE definition returns NaN.
> >
> > Why adopt this implementation?
Perhaps because that's how log() on UNIX behaved traditionally,
before IEEE floating point was defined. The C Standard says that
the return value is implementation-defined in this case - that
is, the implementation can return anything it likes as long as
it documents it.
> In the newlib sources I found:
>
> /* Check for domain error here. */
> if (x <= 0.0)
> {
> errno = ERANGE;
> return (z_notanum.d);
> }
Now that is interesting - C requires errno to be set to EDOM
in this case (and for all other domain errors in the <math.h>
functions) and UNIXes have traditionally set it to EDOM.
Looks like there might be a bug in the setting of errno even
though there's no problem with the value returned.
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple