W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2007

[Bug 4621] [F&O] rounding for duration *|div number

From: <bugzilla@wiggum.w3.org>
Date: Sun, 10 Jun 2007 23:38:54 +0000
To: public-qt-comments@w3.org
Message-Id: <E1HxWzm-0008GO-Oy@wiggum.w3.org>


           Summary: [F&O] rounding for duration *|div number
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators
        AssignedTo: ashok.malhotra@oracle.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org

This arises from bug 713 (member-only) against the XSLT test suite.

What is the correct result of xs:yearMonthDuration('-P1M')*0.5, or
xs:yearMonthDuration('-P1M') div 2? 

The spec says (10.6.3, 10.6.4) "The result is rounded to the nearest month. For
a value v, 0 <= v < 0.5 rounds to 0; 0.5 <= v < 1.0 rounds to 1." It's not
clear from that which way the rounding works for negative numbers.

My proposal would be to follow the rules of the round() function, so -0.5
rounds to 0. Specifically, the result should be the yearMonthDuration whose
length in months is equal to round() applied to result of multiplying/dividing
the length in months of $arg1 by the value of $arg2.
Received on Sunday, 10 June 2007 23:38:56 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:33 UTC