[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: bohemians, gentry


ieee double definition
At 02:43 PM 12/4/2002 -0500, Rich Salz wrote:
>I hope the following is concrete enough.

Yes - thanks for this! This is exactly the kind of concrete example I am 
looking for.

>Imagine the following element:
><pi>3.14159265358979323846264338327950288419716939937510582097494459230781640628620899 
></pi>
>
>(See http://www.joyofpi.com/pi.htm for details).
>
>Suppose you are building a web services front-end to Macsyma (or 
>Mathematica).  You might be tempted to add this attribute (assuming the 
>"obvious" xmlns declarations)
>         xsi:type=xsd:float
>
>The problem is, that if you use something like DevStudio.Net and its 
>wizards, you've guaranteed to have lost precision.  That's a shame, 
>because the math tool has effectively infinite precision, but my 
>XML/WS/XSD tool artificially limits itself to IEEE floats because it 
>thinks it's doing me a favor by making it trivial to generalize object 
>serialization through XML.

Well, there's a problem you will encounter earlier. Float and double are 
restricted to 32 and 64 bits respectively:

>3.2.4 float
>
>    [Definition:] float corresponds to the IEEE single-precision 32-bit
>    floating point type [IEEE 754-1985].
>
>3.2.5 double
>
>    [Definition:] The double datatype corresponds to IEEE
>    double-precision 64-bit floating point type [IEEE 754-1985].

That means that your document would not validate if you used these 
datatypes. Of course, if you *did* use these datatypes, then a wizard could 
make safe assumptions about precision, but your example precludes use of 
these types.

There *is* a datatype that I could use to represent Pi to ten thousand 
digits (or one million if I bought the book):

>3.2.3 decimal
>
>    [Definition:] decimal represents arbitrary precision decimal
>    numbers.

If the document uses this datatype, then the Wizards had better be aware of 
what the phrase "arbitrary precision" means. Using the datatype is a clear 
warning to applications. Without the datatype, an application might 
encounter decimals of very different sizes, but not be aware that arbitrary 
precision numbers might arise until they encounter the first REALLLY BIG 
number.

Of course, you can write schemas that use decimals of fixed precision too. 
In either case, the schema is explicit about the kinds of data applications 
should be prepared to handle.

So isn't the use of datatypes more helpful than harmful in this case?

Jonathan


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.