RE: float/double: Why no totalDigits or fractionDigits

The float and double datatypes follow the IEEE 754 definitions which do
not 
allow format restrictions based on the number of digits.  However, you
can create a subtype, using a pattern, to restrict the lexical format in
the manner you wish.

Decimal is widely supported and should be interoperable.

All the best, Ashok 
===========================================================


-----Original Message-----
From: Richard Monson-Haefel [mailto:Richard@Monson-Haefel.com] 
Sent: Thursday, March 07, 2002 6:53 AM
To: www-xml-schema-comments@w3.org; Paul.V.Biron@kp.org
Subject: float/double: Why no totalDigits or fractionDigits

In XML Schema: Part 2: I noticed that decimal type has the same facets
as float and double but also has two others: totalDigits and
fractionDigits. These seem very useful especially when creating a simple
type for holding currency values (I want it to have 2 decimal points and
not more).  Why are these facets (totalDigits and fractionDigits) not a
part of the float and double built-in type?

Also, are their problems using decimal instead of float or double. Is it
less likely to be properly supported; is it portable?

Thanks in advance,

Richard
--
Richard Monson-Haefel
Author of Java Web Service (Titan Books 2002)
Author of Enterprise JavaBeans, 3rd Edition  (O'Reilly 2001)
Co-Author of Java Message Service (O'Reilly 2000)
http://www.jMiddleware.com

Received on Thursday, 7 March 2002 09:59:41 UTC