Julia provides following functions to
perform truncated, floor and ceil divisions.
Function
|
Description
|
div(x, y)
|
Return x/y. Quotient rounded towards
zero.
|
fld(x, y)
|
Performs floored division. Quotient is
rounded towards –Inf.
|
cld(x, y)
|
Performs ceiling division, Quotient is
rounded towards +Inf.
|
julia> div(10, 3) 3 julia> div(10, 4) 2 julia> div(10, 6) 1 julia> fld(10, 3) 3 julia> fld(10, 4) 2 julia> fld(10, 6) 1 julia> cld(10, 3) 4 julia> cld(10, 4) 3 julia> cld(10, 6) 2
No comments:
Post a Comment