Bill Allombert on Mon, 11 Sep 2023 13:55:21 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Power (^) function speed depending on argument types


On Mon, Sep 11, 2023 at 01:05:27PM +0200, Denis Simon wrote:
> Hi,
> 
> what we learn with this example, is that the function
> (x) -> x^(1/5)
> can increase the precision of x when x is a t_REAL.

In this instance it is the addition of a small t_REAL with a large exact integer
that cause the precision increase.

? precision(Pi)
%1 = 38
? precision(100+Pi)
%2 = 57

x^(1/5) role here is that it keeps the t_REAL small while the integer gets larger.
? precision((100+Pi)^(1/5))
%12 = 57
? precision(100+(100+Pi)^(1/5))
%13 = 77

Cheers,
Bill.