Closed Bug 11502 Opened 25 years ago Closed 25 years ago

Alpha/Linux doesn't like denormalized values either.

Categories

(Core :: JavaScript Engine, defect, P3)

DEC
Linux
defect

Tracking

()

VERIFIED DUPLICATE of bug 9967

People

(Reporter: niles, Assigned: mike+mozilla)

References

Details

While you carefully check for INF and NAN you never checked for
denormalized values in your double precision checks.  With all the
infrastructure in place it was trival to add it.  Alpha/Linux with
glibc-2.1 requires this patch:

--- jsnum.h	Mon Aug  9 22:43:45 1999
+++ jsnum.h.new	Mon Aug  9 22:43:28 1999
@@ -57,6 +57,10 @@ JS_BEGIN_EXTERN_C
 #define JSDOUBLE_IS_NEGZERO(d)  (JSDOUBLE_HI32(d) == JSDOUBLE_HI32_SIGNBIT && \
 				 JSDOUBLE_LO32(d) == 0)

+#define JSDOUBLE_IS_DENORMAL(x)                                               \
+    ((JSDOUBLE_HI32(x) & JSDOUBLE_HI32_EXPMASK) == 0 &&                       \
+    (JSDOUBLE_LO32(x) || (JSDOUBLE_HI32(x) & JSDOUBLE_HI32_MANTMASK)))

 /*
  * JSDOUBLE_IS_INT first checks that d is neither NaN nor infinite, to avoid
  * raising SIGFPE on platforms such as Alpha Linux, then (only if the cast is
@@ -64,7 +68,7 @@ JS_BEGIN_EXTERN_C
  * comparisons under MSVC.
  */
 #define JSDOUBLE_IS_INT(d, i) (JSDOUBLE_IS_FINITE(d) && !JSDOUBLE_IS_NEGZERO(d)
\
-			       && ((d) == (i = (jsint)(d))))
+			       && !JSDOUBLE_IS_DENORMAL(d) && ((d) == (i = (jsint)(d))))

 /* Initialize the Number class, returning its prototype object. */
 extern JSObject *
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
Denormalized values are part of the JavaScript language standard, and have been
with the language since very early on.  (Waldemar, Brendan - can you confirm?)

This issue has come up before with various OSes running on the Alpha; the proper
solution is to add a compiler flag to turn off floating point exceptions; I
belive the proper flag is -mieee.  If you can find a clean place to incorporate
that flag into the make system (possibly including the standalone 'Makefile.ref'
file for the JavaScript shell) I'd be happy to apply a patch.
Status: RESOLVED → REOPENED
Depends on: 9967
Marking as depending on 9967, and reopening; I think I was a little rash in
closing it.  The fact that we need to suppress floating point exceptions for the
Alpha architecture remains.
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: INVALID → DUPLICATE
Here we go.  Now that it's open, I can mark it as a dup of 9967.  Sorry for the
excess traffic, cc list.

*** This bug has been marked as a duplicate of 9967 ***
Status: RESOLVED → VERIFIED
verified dup...see Bug 9967
Is this really a DUP, or do we need something like fpsetmask(0) called early in
main on Linux/Alpha as well as on FreeBSD/Intel?

/be
You need to log in before you can comment on or make changes to this bug.