Isn’t this the same question you asked a few hours ago in
Please don’t double post
Isn’t this the same question you asked a few hours ago in
Please don’t double post
I am sorry. I have flagged this to the admin to delate it.
There exists Base.Math.exp_fast
.
Compare for example @code_native Base.Math.exp_fast.([1., 2., 3., 4.])
with @code_native exp.([1., 2., 3., 4.])
…
Thanks for your reply. Is the Base.Math.exp_fast the same as using @fastmath
which I already done in the posted code?
Well, I have just tried it and the performance is the same as using @fastmath
.
Yes
I don’t know how accurate the calculation needs to be. But you could pre-compute an array of values - then it’s just a question of a lookup. That should be quite fast.
Thanks for your suggestion! Do you mean interplation? Actually the x in exp(x) is not known beforehand, and if we pre-cmpute an array we have to look up in the array and then do some interplation. I guess the looking up process maybe time-consuming.