Perhaps we should move the logic of getting the precision to a getPrecision function. This would clean up the first if statement here.