[aarch64-port-dev ] RFR: 8189107 - AARCH64: create intrinsic for pow

Dmitrij Pochepko dmitrij.pochepko at bell-sw.com
Thu Aug 23 14:41:09 UTC 2018



On 23/08/18 16:39, Andrew Dinn wrote:
> On 23/08/18 13:31, Dmitrij Pochepko wrote:
>> On 22/08/18 16:43, Andrew Haley wrote:
>> well, I suppose the most questionable range is where X is near 0 (it's
>> when input X argument is near 1.0).
>> I created separate brute force test (run in Xcomp), which compares
>> Math.pow with StrictMath.pow using all representable double values
>> within given range and found no differences.
>> I used input argument range 0.9999...1.0001 (so that X values in this
>> polynomial are in [0, 0.000049998]. Input argument range has
>> 1.351079888×10¹² double values and for all these values results were
>> correct.
> I was thinking about this last night and thought precisely the same
> thing -- there ought to be a restricted range of X where the difference
> between the two computations will manifest most visibly and that range
> might be small enough to brute force compare results for a suitably
> chosen Y or range of Ys.
>
> However, although I came to the same conclusion as you I was not able to
> come up with a rigorous proof that this assumption was valid. Can you
> justify the claim that values around 1.0 are the ones to brute force
> check.
Since we're talking about large rounding/underflow error, it appearing 
in cases when multipliers and and/or added numbers are very small.
So, looking at  L1X+ x *(L2X+ x *L3X)+ x^3 * (L4X+ x *(L5X+ x *L6X))
we can see that there are several cases to check:
1) x is near 0
2) L1X+ x *(L2X+ x *L3X) is near zero (0.599999999999994648725 + x * 
(0.428571428578550184252 + x *0.333333329818377432918)). Solving 
equation: x = [-0.642857 - 1.1776*i, -0.642857 + 1.1776*i]
3) L4X+ x *(L5X+ x *L6X) is near zero (0.272728123808534006489 + x * 
(0.230660745775561754067 + x *0.206975017800338417784)). Solving 
equation: x = [-0.557219 - 1.00359*i, -0.557219 + 1.00359*i]

So, only x near 0 is left.
And further looking at code, we see that this x in polynomial is 
constructed from input parameter x (lets call it x0) as follows: x = 
((x0-1)/(x0+1))^2, so, solving equation ((x0-1)/(x0+1))^2 = 0 we get x0 = 1.
> Also, why use Y = 3.0d? (and only that value)? Can you justify
> why it is unnecessary to look at any other Y values?
polynomial we're talking about depends on X values only, so, I think any 
Y should be fine. I chose random value.
>
> regards,
>
>
> Andrew Dinn
> -----------
> Senior Principal Software Engineer
> Red Hat UK Ltd
> Registered in England and Wales under Company Registration No. 03798903
> Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander



More information about the aarch64-port-dev mailing list