]> Cypherpunks.ru repositories - gostls13.git/commit
math: add Compare and Compare32
authorAkhil Indurti <aindurti@gmail.com>
Sat, 24 Dec 2022 14:22:30 +0000 (09:22 -0500)
committerGopher Robot <gobot@golang.org>
Thu, 9 Feb 2023 20:47:48 +0000 (20:47 +0000)
commitd57ebde91ffd9088d7303a8c41079c27f78df0f1
tree55bf6c5a9126da346e9688f44c76d99a1607a807
parenta64919945bdb65202783c5f9e078c3e735efc58f
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>
api/next/56491.txt [new file with mode: 0644]
src/math/all_test.go
src/math/compare.go [new file with mode: 0644]