hisoka 2 Report post Posted April 8, 2015 floor division is a mathematical division that rounds down to nearest integer. 89 / 45 gives 1.9777777777777779 meanwhile 89//45 gives 1 why not 2 ? 2 is the nearest integer to 1,97777777777777777779 and not 1 so normally it should give 2 not 1 98.45//56.54 gives 1.0 why not 1 ? why 1.0 I consider it as a mistake from the people who invented python as it must give 1 and not 1.0 for example 90/45 = 2.0 meanwhile 90//45 gives 2 Share this post Link to post Share on other sites

davej 251 Report post Posted April 8, 2015 If you want rounding then you use a rounding function. Another option is a formatting function. Share this post Link to post Share on other sites

justsomeguy 1,054 Report post Posted April 8, 2015 You even quoted the exact definition: floor division is a mathematical division that rounds down to nearest integer.What do you think "rounds down to the nearest integer" means? Share this post Link to post Share on other sites

hisoka 2 Report post Posted April 8, 2015 (edited) 1,97 is between 1 and 2 and the nearest number to 1,97 is 2 so 1,97 when rounded to the nearest , it becomes 2 and not 1 . and 1,97 is rounded up not down because the last digit is greater than 5 What do you say about that? Edited April 8, 2015 by hisoka Share this post Link to post Share on other sites

justsomeguy 1,054 Report post Posted April 8, 2015 I say that you need to be better at reading: floor division is a mathematical division that rounds down to nearest integer.Floor always rounds down. That's why it is called floor. 1 Share this post Link to post Share on other sites