Skip to content

Commit

Permalink
Use new MV AO to simplify comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
jessealama committed Jul 28, 2024
1 parent 2063961 commit 70a056a
Showing 1 changed file with 7 additions and 55 deletions.
62 changes: 7 additions & 55 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -800,13 +800,7 @@ location: https://github.com/tc39/proposal-decimal/
1. If _d2_ is *-∞*<sub>𝔻</sub>, return *true*.
1. Otherwise, return *false*.
1. If _d2_ is *+∞*<sub>𝔻</sub> or *-∞*<sub>𝔻</sub>, return *false*.
1. Let _v1_ be cohort(_d1_).
1. Let _v2_ be cohort(_d2_).
1. If _v1_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, then
1. If _v2_ is either *+0*<sub>𝔻</sub> or *−0*<sub>𝔻</sub>, return *true*.
1. Otherwise, return *false*.
1. If _v2_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, return *false*.
1. If _v1_ = _v2_, return *true*.
1. If MV(_d1_) = MV(_d2_), return *true*.
1. Otherwise, return *false*.
</emu-alg>
<emu-note>
Expand All @@ -833,14 +827,8 @@ location: https://github.com/tc39/proposal-decimal/
1. If _d2_ is *-∞*<sub>𝔻</sub>, return *false*.
1. Otherwise, return *true*.
1. If _d2_ is *+∞*<sub>𝔻</sub> or *-∞*<sub>𝔻</sub>, return *true*.
1. Let _v1_ be cohort(_d1_).
1. Let _v2_ be cohort(_d2_).
1. If _v1_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, then
1. If _v2_ is either *+0*<sub>𝔻</sub> or *−0*<sub>𝔻</sub>, return *false*.
1. Otherwise, return *true*.
1. If _v2_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, return *true*.
1. If _v1_ = _v2_, return *false*.
1. Otherwise, return *true*.
1. If MV(_d1_) ≠ MV(_d2_), return *true*.
1. Otherwise, return *false*.
</emu-alg>
<emu-note>
<p>This operation corresponds to the <code>compareQuietNotEqual</code> operation in Section 5.6.1 (and explained in Section 5.11) of <emu-xref href="#sec-bibliography">IEEE 754-2019</emu-xref>.</p>
Expand All @@ -865,16 +853,7 @@ location: https://github.com/tc39/proposal-decimal/
1. Otherwise, return *true*.
1. If _d2_ is *+∞*<sub>𝔻</sub>, return *true*.
1. If _d2_ is *-∞*<sub>𝔻</sub>, return *false*.
1. Let _v1_ be cohort(_d1_).
1. Let _v2_ be cohort(_d2_).
1. If _v1_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, then
1. If _v2_ is either *+0*<sub>𝔻</sub> or *−0*<sub>𝔻</sub>, return *false*.
1. If _v2_ > 0, return *true*.
1. Otherwise, return *false*.
1. If _v2_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, 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*.
</emu-alg>
<emu-note>
Expand All @@ -900,16 +879,7 @@ location: https://github.com/tc39/proposal-decimal/
1. If _d1_ is *-∞*<sub>𝔻</sub>, return *true*.
1. If _d2_ is *+∞*<sub>𝔻</sub>, return *true*.
1. If _d2_ is *-∞*<sub>𝔻</sub>, return *false*.
1. Let _v1_ be cohort(_d1_).
1. Let _v2_ be cohort(_d2_).
1. If _v1_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, then
1. If _v2_ is either *+0*<sub>𝔻</sub> or *−0*<sub>𝔻</sub>, return *true*.
1. If _v2_ < 0, return *true*.
1. Otherwise, return *false*.
1. If _v2_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, 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*.
</emu-alg>
<emu-note>
Expand All @@ -935,16 +905,7 @@ location: https://github.com/tc39/proposal-decimal/
1. If _d1_ is *-∞*<sub>𝔻</sub>, return *false*.
1. If _d2_ is *+∞*<sub>𝔻</sub>, return *false*.
1. If _d2_ is *-∞*<sub>𝔻</sub>, return *true*.
1. Let _v1_ be cohort(_d1_).
1. Let _v2_ be cohort(_d2_).
1. If _v1_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, then
1. If _v2_ is either *+0*<sub>𝔻</sub> or *−0*<sub>𝔻</sub>, return *false*.
1. If _v2_ < 0, return *true*.
1. Otherwise, return *false*.
1. If _v2_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, 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*.
</emu-alg>
<emu-note>
Expand All @@ -968,16 +929,7 @@ location: https://github.com/tc39/proposal-decimal/
1. If _d1_ is *-∞*<sub>𝔻</sub>, return *false*.
1. If _d2_ is *+∞*<sub>𝔻</sub>, return *false*.
1. If _d2_ is *-∞*<sub>𝔻</sub>, return *true*.
1. Let _v1_ be cohort(_d1_).
1. Let _v2_ be cohort(_d2_).
1. If _v1_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, then
1. If _v2_ is either *+0*<sub>𝔻</sub> or *−0*<sub>𝔻</sub>, return *true*.
1. If _v2_ < 0, return *true*.
1. Otherwise, return *false*.
1. If _v2_ is *+0*<sub>𝔻</sub> or *+0*<sub>𝔻</sub>, 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*.
</emu-alg>
<emu-note>
Expand Down

0 comments on commit 70a056a

Please sign in to comment.