Closed
Bug 300633
Opened 19 years ago
Closed 14 years ago
patch to fix javascript math functions on linux/alpha
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: agriffis, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (X11; U; Linux alpha; en-US; rv:1.7.8) Gecko/20050711 Firefox/1.0.4 Build Identifier: Mozilla/5.0 (X11; U; Linux alpha; en-US; rv:1.7.8) Gecko/20050711 Firefox/1.0.4 The jslibmath functions don't work correctly on alpha. I tested building both with and without -mieee. In both cases, log() and pow() (and possibly others) miscalculate their answers. Looking into jslibmath.h, I found the following snippet: #elif defined(linux) #define fd_atan atan #define fd_atan2 atan2 #define fd_ceil ceil #define fd_cos cos #define fd_fabs fabs #define fd_floor floor #define fd_fmod fmod #define fd_sin sin #define fd_sqrt sqrt #define fd_tan tan #define fd_copysign copysign extern double fd_asin __P((double)); extern double fd_acos __P((double)); extern double fd_exp __P((double)); extern double fd_log __P((double)); extern double fd_pow __P((double, double)); I don't know the history that led to using the mozilla-defined versions of the latter functions, but with modern glibc I can't imagine it's the best decision. For alpha, I am using the following patch in the Gentoo ebuild: --- mozilla/js/src/jslibmath.h.agriffis 2005-07-11 14:58:35 -0400 +++ mozilla/js/src/jslibmath.h 2005-07-11 15:09:13 -0400 @@ -69,6 +69,9 @@ #elif defined(HPUX) #define JS_USE_FDLIBM_MATH 1 +#elif defined(linux) && defined(__alpha__) +#define JS_USE_FDLIBM_MATH 0 + #elif defined(linux) #define JS_USE_FDLIBM_MATH 1 I restricted the change to alpha, where it's necessary for correct operation, so that I wouldn't accidentally break other architectures. However my testing indicates it would be safe for amd64 and x86 at least. Frankly it would probably be fine to disable JS_USE_FDLIBM_MATH for all Linux platforms. Additionally I ran through the Javascript test suite from http://www.mozilla.org/js/tests/library.html Before the change, 362 of 1605 tests failed on alpha. After the change, 300 of 1605 tests failed. Additional checking shows that the 362 are a superset of the 300, so that's a full 62 tests fixed by this single change on alpha. I ran through the same test suite on amd64; there were zero changes as a result of disabling JS_USE_FDLIBM_MATH. Reproducible: Always Steps to Reproduce: unit test: 1. go to http://bluweb.com/us/chouser/logcheck.html 2. note the answer is incorrect when run on alpha practical test: 1. go to maps.google.com 2. click on the "satellite" button 3. the javascript will chug for a while, then finally announce that it's taking a long time, would you like to terminate the script?
| Reporter | ||
Updated•19 years ago
|
Summary: js math functions broken on alpha → patch to fix javascript math functions on linux/alpha
Updated•19 years ago
|
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.7 Branch
Updated•19 years ago
|
Flags: testcase-
Comment 1•14 years ago
|
||
The file that is mentioned in this bug bears little resemblance to the patch in comment 0. Patches should be attached to bugs and set with a review flag. Unfortunately most developers don't have the bandwidth to poke through bugs and find patches in comments. If this is still an issue on an Alpha a new bug would be best. https://developer.mozilla.org/En/Developer_Guide/How_to_Submit_a_Patch
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•