Closed Bug 413814 Opened 17 years ago Closed 16 years ago

By default the math library on solaris is not IEEE standard.

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

x86
SunOS
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: leon.sha, Assigned: leon.sha)

References

Details

Attachments

(1 file, 1 obsolete file)

By default the math library on solaris is not IEEE standard.
When you run the automation test you will get the following result.
ecma3/Math/e15_8_2_10.abc : Math.log(-0.0000001) = -Infinity FAILED! expected: NaN
ecma3/Math/e15_8_2_10.abc : Math.log(-1) = -Infinity FAILED! expected: NaN
ecma3/Math/e15_8_2_10.abc : Math.log(-Infinity) = -Infinity FAILED! expected: NaN
ecma3/Math/e15_8_2_2.abc : Math.acos(1.00000001) = 0 FAILED! expected: NaN
ecma3/Math/e15_8_2_2.abc : Math.acos(11.00000001) = 0 FAILED! expected: NaN
ecma3/Math/e15_8_2_3.abc : Math.asin(1.000001) = 0 FAILED! expected: NaN
ecma3/Math/e15_8_2_3.abc : Math.asin(-1.000001) = 0 FAILED! expected: NaN
ecma3/Math/e15_8_2_5.abc : Math.atan2(0, -0) = 0 FAILED! expected: 3.141592653589793
ecma3/Math/e15_8_2_5.abc : Math.atan2(-0, -0) = 0 FAILED! expected: -3.141592653589793
Attached patch patch (obsolete) — Splinter Review
It is just a work around. The performance is a big problem. But it is better than return the wrong value.
Attachment #298907 - Flags: review?(treilly)
Looks fine, any ideas on what the real fix might be if this is just a workaround?
Tamarin is going to require IEEE-compliant math to work according to spec. if Solaris doesn't provide IEEE-compliant math, well, that's going to be a problem...
(In reply to comment #2)
> Looks fine, any ideas on what the real fix might be if this is just a
> workaround?
> 
In mozilla js engine, mozilla write its own math functions other than use system math library. So I think the real fix is to write our own math functions.
I'm pretty sure fdlibm isn't used on any of the major platforms any more, and I'm not entirely sure why it's still in the tree.
(In reply to comment #5)
> I'm pretty sure fdlibm isn't used on any of the major platforms any more, and
> I'm not entirely sure why it's still in the tree.
> 

Oh, Yes you are correct. fdlibm is no longer used on firefox for solaris. I have tried math.acos on solaris, the return value is also not IEEE-compliant. On mozilla 1.7 fdlibm was used, so the math function was IEEE-compliant. It is a bug of firefox I think.

Sunstudio provide a complier option -xlibmieee to make the math function IEEE-compliant. But seems that this option only set some flag in elf part of executable binary. May use this option to build firefox is OK. But for tamarin, most of time it is only a library, only this libraris built by -xlibmieee option is useless. Whether it is IEEE-compliant or not depends the executable binary who use tamarin library not tamarin library itself. I have already tried this. Also I didn't find the same option for gcc on solaris.

Another solution is we write our own math library like fdlibm. Here is also a problem, if the application who use tamarin was already complied with -xlibmiee, use our own math library maybe cause decreasing of performance.
 
The current patch only solved the testcase problem. Not all the math function here is IEEE-compliant. I'll redo the patch.

Also since there are too many "ifdef SOLARIS" here, I suggest to create a MathUtilsSolaris.cpp here.
Attached patch patch v2Splinter Review
Create a new mathutilssolaris.cpp. I didn't use -xlibmieee here since most of time tamarin is used as a library. -xlibmiee only work for the executable binary. We can not require all application who use tamarin to enable -xlibmieee. I also checked all the functions in mathutils and make sure all these functions work as IEEE standard.
Attachment #298907 - Attachment is obsolete: true
Attachment #300841 - Flags: review?(treilly)
Attachment #298907 - Flags: review?(treilly)
Attachment #300841 - Flags: review?(treilly) → review+
Checked in.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Resolved fixed engineering / work item that has been pushed.  Setting status to
verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: