Re: Minus zero

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