Closed VamuveTV closed 3 years ago
The range is indeed the problem. It states what the valid range for the resulting polynomial is (it is impossible to create an approximation polynomial for arbitrarily large values). So if you want to be able to compute exp(5)
you will need to provide a larger range, e.g.:
lolremez -d 10 -r -5:5 "exp(x)" "exp(x)"
This will give the following value:
148.303891984497
That’s already closer. Another problem is that exp(x)
behaves very differently for positive and negative values, so I suggest only computing for the 0:5
range:
lolremez -d 10 -r -0:5 "exp(x)" "exp(x)"
And calling the function like this:
x >= 0 ? exp(x) : 1.0 / exp(x)
This is the value for exp(5)
:
148.413082305473
Also note that if you use exp(x)
as the error function, exp(5)
will be the less precise value. You may wish to distribute the error in a more homogeneous way:
lolremez -d 10 -r -0:5 "exp(x)"
Which gives for exp(5)
:
148.413150926903
Amazing and very useful app. One question. How can i increase the precision up to the 13th digit ?
When calculating the polynomial (for exp) values i setup the app to the 10th term using this: lolremez -d 10 -r -1:1 "exp(x)" "exp(x)"
I gave a test and calculate the exp(5) which is: 148.413159102576603421115580040552279623.... but, the function returned to me this: 146.459145496305723
What i´m doing wrong ? And what is the range used for ?