I\'d like to approximate the ex function.
Is it possible to do so using multiple splines type based approach? i.e between x1
First off, what is motivating this approximation? In other words, what exactly is wrong with the straightforward exp(x)?
That said, a typical implementation of exp(x) is to
k and floating point number r such that x=k*log(2) + r and r is between -0.5*log(2) and 0.5*log(2). exp(x) is 2k*exp(r).exp(x) use a Remes-type algorithm to come up with a minimax polynomial that approximates exp(r).Here's the kicker: No matter what you do the odds are very high that your function will be much, much slower than just calling exp(). Most of the functionality of exp() is implemented in your computer's math coprocessor. Re-implementing that functionality in software, even with reduced precision, is going to be an order of magnitude slower than just using exp().