RE: ISSUE-126 (Revisit Datatypes): A new proposal for the real <-> float <-> double conundrum

> 
> The best explanation that I know of was written by Mark 
> Reinhold, a member of the original schema WG (...and, if 
> memory serves me, was a member of the team that wrote the 
> Java floating-point spec).
> 
> During the development of the Schema 1.0 (i.e., a few years 
> before we went to Rec) we had MANY discussions about the 
> numeric types, and especially about float and double.  As 
> part of that discussion, Mark wrote a note entitled 
> "Floating-point datatypes are not real datatypes" 
> [1] that goes into great detail on this point.  It also 
> serves as a good entry point to the archives for the 
> discussions the WG had on these issues.
> 

Thanks for the pointer, Paul. I confirms much of what people have said about
the original rationale.

In my view the note makes two basic assumptions that are open to question:

(a) it takes the view that all restriction must be facet-based; I can't see
any particular necessity in the theory that if a type is magic then it has
to be primitive.

(b) it claims the existence of a "principle that if a string
maps to a given value in a particular type then it should map to the same
value
in all supertypes". I don't see that principle as being in any way
fundamental, and I certainly don't see it as "fundamental to subtyping in
programming languages". It's also violated within XML Schema itself - " xx "
as an instance of xs:token maps to a different value from " xx " as an
xs:string.

At the same time it's true that most modern languages do the same as
Schema+QT: they treat integer, double and float as separate primitive types
with no hierarchic relationship, and then define operators such as "=" and
"+" to operate across a value space that is effectively the union of these
types.

Michael Kay
http://www.saxonica.com/

Received on Tuesday, 8 July 2008 18:54:50 UTC