math.MaxFloat32 converted to int64 incorrectly:
Open
Nobody has claimed this yet.
bug
- Dominant language
- Go
- Stars
- 13.2k
- Forks
- 573
- PR merge metrics
- No merged PRs in 30d
Description
package main
import (
"fmt"
"math"
)
func main() {
var f float32 = math.MaxFloat32
fmt.Printf("Hello, playground: %x\n", int64(float32(f)))
}
Go output: -8000000000000000
GopherJS output: 0
https://gopherjs.github.io/playground/#/2uCovf4ywh
https://go.dev/play/p/m7yL_crK_Qb
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the issue's Go reproducer and comparing the native Go and GopherJS outputs for converting math.MaxFloat32 to int64. Trace the compiler's float32-to-int64 conversion path; done means GopherJS produces the same result as Go for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100