Skip to content

math: Type Conversion of Inf(1) to int produces a negative integer instead of a positive one #44225

@BozeBro

Description

@BozeBro
package main

import (
	"fmt"
	"math"
)

func main() {
	fmt.Println("Hello, playground")
	m := int(math.Inf(1))
	fmt.Println(m)
}

go playground

What did you expect to see?

I expected to see positive infinity representation or 9223372036854775807

What did you see instead?

-9223372036854775807

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions