Fixed ranger length clamping with large distances

If you gave one of the E2 functions a huge distance, it would end up in
the wrong place. This clamps the distance correctly.

Fixes #631