1
0
mirror of https://github.com/golang/go synced 2024-11-19 12:14:42 -07:00

math/big: reenable TestFloatAdd32 (used to fail on 32bit platforms)

Change-Id: I932c2f1b1d27c437722cd27d2001b085a655c572
Reviewed-on: https://go-review.googlesource.com/6722
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Robert Griesemer 2015-03-04 08:58:03 -08:00
parent 2a1728d009
commit 7be32d038a
2 changed files with 6 additions and 11 deletions

View File

@ -261,34 +261,34 @@ func (z *Float) SetMantExp(mant *Float, exp int) *Float {
} }
// IsNeg reports whether x is negative. // IsNeg reports whether x is negative.
// A NaN is not negative. // A NaN value is not negative.
func (x *Float) IsNeg() bool { func (x *Float) IsNeg() bool {
return x.neg && x.exp != nanExp return x.neg && x.exp != nanExp
} }
// IsZero reports whether x is a +0 or -0. // IsZero reports whether x is +0 or -0.
func (x *Float) IsZero() bool { func (x *Float) IsZero() bool {
return len(x.mant) == 0 && x.exp == 0 return len(x.mant) == 0 && x.exp == 0
} }
// IsFinite reports whether -Inf < x < Inf. // IsFinite reports whether -Inf < x < Inf.
// A NaN is not finite. // A NaN value is not finite.
func (x *Float) IsFinite() bool { func (x *Float) IsFinite() bool {
return len(x.mant) != 0 || x.exp == 0 return len(x.mant) != 0 || x.exp == 0
} }
// IsInf reports whether x is a +Inf or -Inf. // IsInf reports whether x is +Inf or -Inf.
func (x *Float) IsInf() bool { func (x *Float) IsInf() bool {
return x.exp == infExp return x.exp == infExp
} }
// IsNaN reports whether x is a NaN. // IsNaN reports whether x is a NaN value.
func (x *Float) IsNaN() bool { func (x *Float) IsNaN() bool {
return x.exp == nanExp return x.exp == nanExp
} }
// IsInt reports whether x is an integer. // IsInt reports whether x is an integer.
// ±Inf and NaN are not considered integers. // ±Inf and NaN values are not integers.
func (x *Float) IsInt() bool { func (x *Float) IsInt() bool {
if debugFloat { if debugFloat {
validate(x) validate(x)

View File

@ -1058,11 +1058,6 @@ func TestFloatAdd(t *testing.T) {
// TestFloatAdd32 tests that Float.Add/Sub of numbers with // TestFloatAdd32 tests that Float.Add/Sub of numbers with
// 24bit mantissa behaves like float32 addition/subtraction. // 24bit mantissa behaves like float32 addition/subtraction.
func TestFloatAdd32(t *testing.T) { func TestFloatAdd32(t *testing.T) {
// TODO(gri) fix test for 32bit platforms
if _W == 32 {
return
}
// chose base such that we cross the mantissa precision limit // chose base such that we cross the mantissa precision limit
const base = 1<<26 - 0x10 // 11...110000 (26 bits) const base = 1<<26 - 0x10 // 11...110000 (26 bits)
for d := 0; d <= 0x10; d++ { for d := 0; d <= 0x10; d++ {