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 129129# =end
130130##
131131(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 3232 (set tests (assert-eq (math:log2 128) 7 "math:log2" tests))
3333 (set tests (assert-eq (math:log2 2048) 11 "math:log2" tests))
3434 (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))
3538
3639 (recap "Math tests passed" tests (- (time) start-time))
3740
You can’t perform that action at this time.
0 commit comments