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

Re: Digit required before/after decimal point?

From: Ashok Malhotra <petsa@us.ibm.com>
Date: Thu, 11 Jan 2001 08:47:45 -0500
To: James Clark <jjc@jclark.com>
Cc: XML Schema Comments <www-xml-schema-comments@w3.org>
Message-ID: <OF3E5D47F5.A84F3E33-ON852569D1.004B3CD2@pok.ibm.com>

James:
Its possible that you are reading an earlier draft of the datatypes
document.
My comments below.  Here are extracts from the latest draft:

3.2.3.1 Lexical representation

decimal has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39) separated by a period
as a decimal indicator, in accordance with the scale and precision facets, with an optional leading sign. If the sign is omitted,
"+" is assumed. Leading and trailing zeroes are optional. If the fractional part is zero, the period and following zero(es) can be
omitted. For example: -1.23, 12678967.543233, +100000.00.

3.2.3.2 Canonical representation

The canonical representation for decimal is defined by prohibiting certain options from the Lexical representation (3.2.3.1).
Specifically, the preceding optional "+" sign is prohibited. The decimal point is required. Leading and trailing zeroes are
prohibited subject to the following: there must be at least one digit to the right and to the left of the decimal point which may be
a zero.

All the best, Ashok


James Clark <jjc@jclark.com>@w3.org on 01/10/2001 10:47:44 PM

Sent by:  www-xml-schema-comments-request@w3.org


To:   XML Schema Comments <www-xml-schema-comments@w3.org>
cc:
Subject:  Digit required before/after decimal point?



Is ".1" allowed as a lexical representation of a decimal? How about
"1."? How about for double and float?
AM>> Yes.  For decimal as well as float and double since the mantissa
AM>> is defined as a decimal.

For decimal, the canonical representation says it excludes leading
zeros, which would suggest that the canonical representation of "0.1" is
".1".  Is that intended?
AM>> The canonical representation now requires at least one digit
AM>> to the right and the left of the decimal point so the canonical
AM>> representation is 1.0


I think things work out OK if the lexical representation always requires
a digit after the decimal point.  This would be consistent with integer
not allowing a decimal point.

What is the canonical representation of the decimal "1.0"? Presumably
"1".  Saying that trailing zeros are prohibited is rther a roundabout
way of saying this.
AM>> It's 1.0

I would suggest things could be made much more clear, precise and
unambiguous by having the spec include a regex for the lexical
representation and the canonical representation of each the primitive
datatypes (perhaps as an annotation in the schema for datatype
definitions).
AM>> Its a good idea for all the datatypes.


James
Received on Thursday, 11 January 2001 08:47:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:49 GMT