If `prec1` is too large, this gives OverflowError. I think you need to use Float.