www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/11/15:52:03

Date: Thu, 11 Jan 2001 22:12:00 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Tanes Sriviroolchai" <Tanes DOT Sriviroolchai AT Thailand DOT NCR DOT COM>
Message-Id: <2593-Thu11Jan2001221159+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 AT delorie DOT com
In-reply-to: <3a5d81c9@rpc1284.daytonoh.ncr.com>
(Tanes DOT Sriviroolchai AT Thailand DOT NCR DOT COM)
Subject: Re: Weird results of log( -1.0 ) with libm.a and without libm.a
References: <3a5d81c9 AT rpc1284 DOT daytonoh DOT ncr DOT com>
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

> From: "Tanes Sriviroolchai" <Tanes DOT Sriviroolchai AT Thailand DOT NCR DOT COM>
> Newsgroups: comp.os.msdos.djgpp
> Date: Thu, 11 Jan 2001 16:49:21 +0700
> 
> 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

In addition to what I already wrote in this thread, you can request
that the libm version returns the same NaN as the libc version by
forcing libm into the IEEE mode, like this:

     #include <libm/math.h>

     _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;

This turns on the IEEE compatibility, but you lose the matherr
feature, and also the value of errno will not be set to EDOM/ERANGE.

- Raw text -


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