Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

math/rand: spinning tests on mips64? #17944

Closed
bradfitz opened this issue Nov 16, 2016 · 3 comments
Closed

math/rand: spinning tests on mips64? #17944

bradfitz opened this issue Nov 16, 2016 · 3 comments
Assignees
Milestone

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Nov 16, 2016

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

@bradfitz bradfitz added this to the Go1.8 milestone Nov 16, 2016
@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Nov 16, 2016

Is the float64 to float32 conversion broken?

I don't think it's broken.

It seems on the builder the tests timeout at different points across runs, e.g. TestReadUniformity in https://build.golang.org/log/cc903f92d6a4660454d77a5f2c1267c9dd258dbc, so it's probably just a timeout. Does the machine have hardware floating point? If not, FP is emulated with kernel traps, which is extremely slow.

@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Nov 16, 2016

@gopherbot
Copy link

@gopherbot gopherbot commented Nov 16, 2016

CL https://golang.org/cl/33326 mentions this issue.

@quentinmit quentinmit added the NeedsFix label Nov 16, 2016
@gopherbot gopherbot closed this in d8b14c5 Nov 16, 2016
@golang golang locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.