Approximate e^x

前端 未结 10 2149
一向
一向 2020-12-13 16:28

I\'d like to approximate the ex function.

Is it possible to do so using multiple splines type based approach? i.e between x1

10条回答
  •  别那么骄傲
    2020-12-13 16:50

    This is not appropriate for custom FPGA, but worth mentioning.

    http://www.machinedlearnings.com/2011/06/fast-approximate-logarithm-exponential.html

    And the source code:

    https://code.google.com/archive/p/fastapprox/downloads

    The "faster" implementation only involves 3 steps (multiply, add, convert float to int) and a final cast back to float. In my experience, it is 2% accurate, which may be enough if you don't care about the actual value but are using the value in a log-likelihood maximization iteration.

提交回复
热议问题