Skip to content

math: Round returns an int in a float64 #23496

@Fale

Description

@Fale

As per documentation, the math.Round "returns the nearest integer" [1]. Why does it return it in a float? [2] Wouldn't make more sense to return it in an integer typed variable?

[1]

// Round returns the nearest integer, rounding half away from zero.

[2]
func Round(x float64) float64 {

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