W3C home > Mailing lists > Public > www-xpath-comments@w3.org > January to March 2000

Re: Minus zero

From: James Clark <jjc@jclark.com>
Date: Sun, 13 Feb 2000 11:35:14 +0700
Message-ID: <38A63482.20E28987@jclark.com>
To: Kay Michael <Michael.Kay@icl.com>
CC: "'www-xpath-comments@w3.org'" <www-xpath-comments@w3.org>, XSL WG <w3c-xsl-wg@w3.org>
I interpret the spec as being silent on the semantics of unary minus;
subtraction is a binary operation, and so I believe the remark about the
- operator is applicable only to the binary - operator.  Unary minus
should do the obvious thing, ie negation, as it does in Java and
JavaScript.  Thus -0 should be negative 0.
Kay Michael wrote:
> The XPath specification has little to say about the semantics of the unary
> minus operator, it seems to be covered by the remark that "The - operator
> performs subtraction."
> Saxon therefore interprets unary minus as subtraction from zero, so -0 means
> (+0.0 subtract +0.0) which is (I think) positive zero. LotusXSL appears to
> treat XPath "-0" as meaning IEEE 754 negative zero, which seems natural, but
> I cannot find any justification for this in the spec.
> The Java language spec explicitly states that the floating point unary minus
> operator does NOT mean subtraction, it means inverting the sign. There
> doesn't seem to be any corresponding statement in XPath.
> Should "-0" in XPath be interpreted as positive zero or negative zero?
> Mike Kay
Received on Saturday, 12 February 2000 23:54:55 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:02:13 UTC