Accurate SSE2/FMA tanh approximation.
- KVRAF
- 8484 posts since 12 Feb, 2006 from Helsinki, Finland
On the subject of function approximation, since you've come up with these exp/tan/tanh approximations, have you considered doing one for log() as well? That's another reasonably common function one needs in DSP (eg. for compressors and such) and it would seem one could use basically the inverse strategy from exp() and first extract the integer part from the floating point exponent, then do a finite-range approximation on the mantissa?
-
- KVRian
- Topic Starter
- 636 posts since 21 Jun, 2013
Yeah, log seems to be the function that is hard to approximate with polynomials. Rational function minmax can yield much better results for it. Log implementations that use lookup tables are not so nice for cache and don't scale that well for 8-wide FMA either.mystran wrote: Sat Sep 07, 2019 2:09 pm On the subject of function approximation, since you've come up with these exp/tan/tanh approximations, have you considered doing one for log() as well? That's another reasonably common function one needs in DSP (eg. for compressors and such) and it would seem one could use basically the inverse strategy from exp() and first extract the integer part from the floating point exponent, then do a finite-range approximation on the mantissa?
