Skip to content

Commit

Permalink
Treat -0 as smaller than +0 (#15)
Browse files Browse the repository at this point in the history
* Treat -0 as smaller than +0

* Fix min > max edge case
  • Loading branch information
Richienb authored Jan 5, 2025
1 parent ea696ee commit dedd8be
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ contributors: Oliver Medhurst, Richie Bendall
1. If _min_ is *NaN*, throw a *RangeError* exception.
1. If _max_ is not a Number, throw a *TypeError* exception.
1. If _max_ is *NaN*, throw a *RangeError* exception.
1. If _min_ is *+0*<sub>𝔽</sub> and _max_ is *-0*<sub>𝔽</sub>, throw a *RangeError* exception.
1. If _min_ > _max_, throw a *RangeError* exception.
1. If _value_ is *NaN*, return *NaN*.
1. If _value_ is *-0*<sub>𝔽</sub> and _min_ is *+0*<sub>𝔽</sub>, return _min_.
1. If _value_ is *+0*<sub>𝔽</sub> and _min_ is *-0*<sub>𝔽</sub>, return _min_.
1. If _value_ is *-0*<sub>𝔽</sub> and _min_ is *+0*<sub>𝔽</sub>, return *+0*<sub>𝔽</sub>.
1. If _value_ is *+0*<sub>𝔽</sub> and _min_ is *-0*<sub>𝔽</sub>, return *+0*<sub>𝔽</sub>.
1. If _value_ &lt; _min_, return _min_.
1. If _value_ is *-0*<sub>𝔽</sub> and _max_ is *+0*<sub>𝔽</sub>, return _max_.
1. If _value_ is *+0*<sub>𝔽</sub> and _max_ is *-0*<sub>𝔽</sub>, return _max_.
1. If _value_ is *-0*<sub>𝔽</sub> and _max_ is *+0*<sub>𝔽</sub>, return *-0*<sub>𝔽</sub>.
1. If _value_ is *+0*<sub>𝔽</sub> and _max_ is *-0*<sub>𝔽</sub>, return *-0*<sub>𝔽</sub>.
1. If _value_ > _max_, return _max_.
1. Return _value_.
</emu-alg>
Expand Down

0 comments on commit dedd8be

Please sign in to comment.