substring with infinite and NaN indexs gives incorrect values

VERIFIED DUPLICATE of bug 53518

Status

()

P3
normal
VERIFIED DUPLICATE of bug 53518
18 years ago
17 years ago

People

(Reporter: jjs, Assigned: keith)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

18 years ago
The test cases that use infinite and NaN values are not returning the correct 
substrings as per the XPath spec for substring unusuale cases.
Further investigations shows that the comparisons in StringFunctions.cpp (149+) 
allways return true,
I.e
if dbl is either NaN or +/- Infinity then 
dbl == Double::NaN   is always true
dbl == Double::POSITIVE_INFINITY is always true
dbl == Double::NEGITIVE_INFINITY is always true

This causes the checks for the unusuale cases to give incorrect results.
Anyone got a vague Idea about how/why/where?
(Reporter)

Comment 1

18 years ago
Well looks like the problem impacts windoze only. Bug 53518 is a general 
traking bug for broken maths under win2k. Can someone verify this?
Depends on: 53518
(Reporter)

Updated

18 years ago
No longer depends on: 53518
(Reporter)

Updated

18 years ago
Depends on: 53518

Comment 2

18 years ago
Testing the Javascript implementation using the following attachment gives:

NaN == NaN, false
NaN == -Infinity, false
NaN == Infinity, false
-Infinity == NaN, false
-Infinity == -Infinity, true
-Infinity == Infinity, false
Infinity == NaN, false
Infinity == -Infinity, false
Infinity == Infinity, true

I'll look into StringFunctions.cpp next

Comment 3

18 years ago
Created attachment 16732 [details]
Javascript testcase for Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY

Comment 4

18 years ago
Isn't the file you are referencing StringFunctionCall.cpp?
lines 147-152:
if ( argc == 3) {
    dbl += evaluateToNumber((Expr*)iter->next(),context, cs);
    if (dbl == Double::POSITIVE_INFINITY) ++endIdx;
    else if ( dbl == Double::NEGATIVE_INFINITY ) endIdx = 0;
    else endIdx = (Int32)floor(dbl);
 }

This seems to just be changing the ending index of the substring in a
reasonable fashion.

I checked the functions.html/functions.xml url using 2000100920/Win2000 and
the tests of +- infinity return blank which agrees with IE 5.5.

Is that not correct?
(Reporter)

Comment 5

18 years ago
Bob,

Please check the dependent bug 53518 for moe information on this bug.
jjs@acis.com.au - could you say exactly what the expected results are of loading 
your testcase in Mozilla?

Gerv

Comment 7

18 years ago
Reporter is this still a problem in the latest builds?

Comment 8

18 years ago
Marking INVALID due to lack of reponse from reporter. Reopen if anyone still
sees this problem.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → INVALID
(Reporter)

Comment 9

18 years ago
This whole problem is better documented and tracked in 53518
Status: RESOLVED → CLOSED

Updated

18 years ago
Status: CLOSED → UNCONFIRMED
Resolution: INVALID → ---

Comment 10

18 years ago
OK, reopening this bug.
It is sure valid, and is one symptom of our troubles to handle NaNs on Windows.
I don't have a windows build myself, but the js sources say VC is horked, and 
I trust them. Oh, and we don't even compile on OS/2.
Keyser, it looks like you don't have a windows build either, so resolving this
bug is probably not the right thing to do.
And INVALID is saying, that we do like the specs say, you were probably looking
for WORKSFORME. INVALID is a harsh word, don't say it unless you're 100% sure,
and have good evidence.

Axel
(Reporter)

Comment 11

18 years ago
This seems to be getting a bit out of hand. How about I just classify this as a 
duplicate of bug 53518 and allow it to disappear. Its no ones fault that 
windows is busted ass and broken down. :)

Err...I dont have a resolution of duplicate...Can some one make this go away?
No longer depends on: 53518

Comment 12

18 years ago
Hi Jus,
duplicate is a good idea, doing so.
See more substring foo in bug 59649

Axel

*** This bug has been marked as a duplicate of 53518 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 18 years ago18 years ago
Resolution: --- → DUPLICATE

Comment 13

17 years ago
bitching buttons, verfication spam
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.