Dear all,
In Matlab ,
>> round(2.5)
ans =
3
But in Julia,
julia> round(2.5)
2.0
If I want to get the same result which is from Matlab, how to write the code in Julia?
Dear all,
In Matlab ,
>> round(2.5)
ans =
3
But in Julia,
julia> round(2.5)
2.0
If I want to get the same result which is from Matlab, how to write the code in Julia?
Julia defaults to round ties to even. You can use round(x, RoundDown)
to round to take the floor. The rounding modes are RoundDown
,RoundNearestTiesUp
,RoundUp
,RoundFromZero
,RoundNearestTiesAway
, and RoundToZero