<?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>2989</bug_id>
          
          <creation_ts>2006-03-07 04:18:08 +0000</creation_ts>
          <short_desc>Datatypes 2006-02-17 WD: floatingPointRound function</short_desc>
          <delta_ts>2007-09-18 12:46:12 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XML Schema</product>
          <component>Datatypes: XSD Part 2</component>
          <version>1.1 only</version>
          <rep_platform>Macintosh</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>thimble, easy</status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Xan Gregg">xan.gregg</reporter>
          <assigned_to name="C. M. Sperberg-McQueen">cmsmcq</assigned_to>
          
          
          <qa_contact name="XML Schema comments list">www-xml-schema-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>8613</commentid>
    <comment_count>0</comment_count>
    <who name="Xan Gregg">xan.gregg</who>
    <bug_when>2006-03-07 04:18:08 +0000</bug_when>
    <thetext>The function floatingPointRound() in APpendix E.1 appears to have incorrect and/or redundant information. Below is an excerpt, converted to ASCII.

   2. So select e that 2^cWidth * 2^(e ? 1) &lt; |nV| &lt;= 2^cWidth * 2^e .
   3. So select c that  (c ? 1) * 2^e &lt;= |nV| &lt;c × 2^e  and  2^(cWidth?1) &lt; c &lt;= 2^cWidth .

It&apos;s the second clause of step #3 (3b) that is at issue (the part after &quot;and&quot;). 

&quot;2^(cWidth?1) &lt; c&quot; seems redundant since is c &lt;= 2^(cWidth-1), then by the (3a), |nV| &lt; 2^(cWidth -1 + e), but by (2), we already have 2^(cWidth + e - 1) &lt; |nV|.

&quot;c &lt;= 2^cWidth&quot; indicates something is wrong. Suppose |nV| == 2^cWidth * 2^e, as permitted by (2). Then,  |nV| &lt; c * 2^e (from (3a)) implies 2^cWidth * 2^e &lt; c * 2^e which reduces to 2^cWidth &lt; c, so c can&apos;t be less than or equal to 2^cWidth as (3b) requires.

Perhaps the ... &lt;= |nV| &lt; ... in (3a) should be ... &lt; |nV| &lt;= ... and (3b) is entirely redundant.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>8643</commentid>
    <comment_count>1</comment_count>
    <who name="Dave Peterson">davep</who>
    <bug_when>2006-03-09 03:31:13 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; Perhaps the ... &lt;= |nV| &lt; ... in (3a) should be ... &lt; |nV| &lt;= ... and (3b) is
&gt; entirely redundant.

Actually, it&apos;s 2 that is in error.  The &apos;&lt;&apos; and &apos;&lt;=&apos; should be switched.  That puts |nV| in the proper top-open interval of normaiized values corresponding to e.  Then 3 correctly finds adjacent values (c-1)*2^e and c*2^e in the *closed* interval that bracket |nV|.  If |nV| *is* one of the floating point values, the &apos;&lt;= will insure that we ultimately get the one that is in the interval.

(Note that in 3b. the &apos;&lt;&apos; and &apos;&lt;=&apos; should *not* be switched.  The &apos;&lt;&apos; insures that (c-1)*2^e is in the e-segment and the &apos;&lt;=&apos; allows the approximation to round correctly for exact values higher than the last floating-point value in the partition.)

It&apos;s entirely possible that an exact value |nV| very close to the top of the e-segment will round to the floating-point value that is the top of the segment and is not part of the interval, but at that point the algorithm no longer cares what segment the rounded-to value is in.

Of course, I&apos;m fallible; check me on this!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12961</commentid>
    <comment_count>2</comment_count>
    <who name="Dave Peterson">davep</who>
    <bug_when>2006-11-18 02:03:40 +0000</bug_when>
    <thetext>Approved by the WG; awaiting incorporation into the status quo document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16638</commentid>
    <comment_count>3</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2007-09-18 00:40:02 +0000</bug_when>
    <thetext>The change proposed above was approved by the WG in its call of 
17 November 2006.  It is now reflected in the status quo version 
of the Datatypes spec.  Accordingly, I am setting the disposition of 
this issue to RESOLVED / FIXED.

If the originator of the issue would examine the change and let 
us know whether it satisfactorily resolves the problem or not, 
we&apos;d be grateful.   To signal that the resolution is acceptable, 
change the status of the issue to CLOSED.  Otherwise, to signal 
that it&apos;s NOT acceptable, change the status to REOPENED (and 
tell us what&apos;s wrong).

If we don&apos;t hear from you in the next three weeks, we&apos;ll assume 
that silence betokens consent, and close the issue ourselves.   </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16666</commentid>
    <comment_count>4</comment_count>
    <who name="Xan Gregg">xan.gregg</who>
    <bug_when>2007-09-18 12:46:12 +0000</bug_when>
    <thetext>Marking closed.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>