This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 14905 - [QT3] math-exp-003
Summary: [QT3] math-exp-003
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3 & XPath 3 Test Suite (show other bugs)
Version: Member-only Editors Drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Benjamin Nguyen
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-22 14:42 UTC by Tim Mills
Modified: 2011-11-25 14:22 UTC (History)
1 user (show)

See Also:


Attachments

Description Tim Mills 2011-11-22 14:42:02 UTC
I fail this test because our implementation gives the result as

2.718281828459045e0

Looking at the representation of the values using System.BitConverter.DoubleToInt64Bits (.NET) or java.lang.Double.doubleToRawLongBits (Java) I get:

Expected result = 4613303445314885482

Actual result = 4613303445314885481

The bit pattern for System.Math.E (.NET) or java.lang.Math.E (Java) is 4613303445314885481.

    <test-case name="math-exp-003">
        <description>Evaluate the function exp() with the argument set to 1</description>
        <created by="O'Neil Delpratt, Saxonica" on="2010-12-10"/>        
        
        <test>math:exp(1)</test>
        <result>
            <assert-eq>2.7182818284590455e0</assert-eq>
        </result>
    </test-case>
Comment 1 Michael Kay 2011-11-23 19:47:16 UTC
It appears that in Java, the expression

Math.exp(1.0e0) == Math.E

returns false ;-(

I'm not sure exactly what the IEEE spec has to say about the required precision of the result: it needs a lot of study to decipher the meaning. Pragmatically, it would appear to make sense for our expected result to tolerate the value that the Java library delivers, as well as what would appear to be the "correct" result. So I propose to change the test to allow an epsilon variation in the result.
Comment 2 Michael Kay 2011-11-23 19:59:03 UTC
Changed test to allow a variation of 1e-15 in the result.
Comment 3 Tim Mills 2011-11-25 14:22:04 UTC
Confirmed fixed.  Thanks.