From the spec: "a number is true if and only if it is neither positive or negative zero nor NaN" - but XPath::Value::toBoolean() only checks for 0.
Created attachment 13227 [details] proposed fix Fixes that, and also the substring-after() function.
Committed revision 19697.
The more elegant and efficient way to fix bugs like this is to take into account the fact that comparison expressions including NaN always return false. So this change would have been my recommendation: - return m_number != 0; + return !(m_number == 0); // true for NaN
(In reply to comment #3) > + return !(m_number == 0); // true for NaN I'm not sure if this idiom can be used here - we want to convert NaN to false, not to true.
Oh... So, I think there wasn't any bug here at all - it was the other change in this patch that fixed the bug!
Wrong again - I actually believe the landed fix is correct :-)
(In reply to comment #6) > Wrong again - I actually believe the landed fix is correct :-) I believe that no matter which behavior we want for NaN, one of (m_number != 0.0) or !(m_number == 0.0) should work. I'm surprised to hear that's not true.