I was wondering if there's any point in modifying code to use a lookup table for math.h
exp
, or if it was done automatically by clang++
when given the -O3
flag.
If it's not, is there a #pragma
that does this?
clarification
I was talking about memoisation of function calls. That is, if the function is passed the same exact arguments (yeah floating point numbers can actually be the same, if they're derived from constants and integers).
Example
Say I was going to run exp(-a*x)
where a
is not a compile-time constant, but once it's set once, it won't be modified. Similarly x
can be one of 10 possible values, all of which are set once, and not modified again.