diff options
author | Akhil Indurti <aindurti@gmail.com> | 2022-12-24 09:22:30 -0500 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-02-09 20:47:48 +0000 |
commit | d57ebde91ffd9088d7303a8c41079c27f78df0f1 (patch) | |
tree | 55bf6c5a9126da346e9688f44c76d99a1607a807 /api | |
parent | a64919945bdb65202783c5f9e078c3e735efc58f (diff) | |
download | go-git-d57ebde91ffd9088d7303a8c41079c27f78df0f1.tar.gz |
math: add Compare and Compare32
This change introduces the Compare and Compare32 functions
based on the total-ordering predicate in IEEE-754, section 5.10.
In particular,
* -NaN is ordered before any other value
* +NaN is ordered after any other value
* -0 is ordered before +0
* All other values are ordered the usual way
name time/op
Compare-8 0.24ns ± 1%
Compare32-8 0.24ns ± 0%
Fixes #56491.
Change-Id: I9444fbfefe26741794c4436a26d403b8da97bdaf
Reviewed-on: https://go-review.googlesource.com/c/go/+/459435
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'api')
-rw-r--r-- | api/next/56491.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/api/next/56491.txt b/api/next/56491.txt new file mode 100644 index 0000000000..333f92e215 --- /dev/null +++ b/api/next/56491.txt @@ -0,0 +1,2 @@ +pkg math, func Compare(float64, float64) int #56491 +pkg math, func Compare32(float32, float32) int #56491 |