Re: Question about number types

On Jul 4, 2008, at 9:30 PM, Dave Peterson wrote:

> At 7:25 PM +0100 2008-07-04, Bijan Parsia wrote:
>> On 4 Jul 2008, at 19:06, C. M. Sperberg-McQueen wrote:
>>>   It
>>> does not lie within the power of the XSD spec, or any other
>>> spec, to say that numbers expressible with finite decimal
>>> numerals and numbers which can be expressed as m × 2^e cannot
>>> be compared.
>> But that's a slide. Of course you don't say anything like that.  
>> But it seems XSD *does* say that xsd:float is disjoint with  
>> xsd:decimal. If we use *those types* (which we explicitly do),  
>> shouldn't we recognize that aspect of them?
> Note that "disjoint" means that values from one primitive datatype are
> never *identical with* values from a different primitive datatype.
> This whole discussion, however, seems to revolve around whether such
> values can be *comparable* (one of a < b, a = b, a > b holds).  Note
> carefully that since equality is not identity, we do not require
> of our own definitions that every primitive value even be equal to
> itself.

Good point. Of course one could define several sorts of equality  
relation that were sensitive to different aspects of the values and  
their types.


"for any a and b in the ˇvalue spaceˇ if a = b, then a and b cannot  
be distinguished (i.e., equality is identity)"

So, uhm,... I think saying "equality is not identity" is at least not  
the most *obvious* reading of the spec :)

> It's further true that XSD says that for its purposes, it chooses to
> define its equality and order relation in such-and-such a way.  But
> it explicitly says that adopters of the datatypes should feel free
> to redefine equality and order (among other things) as they see fit.

I found:

"""Note:  "Equality" in this Recommendation is defined to be  
"identity" (i.e., values that are identical in the ˇvalue spaceˇ are  
equal and vice versa). Identity must be used for the few operations  
that are defined in this Recommendation. Applications using any of  
the datatypes defined in this Recommendation may use different  
definitions of equality for computational purposes; [IEEE 754-1985]- 
based computation systems are examples. Nothing in this  
Recommendation should be construed as requiring that such  
applications use identity as their equality relationship when  

I'm not sure what an application is in this sense. For example, would  
you expect a schema language (say RELAX NG) to change the notion of  
equality (and still be conforming to the specification?) (To me, it  
would be using a different, albeit closely related, type system).

XQuery seems to treat float and decimal as disjoint:

Coercion is distinguished from subtyping.

This seems reflected in:

The question for me is that if one adopts the XML Schema type system,  
what does one adopt?

> What more can we say?  It's pretty clear that Alan, for example,
> expects a different equality from that chosen by XSLT/XQuery.  We
> clearly can't satisfy all users.

Ain't that the truth!

I suppose up to a certain point we can do whatever we want :) But it  
seems that Schema and XQuery use primitive disjointness, though  
XQuery also does some type promotion. That suggests that, all other  
things being equal, we'd do better to stick with that.


Received on Friday, 4 July 2008 21:23:23 UTC