From 70a056a993f6a21c5cf890e45bf683c169bdbbee Mon Sep 17 00:00:00 2001 From: Jesse Alama Date: Sun, 28 Jul 2024 14:44:27 +0200 Subject: [PATCH] Use new MV AO to simplify comparisons --- spec.emu | 62 +++++++------------------------------------------------- 1 file changed, 7 insertions(+), 55 deletions(-) diff --git a/spec.emu b/spec.emu index 1a219bee..816b92fd 100644 --- a/spec.emu +++ b/spec.emu @@ -800,13 +800,7 @@ location: https://github.com/tc39/proposal-decimal/ 1. If _d2_ is *-∞*𝔻, return *true*. 1. Otherwise, return *false*. 1. If _d2_ is *+∞*𝔻 or *-∞*𝔻, return *false*. - 1. Let _v1_ be cohort(_d1_). - 1. Let _v2_ be cohort(_d2_). - 1. If _v1_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v2_ is either *+0*𝔻 or *−0*𝔻, return *true*. - 1. Otherwise, return *false*. - 1. If _v2_ is *+0*𝔻 or *+0*𝔻, return *false*. - 1. If _v1_ = _v2_, return *true*. + 1. If MV(_d1_) = MV(_d2_), return *true*. 1. Otherwise, return *false*. @@ -833,14 +827,8 @@ location: https://github.com/tc39/proposal-decimal/ 1. If _d2_ is *-∞*𝔻, return *false*. 1. Otherwise, return *true*. 1. If _d2_ is *+∞*𝔻 or *-∞*𝔻, return *true*. - 1. Let _v1_ be cohort(_d1_). - 1. Let _v2_ be cohort(_d2_). - 1. If _v1_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v2_ is either *+0*𝔻 or *−0*𝔻, return *false*. - 1. Otherwise, return *true*. - 1. If _v2_ is *+0*𝔻 or *+0*𝔻, return *true*. - 1. If _v1_ = _v2_, return *false*. - 1. Otherwise, return *true*. + 1. If MV(_d1_) ≠ MV(_d2_), return *true*. + 1. Otherwise, return *false*.

This operation corresponds to the compareQuietNotEqual operation in Section 5.6.1 (and explained in Section 5.11) of IEEE 754-2019.

@@ -865,16 +853,7 @@ location: https://github.com/tc39/proposal-decimal/ 1. Otherwise, return *true*. 1. If _d2_ is *+∞*𝔻, return *true*. 1. If _d2_ is *-∞*𝔻, return *false*. - 1. Let _v1_ be cohort(_d1_). - 1. Let _v2_ be cohort(_d2_). - 1. If _v1_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v2_ is either *+0*𝔻 or *−0*𝔻, return *false*. - 1. If _v2_ > 0, return *true*. - 1. Otherwise, return *false*. - 1. If _v2_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v1_ < 0, return *true*. - 1. Otherwise, return *false*. - 1. If _v1_ < _v2_, return *true*. + 1. If MV(_d1_) < MV(_d2_), return *true*. 1. Otherwise, return *false*. @@ -900,16 +879,7 @@ location: https://github.com/tc39/proposal-decimal/ 1. If _d1_ is *-∞*𝔻, return *true*. 1. If _d2_ is *+∞*𝔻, return *true*. 1. If _d2_ is *-∞*𝔻, return *false*. - 1. Let _v1_ be cohort(_d1_). - 1. Let _v2_ be cohort(_d2_). - 1. If _v1_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v2_ is either *+0*𝔻 or *−0*𝔻, return *true*. - 1. If _v2_ < 0, return *true*. - 1. Otherwise, return *false*. - 1. If _v2_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v1_ < 0, return *true*. - 1. Otherwise, return *false*. - 1. If _v1_ < _v2_, return *true*. + 1. If MV(_d1_) ≤ MV(_d2_), return *true*. 1. Otherwise, return *false*. @@ -935,16 +905,7 @@ location: https://github.com/tc39/proposal-decimal/ 1. If _d1_ is *-∞*𝔻, return *false*. 1. If _d2_ is *+∞*𝔻, return *false*. 1. If _d2_ is *-∞*𝔻, return *true*. - 1. Let _v1_ be cohort(_d1_). - 1. Let _v2_ be cohort(_d2_). - 1. If _v1_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v2_ is either *+0*𝔻 or *−0*𝔻, return *false*. - 1. If _v2_ < 0, return *true*. - 1. Otherwise, return *false*. - 1. If _v2_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v1_ > 0, return *true*. - 1. Otherwise, return *false*. - 1. If _v1_ > _v2_, return *true*. + 1. If MV(_d1_) > MV(_d2_), return *true*. 1. Otherwise, return *false*. @@ -968,16 +929,7 @@ location: https://github.com/tc39/proposal-decimal/ 1. If _d1_ is *-∞*𝔻, return *false*. 1. If _d2_ is *+∞*𝔻, return *false*. 1. If _d2_ is *-∞*𝔻, return *true*. - 1. Let _v1_ be cohort(_d1_). - 1. Let _v2_ be cohort(_d2_). - 1. If _v1_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v2_ is either *+0*𝔻 or *−0*𝔻, return *true*. - 1. If _v2_ < 0, return *true*. - 1. Otherwise, return *false*. - 1. If _v2_ is *+0*𝔻 or *+0*𝔻, then - 1. If _v1_ > 0, return *true*. - 1. Otherwise, return *false*. - 1. If _v1_ ≥ _v2_, return *true*. + 1. If MV(_d1_) ≥ MV(_d2_), retuturn *true*. 1. Otherwise, return *false*.