|
|
|
|
|
by stephencanon
3933 days ago
|
|
ldexp( ) is a surprisingly expensive operation because it has to handle edge cases correctly; even if you don't hit those edge cases the best implementation of the fast path on most architectures is approximately extract exponent, add adjustment, check result, branch to fixup if out of range, insert exponent. If the range of adjustments you need to support is small, and you're not totally load-store bound, a lookup table is faster. (That's not to say that Java shouldn't have ldexp( ), just that it's not a fix-all.) |
|