+ 1
Why math.floor answers different for positive and negative numbers ?
I'm confused after getting the results..!đ€ 1.math.floor(48.37) = 48 2.math.floor(-48.37) = -49
9 Respostas
+ 8
Math.floor rounds the number lower. Smaller than 48.37 is 48, smaller than -48.37 is -49
+ 5
It kind of makes sense if you look at the numbers all in a row, starting at 0 with positives going up from, and negatives going downfrom 0.
math.floor rounds down.
48 is less than 48.37
and
-49 is (i guess) even more less than -48.37
+ 2
Slick
Thank you
+ 2
It rounds always below number, it doesnt matter that is negative or positive
+ 2
Ramazan Semai AKSU
Thank you
+ 2
You welcome
+ 1
đ Alex TuÈinean đ
Thank you
+ 1
đ Alex TuÈinean đ Slick
What if math.round(-48.37) ?
1.48
2.49
+ 1
print ( -15//2 ) = -8
Which among these functions are worked in expression , math.floor or math.round or else both