[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: bohemians, gentry
> 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. This does not follow from what you quoted. Many IEEE systems will accept literals expressed in arbitrary local format, and convert to value space accordingly. I think it is broken for WXST to say that providing extra precision is a validation error. It is much less broken to say that the extra precision is discarded. But then you're right back to the value-space problems Rich brought up. > Of course, if you *did* use these datatypes, then a wizard could > make safe assumptions about precision, A wizard could also make such safe assumptions given a simple set of modular, generic constraints that complement rather than complicate the lexical basis. > 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. So do tell. What *does* that mean? I assume it means "limited by machine resource constraints"? I don't see that such a vagary provides any interop benefits whatsoever. > 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. I don't understand the gain you see here. I'm thinking as someone who writes software, and I'm not sure how the xsd:decimal has helped me here. Certainly, since I want to stay paid by my client, I'm not going to allocate all available memory for every number that is marked as xsd:decimal. How I would actually code it probably depends on whether I were working in a static or dynamic library. In the former case, I guess the need for static type declations is some weak justification, but I would hope that my language provides enough generic escapes to write things more efficiently, anyway. In the case of dynamic languages, I see no reason why I wouldn't allocate structures for numbers as I come across them, adjusting for size as I need to. So I am completely missing what that data type buys me. > 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? No. In fact, your examples demonstrate just one more bit of poison introduced by careless use of data types: false promises. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|