-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version)?
https://go.dev/play/?v=gotip devel go1.21-05293d6b49 Mon Jun 5 14:01:09 2023 +0000
What did you do?
https://go.dev/play/p/Sf_G8Lt9dHy?v=gotip
x := math.NaN()
y := math.Inf(-1)
fmt.Println(min(x, y))
fmt.Println(math.Min(x, y))
Reports different output.
What did you expect to see?
I expected all output to be NaN.
What did you see instead?
min()/max() are returning NaN and math.Min()/math.Max() are returning -Inf/+Inf.
I think the output of the math versions is wrong as it should check for NaN before the infinities, but I don't have a copy of 754 right now and what min/max is under 754 is special (e.g. see minNum in IEEE 754-2008 vs. minimum & minimumNumber in IEEE 754-2019.
cuishuang
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.