Re: 4.3.6 The power() Function

Steven,

As far as I can see XPath functions and operators agrees with your proposal. They have some more examples of ‘corner’ cases: https://www.w3.org/TR/xpath-functions-31/#func-math-pow 

Regards,

Nick Van den Bleeken


On 06/11/2017, 10:04, "Steven Pemberton" <steven.pemberton@cwi.nl> wrote:

    
    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:17:12 UTC