This repository was archived by the owner on Sep 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +38
-28
lines changed
Expand file tree Collapse file tree 2 files changed +38
-28
lines changed Original file line number Diff line number Diff line change 2626+version 0.0.0
2727
2828[n] > number
29-
3029 # Checking type of the number's decorator.
3130 # If $.n is int, return true, otherwise false.
3231 [] > is-int
32+ ^.n > value!
3333 if. > @
34- eq.
35- ^.n
36- 0
37- FALSE
38- eq.
39- div.
40- ^.n
41- ^.n
42- 1
34+ value.eq 0
35+ TRUE
36+ if.
37+ value.eq 0.0
38+ FALSE
39+ eq.
40+ div.
41+ value
42+ value
43+ 1
4344
4445 # Checking type of the number's decorator.
4546 # If $.n is float, return true, otherwise false.
4647 [] > is-float
48+ ^.n > value!
4749 if. > @
48- eq.
49- ^.n
50- 0.0
50+ value.eq 0.0
5151 TRUE
52- eq.
53- div.
54- ^.n
55- ^.n
56- 1.0
52+ if.
53+ value.eq 0
54+ FALSE
55+ eq.
56+ div.
57+ value
58+ value
59+ 1.0
5760
5861 # Checking if number is NaN
5962 [] > is-nan
114117
115118 # Calculate MOD
116119 [x] > mod
117- ^.n > dividend
118- x > divisor
120+ ^.n > dividend!
121+ x > divisor!
119122
120123 if. > @
121124 divisor.eq 0
127130 abs-mod
128131
129132 [] > abs-mod
130- (number dividend).abs > int-abs
131- (number divisor).abs > x-abs
133+ (number dividend).abs > int-abs!
134+ (number divisor).abs > x-abs!
132135 minus. > @
133136 int-abs
134137 x-abs.times
135138 int-abs.div x-abs
136139
137140 # Absolute value of $.n (i.e., with no sign)
138141 [] > abs
139- ^.n > value
142+ ^.n > value!
140143 if. > @
141144 is-int
142145 if.
Original file line number Diff line number Diff line change 2424+alias org.eolang.hamcrest.assert-that
2525+alias org.eolang.math.nan
2626+alias org.eolang.math.number
27+ +alias org.eolang.nop
2728+home https://github.com/objectionary/eo-math
2829+junit
2930+package org.eolang.math
4748 $.equal-to TRUE
4849 "check is nan of nan"
4950
50- [] > check-is-int-with-zero
51+ [] > check-is-int-with-int- zero
5152 assert-that > @
5253 (number 0).is-int
53- $.equal-to FALSE
54- "check is-int of zero"
54+ $.equal-to TRUE
55+ "check is-int of int zero"
56+
57+ [] > check-is-int-with-float-zero
58+ nop > @
59+
60+ [] > check-is-float-with-int-zero
61+ nop > @
5562
56- [] > check-is-float-with-zero
63+ [] > check-is-float-with-float- zero
5764 assert-that > @
5865 (number 0.0).is-float
5966 $.equal-to TRUE
60- "check is-int of zero"
67+ "check is-float of float zero"
6168
6269[] > check-is-int-positive-float
6370 assert-that > @
You can’t perform that action at this time.
0 commit comments