Skip to content

time: Round broken for d > 2^62, r >= 2^62 #19807

@rsc

Description

@rsc

time.Round uses r+r < d to decide whether the remainder is above or below the halfway (round up or round down) point. This is wrong when r+r wraps negative, because it should be > d but looks < d.

No one will ever care about rounding to a d > 2^62 (d > 146 years), but might as well get it right.

CL on its way.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions