Fix large double exponent

Fixes #3095.