Date: Thu, 11 Jan 2001 19:19:48 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Tanes Sriviroolchai cc: djgpp AT delorie DOT com Subject: Re: Weird results of log( -1.0 ) with libm.a and without libm.a In-Reply-To: <3a5d81c9@rpc1284.daytonoh.ncr.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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'.