<?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>3976</bug_id>
          
          <creation_ts>2006-11-17 16:59:10 +0000</creation_ts>
          <short_desc>floatingPointRound function can be simplified</short_desc>
          <delta_ts>2009-04-21 19:21:43 +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>All</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>resolved</keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sandy Gao">sandygao</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>12941</commentid>
    <comment_count>0</comment_count>
    <who name="Sandy Gao">sandygao</who>
    <bug_when>2006-11-17 16:59:10 +0000</bug_when>
    <thetext>This function currently has
2.  2^cWidth * 2^(e-1) &lt; |nV| &lt;= 2^cWidth * 2^e 
3a. (c-1) * 2^e &lt;= |nV| &lt; c * 2^e
3b. 2^(cWidth-1) &lt; c &lt;= 2^cWidth 

It&apos;s suggested to (correctly) change (2) to the following
2.  2^cWidth * 2^(e-1) &lt;= |nV| &lt; 2^cWidth * 2^e 

With the new (2) and (3a), (3b) is now redundant.

Combine the first half of (3a) and the second half of (2) 

   (c-1) * 2^e &lt;= |nV| &lt; 2^cWidth * 2^e 
-&gt; (c-1) &lt; 2^cWidth 
-&gt; c &lt; 2^cWidth + 1 
-&gt; c &lt;= 2^cWidth (because c is an integer) 

Similarly, combine the first half of (2) and the second half of (3a) 

   2^cWidth * 2^(e-1) &lt;= |nV| &lt; c * 2^e 
-&gt; 2^cWidth * 2^(e-1) &lt; c * 2^e 
-&gt; 2^cWidth &lt; c * 2 
-&gt; 2^(cWidth-1) &lt; c 

So both conditions in (3b) are implied by (2) and (3a), and (3b) should be removed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13058</commentid>
    <comment_count>1</comment_count>
    <who name="Dave Peterson">davep</who>
    <bug_when>2006-12-01 19:25:18 +0000</bug_when>
    <thetext>From the ·floatingPointRound· algorithm (as corrected by 2989):

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

&apos;  and 2^cWidth?1 &lt; c ? 2cWidth&apos; is removed.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16649</commentid>
    <comment_count>2</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2007-09-18 00:45:22 +0000</bug_when>
    <thetext>The change proposed above was approved by the WG in its call of 
1 December 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>
      
      

    </bug>

</bugzilla>