4 odpowiedzi
+ 5
math.ceil always rounds off to next number..
Math.round would round off to the next value if the current value is >.5
else would round to previous number
https://www.tutorialspoint.com/what-is-the-difference-between-math-ceil-and-math-round-methods-in-javascript
(i know this link points to JS but the function is same for both languages)
Edit :
Also be specific when asking a question..
+ 3
The ceil function will output the least integer greater than or equal to that number
Ex) print(ceil(3.5)) --> 4
The floor function will output the greatest integer less than or equal to that number
Ex)print(floor(3.5)) --> 3
The round function will round the integer
Ex)print(round(3.5) --> 4
HOWEVER:
At least in Python, the round function will not perform as it is expected to
Ex) print(round(2.5)) --> 2
This happens for every even number.
+ 2
Ceil function will terminate the value to its nearest highest integer.
But around will give the nearest integer
Ex:—
Math.ceil(4.4)=5
Round(4.4)=4