4.3.6 The power() Function

https://www.w3.org/community/xformsusers/wiki/XPath_Expressions_Module#The_power.28.29_Function

Looking at the test case for power() I note a couple of weakly specified  
cases:

 power(0, 0): 0 or 1? We don't say, but I propose that we say that it is  
1. See https://www.math.hmc.edu/funfacts/ffiles/10005.3-5.shtml

Secondly we say:

"Both arguments may be fractional and negative. If the calculation does  
not result in a real number, then NaN is returned."

This is underspecified.

power(4, 0.5) could result in either of two values, -2 or 2. I propose we  
say that it returns 2.

power(-1, 0.5) also has two possible results, neither of which is real, so  
it clearly returns NaN.

power(-1, 0.2) has 5 possible results, four of which are not real, but one  
of which is real (-1).

One possible wording is

"Both arguments may be fractional and negative. If the possible results  
are real, it returns the positive one. Otherwise it returns NaN."

Steven

Received on Monday, 6 November 2017 09:03:56 UTC