Skip to content

Commit dedd8be

Browse files
authored
Treat -0 as smaller than +0 (#15)
* Treat -0 as smaller than +0 * Fix min > max edge case
1 parent ea696ee commit dedd8be

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

spec.emu

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ contributors: Oliver Medhurst, Richie Bendall
2323
1. If _min_ is *NaN*, throw a *RangeError* exception.
2424
1. If _max_ is not a Number, throw a *TypeError* exception.
2525
1. If _max_ is *NaN*, throw a *RangeError* exception.
26+
1. If _min_ is *+0*<sub>𝔽</sub> and _max_ is *-0*<sub>𝔽</sub>, throw a *RangeError* exception.
2627
1. If _min_ > _max_, throw a *RangeError* exception.
2728
1. If _value_ is *NaN*, return *NaN*.
28-
1. If _value_ is *-0*<sub>𝔽</sub> and _min_ is *+0*<sub>𝔽</sub>, return _min_.
29-
1. If _value_ is *+0*<sub>𝔽</sub> and _min_ is *-0*<sub>𝔽</sub>, return _min_.
29+
1. If _value_ is *-0*<sub>𝔽</sub> and _min_ is *+0*<sub>𝔽</sub>, return *+0*<sub>𝔽</sub>.
30+
1. If _value_ is *+0*<sub>𝔽</sub> and _min_ is *-0*<sub>𝔽</sub>, return *+0*<sub>𝔽</sub>.
3031
1. If _value_ &lt; _min_, return _min_.
31-
1. If _value_ is *-0*<sub>𝔽</sub> and _max_ is *+0*<sub>𝔽</sub>, return _max_.
32-
1. If _value_ is *+0*<sub>𝔽</sub> and _max_ is *-0*<sub>𝔽</sub>, return _max_.
32+
1. If _value_ is *-0*<sub>𝔽</sub> and _max_ is *+0*<sub>𝔽</sub>, return *-0*<sub>𝔽</sub>.
33+
1. If _value_ is *+0*<sub>𝔽</sub> and _max_ is *-0*<sub>𝔽</sub>, return *-0*<sub>𝔽</sub>.
3334
1. If _value_ > _max_, return _max_.
3435
1. Return _value_.
3536
</emu-alg>

0 commit comments

Comments
 (0)