Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2000 22:02:18 +0100
From:      Markus Holmberg <saska@acc.umu.se>
To:        Martin Cracauer <cracauer@cons.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Should -mieee-fp equal fpsetmask(0) to avoid SIGFPE on FreeBSD?
Message-ID:  <20000105220218.A77259@fysgr387.sn.umu.se>
In-Reply-To: <20000105092356.A8100@cons.org>; from cracauer@cons.org on Wed, Jan 05, 2000 at 09:23:57AM %2B0100
References:  <20000104121459.A8959@cons.org> <87632.947017515@monkeys.com> <20000105055138.A74746@fysgr387.sn.umu.se> <20000105092356.A8100@cons.org>

next in thread | previous in thread | raw e-mail | index | archive | help
OK, so the saga goes on. Here's a reply to Martins mail (that was posted
on Bugzilla as a comment to the relevant bug).

This discussion was on it's way becoming a Mozilla issue, and hence not
belong on freebsd-hackers, but the comment from waldemar@netscape.com
suggests that it *is* a question of standards compliance from the OS
side.

But I'm not sure I understand the difference between "undefined" and
"unspecified"? (What a cast from double to int should return when the source
doesn't fit into the destination).

I'm about to give up on this.. For some (to me) unclear reason there are
no intentions on making FreeBSD behave conforming to IEEE 754, and it's
not clear if the Mozilla code is correct or not.

Just want Mozilla work on FreeBSD too :/. (Should be in everyones interest)

Put yourself on the cc: list of
http://bugzilla.mozilla.org/show_bug.cgi?id=9967 to get updates and following
the development if you're interested.

(As I'm not sure if the discussion of the Mozilla code belongs on
freebsd-hackers.. Though discussion of IEEE 754 conformance certainly
does).

Markus


--- FORWARDED MAIL-- --------------------------------------------------------

From: bugzilla-daemon@mozilla.org
To: mccabe@netscape.com, robinson@netrinsics.com, cbegle@netscape.com
Cc: saska@acc.umu.se, briano@netscape.com, gatgul@voicenet.com,
	brendan@mozilla.org, daeron@Wit401305.student.utwente.nl,
	clayton@netscape.com, skumle@grin.dk
Subject: [Bug 9967] Changed - JSDOUBLE_IS_INT throws SIGFPE without integer range check

http://bugzilla.mozilla.org/show_bug.cgi?id=9967

*** shadow/9967	Wed Jan  5 09:50:21 2000
--- shadow/9967.tmp.4454	Wed Jan  5 12:32:59 2000
***************
*** 379,381 ****
--- 379,409 ----
  
  Martin
  
+ 
+ ------- Additional Comments From waldemar@netscape.com  2000-01-05 12:32 -------
+ It's not as simple as you state.  The code you propose has three programming 
+ bugs:
+ 
+ 1.  It doesn't work for NaN under MSVC due to a bug in MSVC.
+ 2.  It doesn't work for -0.0.
+ 3.  It doesn't work for any non-integral number (such as 1.5) between INT_MIN and 
+ INT_MAX.
+ 
+ The old C standard specified that a double-to-int conversion is undefined if the 
+ source value can't fit in the destination value.  However, the new C9X standard 
+ differs here:  if an implementation supports IEEE 754, then it should set the 
+ invalid exception flag and return an unspecified result (paragraph F.4).  
+ Trapping on flags is to be turned off by default.  (If an implementation doesn't 
+ support IEEE 754, then the point is moot because the ECMAScript standard requires 
+ IEEE 754.)
+ 
+ 
+ Note: The finiteness range check is there only to work around the MSVC NaN bug 
+ and is not needed on correctly-behaving platforms such as the Mac.  On a 
+ correctly implemented platform the following is sufficient:
+ 
+ #define JSDOUBLE_IS_INT(d, i) (((d) == (i = (jsint)(d))) && 
+ !JSDOUBLE_IS_NEGZERO(d))
+ 
+     Waldemar
+ 



-- 

Markus Holmberg         |       Give me UNIX or give me a typewriter.
saska@acc.umu.se        |       http://www.freebsd.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000105220218.A77259>