Project

Profile

Help

Why does xs:dayTimeDuration('PT0.001S') * 60000 * 60 give PT0.817405952S?

Added by Martin Honnen over 2 years ago

I am kind of confused why Saxon Java and CS give a strange result for xs:dayTimeDuration('PT0.001S') * 60000 * 60:

PS C:\Users\marti> & 'C:\Program Files\Saxonica\SaxonCS-11.3\SaxonCS.exe' query -qs:"xs:dayTimeDuration('PT0.001S') * 60000 * 60"
<?xml version="1.0" encoding="UTF-8"?>PT0.817405952S

With BaseX or Saxon-JS I get PT1H.


Replies (2)

RE: Why does xs:dayTimeDuration('PT0.001S') * 60000 * 60 give PT0.817405952S? - Added by Michael Kay over 2 years ago

Good catch. It's an overflow in 32-bit int arithmetic occurring in DayTimeDurationValue.multiply()

    (1-2/2)

    Please register to reply