W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2004

[F+O] Division by zero question

From: Michael Kay <mhk@mhk.me.uk>
Date: Thu, 19 Feb 2004 08:52:18 -0000
To: <public-qt-comments@w3.org>
Message-ID: <004b01c3f6c5$ae5a0070$6401a8c0@pcukmka>


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 Thursday, 19 February 2004 03:51:37 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:57 UTC