www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/12/00:06:35

From: "Tanes Sriviroolchai" <Tanes DOT Sriviroolchai AT Thailand DOT NCR DOT COM>
Newsgroups: comp.os.msdos.djgpp
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010111191648 DOT 20014A-100000 AT is>
Subject: Re: Weird results of log( -1.0 ) with libm.a and without libm.a
Date: Fri, 12 Jan 2001 11:58:39 +0700
Lines: 42
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Original-NNTP-Posting-Host: 192.127.136.173
Message-ID: <3a5e8f24$1@rpc1284.daytonoh.ncr.com>
X-Original-Trace: 11 Jan 2001 23:59:16 -0500, 192.127.136.173
NNTP-Posting-Host: ncrnews.daytonoh.ncr.com
X-Trace: 11 Jan 2001 23:59:19 -0500, ncrnews.daytonoh.ncr.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli,
    Thanks for your reply. Could you please tell me the reason behind the
different behavior of log() in libc.a and log() in libm.a.
I'm very curious about this. I have checked other systems e.g. SVR4 (NCR),
Linux, and FreeBSD (I know it cannot be referenced directly) and I see man
page of SVR4 (NCR) saying that the return is -HUGE_VAL. However, when I use
isnan() on these systems, all systems give me TRUE as a result (also isinf()
or other equivalent function return FALSE) and printf() showing it is NaN.
In DJGPP, isnan(), isinf() are on libm.a. (Other systems I've tested
isnan(), isinf() are on libc.)

Regards,
Tanes Sriviroolchai

"Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> wrote in message
news:Pine DOT SUN DOT 3 DOT 91 DOT 1010111191648 DOT 20014A-100000 AT is...
>
> On Thu, 11 Jan 2001, Tanes Sriviroolchai wrote:
>
> > gcc -o test1.exe test1.c
> > when running you will get
> >
> > NaN
> >
> > This is expected result. However if I compile using
> > gcc -o test1.exe test1.c -lm
> > and then running, you will get
> >
> > -Inf
>
> This is what log() from libm.a is documented to produce.  Here's the
> relevant excerpt from libm.info:
>
>   Return Value
>   -------------
>      Normally, returns the calculated value.  When X is zero, the
>   returned value is `-HUGE_VAL' and `errno' is set to `ERANGE'.  When X
>   is negative, the returned value is `-HUGE_VAL' and `errno' is set to
>   `EDOM'.  You can control the error behavior via `matherr'.
>


- Raw text -


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