diff --git a/context.go b/context.go index 0b804cd..acd353f 100644 --- a/context.go +++ b/context.go @@ -362,7 +362,6 @@ func (c *Context) Quo(d, x, y *Decimal) (Condition, error) { } res |= d.setExponent(c, nd, res, shift, -adjCoeffs, -adjExp10) - d.Reduce(d) // remove trailing zeros return c.goError(res) } @@ -552,7 +551,6 @@ func (c *Context) Sqrt(d, x *Decimal) (Condition, error) { d.Exponent += int32(e / 2) nc.Precision = c.Precision nc.Rounding = RoundHalfEven - d.Reduce(d) // remove trailing zeros res := nc.round(d, d) return nc.goError(res) } diff --git a/example_test.go b/example_test.go index 70bd264..9073af3 100644 --- a/example_test.go +++ b/example_test.go @@ -36,7 +36,8 @@ func ExampleContext_overflow() { return } } - // Output: d: 998, overflow: false, err: + // Output: + // d: 998, overflow: false, err: // d: 999, overflow: false, err: // d: Infinity, overflow: true, err: overflow } @@ -56,9 +57,10 @@ func ExampleContext_inexact() { return } } - // Output: d: 9, inexact: false, err: - // d: 3, inexact: false, err: - // d: 1, inexact: false, err: + // Output: + // d: 9.0000, inexact: false, err: + // d: 3.0000, inexact: false, err: + // d: 1.0000, inexact: false, err: // d: 0.33333, inexact: true, err: } @@ -74,7 +76,8 @@ func ExampleContext_Quantize() { } fmt.Println() } - // Output: -3: 123.450 + // Output: + // -3: 123.450 // -2: 123.45 // -1: 123.5 (inexact, rounded) // 0: 123 (inexact, rounded) @@ -95,7 +98,8 @@ func ExampleErrDecimal() { ed.Sub(d, d, apd.New(1, 0)) // attempt to subtract 1 // The subtraction doesn't occur and doesn't change the error. fmt.Printf("%s, err: %v\n", d, ed.Err()) - // Output: 10, err: + // Output: + // 10, err: // 30, err: // Infinity, err: division by zero // Infinity, err: division by zero @@ -125,7 +129,8 @@ func ExampleContext_RoundToIntegralExact() { } fmt.Println() } - // Output: input: 123.4, output: 123, integer: false, strict: false, res: inexact, rounded + // Output: + // input: 123.4, output: 123, integer: false, strict: false, res: inexact, rounded // input: 123.0, output: 123, integer: true, strict: false, res: rounded // input: 123, output: 123, integer: true, strict: true, res: // input: 12E1, output: 120, integer: true, strict: true, res: