Skip to content

math: add a Round function #4594

Closed
Closed
@gopherbot

Description

@gopherbot

by bunge@google.com:

Would it be possible to add a math.Round(n float64, digits uint) float64 function that
rounds a floating point number to the specified number of digits? This has been
discussed on golang-nuts here:
https://groups.google.com/d/topic/golang-nuts/ITZV08gAugI/discussion

I am not entirely convinced by the required digit argument. Perhaps we should have:

Round(n float64) float64 {
  return RoundDigits(n, 0)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions