Hmm. Apparently I have to set $div to xs:double. That still seems unnecessary
and feels like a bug.
Cheers,
E.
Eliot Kimber
On 8/11/17, 10:45 AM, "general-boun...@developer.marklogic.com on behalf of
Eliot Kimber" wrote:
(ML 8.0-3.2)
In my xquery I’m doing this:
let $total := xs:dayTimeDuration("PT6M38.33S")
let $fastest-three := xs:dayTimeDuration("PT4M6.258784S")
let $div := ($fastest-three div $total)
return ($div)
Which returns:
0.6182280621595159793
If I then try to multiple $div by 100 (to get a percent) I get decimal
overflow:
[1.0-ml] XDMP-DECOVRFLW: (err:FOAR0002) $div * 100 -- Decimal overflow
Which is not at all expected.
I also noticed that ML 8 does not appear to support the XQuery 3.x
two-argument round() function, e.g., round($div, 2).
Why am I getting a decimal overflow here?
As a test I tried doing the same thing with Saxon 9.7 and XSLT 3:
http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
exclude-result-prefixes="xs"
version="3.1">
div:
$div * 100:
round($div, 2) =
Which produces:
div: 0.61822806215951597921
$div * 100: 61.822806215951597921
round($div, 2) = 0.62
Thanks,
Eliot
--
Eliot Kimber
http://contrext.com
___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general