Thanks to visit codestin.com
Credit goes to github.com

Skip to content

math.MaxFloat32 converted to int64 incorrectly: #1224

Open
@nevkontakte

Description

@nevkontakte
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions