This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 3976 - floatingPointRound function can be simplified
Summary: floatingPointRound function can be simplified
Status: CLOSED FIXED
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Datatypes: XSD Part 2 (show other bugs)
Version: 1.1 only
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: XML Schema comments list
URL:
Whiteboard: thimble, easy
Keywords: resolved
Depends on:
Blocks:
 
Reported: 2006-11-17 16:59 UTC by Sandy Gao
Modified: 2009-04-21 19:21 UTC (History)
0 users

See Also:


Attachments

Description Sandy Gao 2006-11-17 16:59:10 UTC
This function currently has
2.  2^cWidth * 2^(e-1) < |nV| <= 2^cWidth * 2^e 
3a. (c-1) * 2^e <= |nV| < c * 2^e
3b. 2^(cWidth-1) < c <= 2^cWidth 

It's suggested to (correctly) change (2) to the following
2.  2^cWidth * 2^(e-1) <= |nV| < 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 <= |nV| < 2^cWidth * 2^e 
-> (c-1) < 2^cWidth 
-> c < 2^cWidth + 1 
-> c <= 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) <= |nV| < c * 2^e 
-> 2^cWidth * 2^(e-1) < c * 2^e 
-> 2^cWidth < c * 2 
-> 2^(cWidth-1) < c 

So both conditions in (3b) are implied by (2) and (3a), and (3b) should be removed.
Comment 1 Dave Peterson 2006-12-01 19:25:18 UTC
From the ·floatingPointRound· algorithm (as corrected by 2989):

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

'  and 2^cWidth?1 < c ? 2cWidth' is removed.
Comment 2 C. M. Sperberg-McQueen 2007-09-18 00:45:22 UTC
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'd be grateful.   To signal that the resolution is acceptable, 
change the status of the issue to CLOSED.  Otherwise, to signal 
that it's NOT acceptable, change the status to REOPENED (and 
tell us what's wrong).

If we don't hear from you in the next three weeks, we'll assume 
that silence betokens consent, and close the issue ourselves.