RE: Canonical representation of -0.0

> I have made my algorithm such that it normalizes "-0.0" to "0.0". I
saw 
> that similar behaviour is specified for floats and doubles, so this
looks > like the most sensible thing to do.

I agree!

All the best, Ashok

> -----Original Message-----
> From: www-xml-schema-comments-request@w3.org [mailto:www-xml-schema-
> comments-request@w3.org] On Behalf Of Arjohn Kampman
> Sent: Wednesday, October 15, 2003 6:30 AM
> To: Xan Gregg
> Cc: www-xml-schema-comments@w3.org
> Subject: Re: Canonical representation of -0.0
> 
> 
> 
> 
> 
> Xan Gregg wrote:
> 
> >> Reading through the definition of the datatype 'decimal' and
working
> >> on an algorithm that normalizes these, I came across an exotic case
> that
> >> might not be correctly normalized when the specs are followed. This
> case
> >> is the decimal -0.0. If I understand the specs correctly, the
canonical
> >> form of this decimal is again -0.0, but I would expect it to be
0.0. I
> >> scanned through the errata but couldn't find anything that's
related to
> >> this. Can someone tell me if this is an error in the XML Schema
> >> datatypes specs?
> >
> >
> > Looks like an error in the description of canonical representation.
The
> > canonical representation is defined by prohibiting certain lexical
> > representation, but "-0.0" is not prohibited, as you've observed.
> > However, there is no negative zero in the value space of decimal, so
> > "-0.0" presumably represents the same value as "0.0" (but, by
> > definition, only one of them can be the canonical representation).
Or
> > perhaps it is an error that "-0.0" is a valid lexical representation
at
> > all.
> 
> Thanks for the feedback. I have made my algorithm such that it
> normalizes "-0.0" to "0.0". I saw that similar behaviour is specified
> for floats and doubles, so this looks like the most sensible thing to
> do.
> 
> Thanks again,
> 
> Arjohn Kampman
> 
> --
> arjohn.kampman@aduna.biz
> Aduna B.V. (formerly known as aidministrator) - http://www.aduna.biz/
> prinses julianaplein 14-b, 3817 cs amersfoort, the netherlands
> tel. +31-(0)33-4659987  fax. +31-(0)33-4659987
> 
> 
> 
> 

Received on Wednesday, 15 October 2003 09:44:46 UTC