Skip to content

cmd/compile: cannot convert (constant 10000 of type float64) to type int64 #56220

Closed
@NOMORECOFFEE

Description

@NOMORECOFFEE

What version of Go are you using (go version)?

$ go version
go1.19

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

package main

import (
	"fmt"
)

func main() {
	v := int64((float64(0.03) - float64(0.02)) * 1_000_000)
	fmt.Println(v)
}

https://go.dev/play/p/V0KH5qKf6u4

What did you expect to see?

10000

What did you see instead?

cannot convert (float64(0.03) - float64(0.02)) * 1_000_000 (constant 10000 of type float64) to type int64

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions