From ef0b03137d18f42337a4cbd4915bf91942bad750 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 3 Mar 2015 12:53:41 -0800 Subject: [PATCH] math/big: remove Float.Lsh/Rsh; added shift example Shifts are trivially implemented by combining Float.MantExp and Float.SetMantExp. Change-Id: Ia2fb49297d8ea7aa7d64c8b1318dc3dc7c8af2f7 Reviewed-on: https://go-review.googlesource.com/6671 Reviewed-by: Alan Donovan --- src/math/big/float.go | 44 +++---------------------------- src/math/big/floatexample_test.go | 32 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 40 deletions(-) create mode 100644 src/math/big/floatexample_test.go diff --git a/src/math/big/float.go b/src/math/big/float.go index fa0cb2ba89..e24961c61a 100644 --- a/src/math/big/float.go +++ b/src/math/big/float.go @@ -88,8 +88,8 @@ const ( // Accuracy describes the rounding error produced by the most recent // operation that generated a Float value, relative to the exact value. -// The accuracy may be Undef (either Below or Above) for operations on -// and resulting in NaNs. +// The accuracy may be Undef for operations on and resulting in +// NaNs since they are neither Below nor Above any other value. type Accuracy int8 // Constants describing the Accuracy of a Float. @@ -278,6 +278,8 @@ func (x *Float) MantExp(mant *Float) (exp int) { // z.SetMantExp(±Inf, exp) = ±Inf // z.SetMantExp( NaN, exp) = NaN // +// z and mant may be the same in which case z's exponent +// is set to exp. func (z *Float) SetMantExp(mant *Float, exp int) *Float { if debugFloat { validate(z) @@ -1449,44 +1451,6 @@ func (z *Float) Quo(x, y *Float) *Float { return z } -// TODO(gri) eliminate Lsh, Rsh? We can do the same with MantExp, SetMantExp. - -// Lsh sets z to the rounded x * (1<