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 2895 - Test results sensitive to float/double formatting
Summary: Test results sensitive to float/double formatting
Status: RESOLVED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 0.8.4
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Carmelo Montanez
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-19 19:16 UTC by Michael Kay
Modified: 2006-06-21 21:32 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2006-02-19 19:16:45 UTC
The following tests have expected results that are sensitive to float/double to
string conversion. Other results are permissible in these cases:

casthc14, 23
casthcds2, 8, 9, 14, 23
vardeclwithtype-6
fn-numberintg1args-2
fn-numberdec1args-2
fn-numberflt1args-1, 3
fn-numberlng1args-2
fn-numbernint1args-2
fn-numberpint1args-2
fn-numberulng1args-2, 3
fn-numbernpi1args-2
fn-numbernni1args-2
fn-avgdbl2args-1, 2

These are the tests where Saxon results revealed the problem: there may of
course be many other tests where Saxon produced the reference result but other
results would be equally acceptable.

Suggested resolution: in many of these tests the query produces a single
float/double as the result. In these cases replace the current query expression
EXPR by

EXPR eq EXPECTED

where EXPECTED is the expected result. (This also has the advantage that a
single "expected results" file containing the value "true" can be used repeatedly).

Michael Kay
Comment 1 Michael Kay 2006-03-09 16:21:19 UTC
In 0.8.6 this problem also affects:

fn-avg-mix-args-013, -015
extvardeclwithouttype-6
vardeclwithtype-6

schema-import-5
schema-import-6
schema-import-7
schema-import-9
schema-import-10
schema-import-11
schema-import-13
schema-import-14
schema-import-15
schema-import-17
schema-import-18
schema-import-19
schema-import-25
schema-import-26
schema-import-27
Comment 2 Carmelo Montanez 2006-04-25 17:45:46 UTC
Michael:

Thanks for the comment and the suggestion.  Other than 5 cases, for which the
"eq" comparisson would not work due to some casting issues (in which case two outcomes were possible), I followed your suggestion of

EXPR eq EXPECTED.

Please close the bug if this is satisfactory to you.

Thanks,
Carmelo
Comment 3 Marc Van Cappellen 2006-05-16 21:54:38 UTC
I would like to reopen this one again.

Has the approach Michael Kay is proposing, EXPR eq EXPECTED, been implemented in XQTS 0.9.0?

We have still issues with the following tests:
extvardeclwithtype-6
extvardeclwithouttype-6
vardeclwithtype-6
fn-numberflt1args-1
fn-numberflt1args-3
fn-numberlng1args-2
fn-numbernpi1args-2
fn-numberulng1args-3
fn-avgdbl2args-2
fn-avgdbl2args-4

If we take a closer look at fn-numberflt1args-1 for example
XQTS has the following expected results:
-3.402823466385289E38
-3.4028234663852885E38
But in one of our configurations we return
-3.4028234663852886E38

Thanks,
Marc
Comment 4 Carmelo Montanez 2006-05-17 18:14:07 UTC
Marc:

It looks as though plan proposed by Michael Kay will not work on every single case.  I will look at your list of tests and address each one individually.

Thanks,
Carmelo
Comment 5 Carmelo Montanez 2006-05-18 17:48:40 UTC
Marc:

I looked at each of the tests.  I have some observartions:

extvardeclwithtype-6, extvardeclwithouttype-6, vardeclwithtype-6 - For somre reason (perhaps implementation internals), the scheme does not works.  I will be more than happy to add your return value to the list of expected outcomes.
This is permissible under the guidelines.

fn-numberflt1args-1 - Changed test to use Michael suggested scheme.  Used number with higher precision for comparison.

fn-numberflt1args-3 - Suggested scheme seems not to work.  I will be happy to add your expected outcome to the list. This is permissible under the guidelines.

fn-numberlng1args-2 - Already uses Michael suggested scheme.

fn-numbernpi1args-2 - Changed the test to use Michael suggested scheme.

fn-numberulng1args-3 - Already uses Michael suggested scheme.

fn-avgdbl2args-2 - Already uses, Michael suggested scheme.

fn-avgdbl2args-4 - Changed test to use Michael's suggested scheme.


Thanks,
Carmelo
Comment 6 Carmelo Montanez 2006-06-01 20:41:31 UTC
Marc:

Do you have any feedback based on my last comment?

Thansk,
Carmelo
Comment 7 Michael Kay 2006-06-19 13:14:50 UTC
In schema-import-5, the comparison does not work because it is comparing a float to a double, which involves a conversion.  If the test is changed from 

fn:avg(($input-context1//atomic:float,$input-context1//atomic:float))) eq 1.26743233E15

to

fn:avg(($input-context1//atomic:float,$input-context1//atomic:float))) eq xs:float(1.26743233E15)

then it is legitimate to expect the answer "true".

Similary schema-import-9 should be:

(fn:abs($input-context1//atomic:float)) eq xs:float(1.26743233E15)

schema-import-13 should be:

(fn:max(($input-context1//atomic:float,$input-context1//atomic:float))) eq xs:float(1.26743233E15)

schema-import-17 should be:

(fn:min(($input-context1//atomic:float,$input-context1//atomic:float))) eq xs:float(1.26743233E15)

schema-import-25 should be:

(($input-context1//atomic:float) + ($input-context1//atomic:float)) eq xs:float(2.53486466E15)
Comment 8 Carmelo Montanez 2006-06-21 21:32:02 UTC
Michael/Mark et all:

All outstanding issues from these tests were addressed by either using 
Michael changes or adding alternate outcome.

Thanks,
Carmelo