Date: Thu, 11 Jan 2001 22:05:05 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Hans-Bernhard Broeker Message-Id: <9003-Thu11Jan2001220504+0200-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 CC: djgpp-workers AT delorie DOT com In-reply-to: (message from Hans-Bernhard Broeker on Thu, 11 Jan 2001 19:09:45 +0100 (MET)) Subject: Re: Weird results of log( -1.0 ) with libm.a and without libm.a (fwd) References: 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 Precedence: bulk > Date: Thu, 11 Jan 2001 19:09:45 +0100 (MET) > From: Hans-Bernhard Broeker > > On 11 Jan 2001, Morten Welinder wrote: > > > > > >From Solaris man page (a generally very good source): > > > > If x is NaN, NaN is returned. > > > > If x is less than 0, -HUGE_VAL or NaN is returned and errno > > is set to EDOM. > > But it does not seem to tell when it will return -HUGE_VAL, and when NaN, > does it? I suspect that this is because different Solaris implementations (x86 and Sparc) return different values. > Neither does the cited excerpt mention what part of this is directed by > which external standard (ANSI, POSIX, X/Open, whatever). According to the libm code, all versions except IEEE return either -Inf or -HUGE, which is almost -Inf. And libm isn't compiled in IEEE mode by default, because that would bypass matherr. Amazingly enough, C99 (at least the draft) doesn't say what is the value of log for a negative argument; it just says that EDOM _may_ occur. So I guess this is ``unspecified behavior''.