@@ -133,4 +140,5 @@ module BigMath n = prec + BigDecimal.double_fig one = BigDecimal("1") + x = -x if neg = x < 0 x1 = one y = one @@ -146,5 +154,9 @@ module BigMath y += d end - y + if neg + one.div(y, prec) + else + y.round(prec - y.exponent) + end end