- From: Steven Pemberton <steven.pemberton@cwi.nl>
- Date: Wed, 13 Dec 2017 13:57:51 +0100
- To: public-xformsusers@w3.org, "XForms Users Community Group Issue Tracker" <sysbot+tracker@w3.org>

For power(x, y), we say: "Raises the first argument to the power of the second argument, returning the result. Both arguments may be fractional and negative. If the calculation does not result in a real number, then NaN is returned." and the problem is with the meaning of "if the calculation does not result in a real number" XPath functions says: https://www.w3.org/TR/xpath-functions/#func-math-pow pow($x, $y) "If $y is an instance of xs:integer, the result is $x raised to the power of $y as defined in the [IEEE 754-2008] specification of the pown function applied to a 64-bit binary floating point value and an integer. Otherwise $y is converted to an xs:double by numeric promotion, and the result is the value of $x raised to the power of $y as defined in the [IEEE 754-2008] specification of the pow function applied to two 64-bit binary floating point values." IEEE 754 says: "For the pown function (integral exponents only): pown(x, 0) is 1 for any x (even a zero, quiet NaN, or infinity) pown(±0, n) is ±∞ and signals the divideByZero exception for odd integral n<0 pown(±0, n) is +∞ and signals the divideByZero exception for even integral n<0 pown(±0, n) is +0 for even integral n>0 pown(±0, n) is ±0 for odd integral n>0. For the pow function (integral exponents get special treatment): pow(x, ±0) is 1 for any x (even a zero, quiet NaN, or infinity) pow(±0, y) is ±∞ and signals the divideByZero exception for y an odd integer <0 pow(±0, −∞) is +∞ with no exception pow(±0, +∞) is +0 with no exception pow(±0, y) is +∞ and signals the divideByZero exception for finite y<0 and not an odd integer pow(±0, y) is ±0 for finite y>0 an odd integer pow(±0, y) is +0 for finite y>0 and not an odd integer pow(−1, ±∞) is 1 with no exception pow(+1, y) is 1 for any y (even a quiet NaN) pow(x, y) signals the invalid operation exception for finite x<0 and finite non-integer y" So I propose for our text: "Raises the first argument to the power of the second argument, returning the result. The value of power(0,0) is 1. Both arguments may be fractional and negative, however, power(0, y) = NaN for negative y power(x, y) = NaN for negative x and non integer y. " Steven

Received on Wednesday, 13 December 2017 12:58:19 UTC