In Python 5//2 is a floor division.
In Julia:
5//2
Returns
5//2
How can I do floor division in Julia?
Try:
julia> 5 ÷ 2
2
The character ÷
can be entered by typing \div
and pressing Tab.
On the other hand the operator //
is used to create rational numbers.
The ÷
sign represents a div
operator. If the number is negative you need to use fld
to the the actual floor division. You could assign it to one of unused operators for comfortable use:
julia> ∺ = fld
fld (generic function with 10 methods)
julia> -5 ∺ 2
-3