fastExp function
gessfred opened this issue · 2 comments
gessfred commented
I am wondering what is the motivation behind the fastExp
function used in net_update_wa
. I cannot see that it is faster or more numerically stable than the exp
function from std
in any meaningful way. And I am interested as to where the expression was found:
inline prec fastExp(prec a) {
a = 1.0 + a / 1024.0;
a *= a;
a *= a;
a *= a;
a *= a;
a *= a;
a *= a;
a *= a;
a *= a;
a *= a;
a *= a;
return a;
}
mgwoo commented
I didn't write that part, but in my previous experience (about calculating exponential in deep-learning hardware for sigmoid), that approximate function was much faster than std::exp() function.
Reference: https://codingforspeed.com/using-faster-exponential-approximation/
gessfred commented
Fair enough, thank you for the information.