From: Ian Lance Taylor Date: Tue, 6 Jun 2023 21:31:21 +0000 (-0700) Subject: math: document that Min/Max differ from min/max X-Git-Tag: go1.21rc2~1^2~26 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=65db95d0ed69b047b54b2dea28406b2764a62bbe;p=gostls13.git math: document that Min/Max differ from min/max For #59488 Fixes #60616 Change-Id: Idf9f42d7d868999664652dd7b478684a474f1d96 Reviewed-on: https://go-review.googlesource.com/c/go/+/501355 Reviewed-by: David Chase Reviewed-by: Rob Pike Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor --- diff --git a/src/math/dim.go b/src/math/dim.go index 6a286cdc75..f369f70f00 100644 --- a/src/math/dim.go +++ b/src/math/dim.go @@ -34,6 +34,9 @@ func Dim(x, y float64) float64 { // Max(x, NaN) = Max(NaN, x) = NaN // Max(+0, ±0) = Max(±0, +0) = +0 // Max(-0, -0) = -0 +// +// Note that this differs from the built-in function max when called +// with NaN and +Inf. func Max(x, y float64) float64 { if haveArchMax { return archMax(x, y) @@ -67,6 +70,9 @@ func max(x, y float64) float64 { // Min(x, -Inf) = Min(-Inf, x) = -Inf // Min(x, NaN) = Min(NaN, x) = NaN // Min(-0, ±0) = Min(±0, -0) = -0 +// +// Note that this differs from the built-in function min when called +// with NaN and -Inf. func Min(x, y float64) float64 { if haveArchMin { return archMin(x, y)