4 ms·
Many libm implementations don't have an accurate `log` or `exp` routine, so there does exist a risk. (Of course, it's also true that many of them also special-c
by lifthrasiir 3y ago
Many libm implementations don't have an accurate `log` or `exp` routine, so there does exist a risk. (Of course, it's also true that many of them also special-case `log(x) ~= x - 1` and `exp(x) ~= x + 1` for small enough `x`.)
- planede 3y agoThe math hinges on that there is the same error for exp(x) at both places. So as long as exp(x) is deterministic then this should be alright.
- adgjlsfhk1 3y agoI don't know of any libm that have log or exp sufficiently inaccurate for this to break. Do you?
- lifthrasiir 3y agoIndeed, any well-known enough libm wouldn't do that. But I can imagine some less-known libms with wild error bounds.