W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2002

RE: float/double: Why no totalDigits or fractionDigits

From: Ashok Malhotra <ashokma@microsoft.com>
Date: Thu, 7 Mar 2002 06:58:29 -0800
Message-ID: <E5B814702B65CB4DA51644580E4853FB019EE8C8@red-msg-12.redmond.corp.microsoft.com>
To: <Richard@Monson-Haefel.com>, <www-xml-schema-comments@w3.org>, <Paul.V.Biron@kp.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:57 UTC