RE: [F+O] Division by zero question

Mike:
Thank you for your comment.  The WGs discussed this and agreed to make
the change.

All the best, Ashok

-----Original Message-----
From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org] On Behalf Of Michael Kay
Sent: Thursday, February 19, 2004 12:52 AM
To: public-qt-comments@w3.org
Subject: [F+O] Division by zero question



I am passing this on from one of my users, who pointed out that Saxon's
behavior differs from the spec. I believe that Saxon is correct and the
spec is wrong.

The referenced statement in the spec is: "For xs:float and xs:double
operands, floating point division is performed as specified in [IEEE
754-1985] and INF or -INF is returned if the divisor is zero."

But I believe that according to IEEE 754, dividing zero by zero gives
NaN.

It would be better not to make normative statements that attempt to
precis IEEE 754: it would be much safer if such things were said in
notes, so that it is clear the IEEE definition is the normative one.

Michael Kay


-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net
[mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Erik
Bruchez
Sent: 19 February 2004 01:19
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Division by zero question


Consider this example:

   <xsl:value-of select="xs:double(0) div 0"/>

This operates a floating-point division. With Saxon 7.8, this returns
NaN, but the spec does specify that INF and -INF are returned in the
case of a division by zero:

http://www.w3.org/TR/xpath-functions/#func-numeric-divide

Is this a bug in Saxon, a bug or imprecision in the spec, or is this
implicitly covered by [IEEE 754-1985]?

-Erik

Received on Tuesday, 16 March 2004 17:02:29 UTC