-
Notifications
You must be signed in to change notification settings - Fork 10
/
negative-infinity.eo
159 lines (141 loc) · 3.86 KB
/
negative-infinity.eo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# The MIT License (MIT)
#
# 2016-2022 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+architect yegor256@gmail.com
+home https://github.com/objectionary/eo
+package org.eolang
+rt jvm org.eolang:eo-runtime:0.35.5
+version 0.35.5
# Negative infinity.
[] > negative-infinity
-1.0.div 0.0 > @
# Tests that $ = x.
[x] > eq
eq. > @
^.as-bytes
x.as-bytes
# Tests that $ < x.
[x] > lt
x > value!
not. > @
or.
value.as-bytes.eq nan.as-bytes
^.eq value
# Tests that $ ≤ x.
[x] > lte
not. > @
eq.
x.as-bytes
nan.as-bytes
# Tests that $ > x.
[x] > gt
FALSE > @
# Tests that $ ≥ x.
[x] > gte
^.eq x > @
# Multiplication of $ and x.
[x] > times
x > value!
# Tests if given number is greater than float or integer zero.
[num] > is-num-gt-zero
try > @
[]
num.gt 0 > @
[e]
num.gt 0.0 > @
FALSE
# Here we use the rule "NaN != NaN is TRUE" to check if "num" is NaN.
[num] > is-nan
not. > @
num.eq num
# Tests if given number is equal to nan, float or integer zero.
[num] > is-nan-or-zero
or. > @
or.
or.
is-nan num
num.eq -0.0
num.eq 0.0
num.eq 0
if. > @
is-nan-or-zero value
nan
if.
is-num-gt-zero value
negative-infinity
positive-infinity
# Sum of $ and x.
[x] > plus
positive-infinity.as-bytes > pos-inf-as-bytes!
x > value!
# Here we use the rule "NaN != NaN is TRUE" to check if "num" is NaN
[num] > is-nan
not. > @
num.eq num
if. > @
or.
is-nan value
value.as-bytes.eq pos-inf-as-bytes
nan
negative-infinity
# Difference between $ and x.
[x] > minus
x > value!
negative-infinity.as-bytes > neg-inf-as-bytes!
# Here we use the rule "NaN != NaN is TRUE" to check if "num" is NaN.
[num] > is-nan
not. > @
num.eq num
if. > @
or.
is-nan value
value.as-bytes.eq neg-inf-as-bytes
nan
negative-infinity
# Quotient of the division of $ by x
[x] > div
x > value!
# Here we use the rule "NaN != NaN is TRUE" to check if "num" is NaN.
[num] > is-nan
not. > @
num.eq num
# Tests if given number is equal to nan, positive or negative infinity.
[num] > is-nan-or-infinite
or. > @
or.
is-nan num
num.eq positive-infinity
num.eq negative-infinity
# Tests if given number is greater or equal to float or integer zero.
[num] > is-num-gte-zero
try > @
[]
num.gte 0 > @
[e]
num.gte 0.0 > @
FALSE
if. > @
is-nan-or-infinite value
nan
if.
is-num-gte-zero value
negative-infinity
positive-infinity