File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 129
129
# =end
130
130
##
131
131
(let math:log10 (fun (x) {
132
- (math:log x 10)}))
132
+ (math:log x 10)}))
133
+
134
+ ###
135
+ # @brief Returns the quotient of the euclidian division of a and b
136
+ # @param a the dividend
137
+ # @param b the divisor
138
+ # @author https://github.com/fabien-zoccola
139
+ # =begin
140
+ # (math:floordiv 14 6) # Returns 2
141
+ # =end
142
+ ##
143
+ (let math:floordiv (fun (a b) (math:floor (/ a b))))
Original file line number Diff line number Diff line change 32
32
(set tests (assert-eq (math:log2 128) 7 "math:log2" tests))
33
33
(set tests (assert-eq (math:log2 2048) 11 "math:log2" tests))
34
34
(set tests (assert-eq (math:log10 1000) 3 "math:log10" tests))
35
+ (set tests (assert-eq (math:floordiv 14 6) 2 "math:floordiv" tests))
36
+ (set tests (assert-eq (math:floordiv 14 14) 1 "math:floordiv" tests))
37
+ (set tests (assert-eq (math:floordiv 14 15) 0 "math:floordiv" tests))
35
38
36
39
(recap "Math tests passed" tests (- (time) start-time))
37
40
You can’t perform that action at this time.
0 commit comments