delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/07/17:51:32

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-Id: <200103072243.f27MhAn19964@capella.ssd.hal.com>
Subject: Re: return value of log()
To: cygwin AT cygwin DOT com (Corinna Vinschen)
Date: Wed, 7 Mar 2001 14:43:10 -0800 (PST)
In-Reply-To: <20010307122305.H21275@cygbert.vinschen.de> from "Corinna Vinschen" at Mar 07, 2001 12:23:05 PM
From: "J. J. Farrell" <jjf AT bcs DOT org DOT uk>
X-Mailer: ELM [version 2.5 PL3]
MIME-Version: 1.0

> From: Corinna Vinschen <cygwin AT cygwin DOT com>
> 
> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019