delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/09/18/12:51:12

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
Date: Thu, 18 Sep 2003 12:59:14 +0300 (EET DST)
From: Esa A E Peuha <peuha AT cc DOT helsinki DOT fi>
Sender: peuha AT sirppi DOT helsinki DOT fi
To: djgpp-workers AT delorie DOT com
Subject: Re: Bug in modfl() in libc.a
In-Reply-To: <163.2566e055.2c8f7691@aol.com>
Message-ID: <Pine.OSF.4.58.0309181250050.11935@sirppi.helsinki.fi>
References: <163 DOT 2566e055 DOT 2c8f7691 AT aol DOT com>
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

On Tue, 9 Sep 2003 Kbwms AT aol DOT com wrote:

> According to paragraph F.9.3.12 of ISO/IEC 9899:1999 (E),
>
> -- modfl(+-Infinity, iptr) returns +-0 and stores +-Infinity in the
>                in the object pointed to by iptr
>
> modfl in libc.a:
> ---------------
> modfl(+Inf, &IntPart): FracPart = -NaN, IntPart = +Inf
> modfl(-Inf, &IntPart): FracPart = -NaN, IntPart = -Inf

Is it important to return -0 for -Inf? If not, then the following patch
should be sufficient:

Index: modfl.S
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/math/modfl.S,v
retrieving revision 1.1
diff -c -r1.1 modfl.S
*** modfl.S	25 Nov 1994 19:59:40 -0000	1.1
--- modfl.S	18 Sep 2003 09:55:44 -0000
***************
*** 17,22 ****
--- 17,33 ----
  	fldcw -2(%ebp)
  	fld %st(0)
  	fstpt (%eax)
+ 	fucom %st(1)
+ 	fnstsw -2(%ebp)
+ 	movw -2(%ebp),%dx
+ 	andb $0x40,%dh
+ 	jz 0f
+ 	fstp %st(0)
+ 	fstp %st(0)
+ 	fldz
+ 	jmp 1f
+ 0:
  	fsubrp %st,%st(1)
+ 1:
  	leave
  	ret

-- 
Esa Peuha
student of mathematics at the University of Helsinki
http://www.helsinki.fi/~peuha/

- Raw text -


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