Skip to content

math/rand: spinning tests on mips64? #17944

@bradfitz

Description

@bradfitz

The math/rand tests are failing on mips64:

// Float32 returns, as a float32, a pseudo-random number in [0.0,1.0).                                                                   
func (r *Rand) Float32() float32 {
        // Same rationale as in Float64: we want to preserve the Go 1 value                                                              
        // stream except we want to fix it not to return 1.0                                                                             
        // This only happens 1/2²⁴ of the time (plus the 1/2⁵³ of the time in Float64).                                                  
again:  
        f := float32(r.Float64())
        if f == 1 {
                goto again // resample; this branch is taken O(very rarely)                                                              
        }
        return f
}
goroutine 35 [runnable]:
math/rand.(*Rand).Float32(0x1051d78c, 0x3f0ddf90)
	/data/mips/go/src/math/rand/rand.go:173 +0x1c
math/rand.TestFloat32(0x10572360)
	/data/mips/go/src/math/rand/rand_test.go:343 +0xf8
testing.tRunner(0x10572360, 0x192d24)
	/data/mips/go/src/testing/testing.go:679 +0x150
created by testing.(*T).Run
	/data/mips/go/src/testing/testing.go:716 +0x284
FAIL	math/rand	180.061s

Is the float64 to float32 conversion broken?

/cc @cherrymui @crawshaw

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions