Hi,
As everyone knows, log(1+dx) suffers heavily on cancellation errors when dx gets sufficient small. The solution is, as in most other programming languages already implemented, the use of the log1p() function. One common way to implement a workaround DIY is the rewriting of log(1+dx) as:
log1p=log(1+dx)*dx/((1-dx)-1)
The problem with this now is, that most compilers probably optimize it simply back to log(1+dx). Therefore I'd like to ask if there is a safe way to tell the compiler to just not touch this line of code?
Thanks for any advice!