OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Best way to represent fractional values?

[ Lists Home | Date Index | Thread Index ]

On Mon, Feb 10, 2003 at 01:51:51PM -0500, Chiusano Joseph wrote:
><Snip>
>What you suggest would limit me to 0.33
></Snip>
>
>Not at all, if you make fractionDigits greater than 2.

Which continues the restriction.  It *still* never represents a "repeating
decimal".  Lisp calls these (I think mathematically correctly) rational
numbers, and they are a data type, not an expression.  It's perfectly
reasonable to want to preserve this information, instead of throwing it away
immediately.  It's not supported by W3C XML Schema, though.

Several possibilities exist:

1. make it a structured thing, as proposed:
<rational><numerator>1</numerator><denominator>3</denominator></rational>

Boy, oh boy.  Makes one wish it were possible to derive from anySimpleType,
huh?

2. write it as a regex:
<rational>\d+/\d+</rational>

Nicer, but there's no way to know it has numeric semantics, which is much of
the point of having a type system in the first place (if only XML *had* a
type system, instead of a collection of collections of types).

3. write it as a list:
<rational>1 3</rational>

You want to constrain the maxLength and minLength facets, and make it a list
of Integer in all likelihood.  This still doesn't have the right semantics,
but it does identify each of the particles as a numeric frob.

4. develop a type library for XML based on theory, not on horse-trading, and
systematic rather than shapeless bag of bags

There are some quite nice mathematical theories running around for the
numeric parts, some of which, as I understand it, are quite mature.  Being
able to say that a number is-a number would be a pleasant thing.  Typing of
things that aren't numbers, such as strings, BLOBs, dates, or grues, is at a
perhaps significantly less mature state of development, but applying a
theory, *any* theory, might prove at least an interesting contrast.

Amy!
-- 
Amelia A. Lewis                    amyzing {at} talsever.com
Boxing is a lot like ballet, except that they don't dance, there isn't
any music, and they hit each other.




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS