Skip to content

spec: imprecise language around min and max when considering NaN #60570

Closed
@btracey

Description

@btracey

The go spec at tip has the following language about min and max

For numeric arguments, min and max are commutative and associative:

min(x, y)    == min(y, x)
min(x, y, z) == min(min(x, y), z) == min(x, min(y, z))

In my reading, this is insufficiently precise. In particular, min(math.NaN()) == min(math.NaN()) is false, so currently the spec is impossible to satisfy (cannot both propogate NaN and have those expressions be true). There should be a clarification around the interaction of NaN and ==.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions