delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/01/12/01:37:21

From: Martin Stromberg <eplmst AT lu DOT erisoft DOT se>
Message-Id: <200101120636.HAA14898@lws256.lu.erisoft.se>
Subject: Re: Weird results of log( -1.0 ) with libm.a and without libm.a (fwd)
To: djgpp-workers AT delorie DOT com
Date: Fri, 12 Jan 2001 07:36:04 +0100 (MET)
In-Reply-To: <Pine.SUN.3.91.1010111191955.20014B-100000@is> from "Eli Zaretskii" at Jan 11, 2001 07:25:04 PM
X-Mailer: ELM [version 2.5 PL3]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 
> Someone complained about log() from libm producing -Inf for a negative 
> argument.  It turns out that this is what the code is supposed to do, and 
> it is even documented in libm.info (type "info libm log").
> 
> Does anyone has an idea why this is the Right Thing to do?

C89 says in 7.5.1:
"On a domain error, the function returns an implementation-defined
value, the value of the macro EDOM is stored in errno."

So there does not seem to be any problem returning -Inf.


Right,

						MartinS

- Raw text -


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