<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>4621</bug_id>
          
          <creation_ts>2007-06-10 23:38:54 +0000</creation_ts>
          <short_desc>[FO] rounding for duration *|div number</short_desc>
          <delta_ts>2007-11-16 09:18:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Functions and Operators 1.0</component>
          <version>Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Ashok Malhotra">ashok.malhotra</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>15345</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-06-10 23:38:54 +0000</bug_when>
    <thetext>This arises from bug 713 (member-only) against the XSLT test suite.

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

The spec says (10.6.3, 10.6.4) &quot;The result is rounded to the nearest month. For a value v, 0 &lt;= v &lt; 0.5 rounds to 0; 0.5 &lt;= v &lt; 1.0 rounds to 1.&quot; It&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15353</commentid>
    <comment_count>1</comment_count>
    <who name="Ashok Malhotra">ashok.malhotra</who>
    <bug_when>2007-06-11 13:33:06 +0000</bug_when>
    <thetext>Makes sense.  In fact, we should say that the result is computed using fn:round().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15390</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-06-12 20:31:39 +0000</bug_when>
    <thetext>Proposed change:

1. Change the summary of the two functions from

Summary: Returns the result of [multiplying|dividing] the value of $arg1 by $arg2. The result is rounded to the nearest month. For a value v, 0 &lt;= v &lt; 0.5 rounds to 0; 0.5 &lt;= v &lt; 1.0 rounds to 1.

to

Summary: Returns the result of [multiplying|dividing] the value of $arg1 by $arg2. The result is rounded to the nearest month.

2. Add immediately after the summary of each function, the paragraph:

The result is the xs:yearMonthDuration whose length in months is equal to the result of applying the fn:round function to the value obtained by [multiplying|dividing] the length in months of $arg1 by the value of $arg2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15651</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-06-27 14:58:16 +0000</bug_when>
    <thetext>This wording was accepted by the WGs on 27 June 2007</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15990</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2007-07-31 20:20:09 +0000</bug_when>
    <thetext>Erratum FO-E12 has been drafted.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>