0
Why would you wver need to use Math.floor()?
The use of Math.floor() is to round a double down to a integer value while maintaining its type. why would you not just cast a double as an int, and have it truncated automatically?
1 Answer
0
Doubles can store larger numbers than integers, so you can't just cast it to int without risking an overflow. Also doubles can have the value 'infinity' and 'NaN', integers can't.