Languages
[Edit]
EN

Java - Math.floor() method example

0 points
Created by:
jonrsharpe
436

The Math.floor() function returns an integer value that is smaller than or equal to the argument - the result of round down operation.  


1. Documentation

Edit
Syntax

Note: Classes in the java.lang package are imported automatically, so it is not necessary to do it manually - we use just Math.floor() call.

Parametersnumber - double value (primitive value).
Result

Rounded down number value (primitive value).

If number value is equal to NaN it returns NaN.

If number value is equal to -Infinity it returns -Infinity.

If number value is equal to +Infinity it returns +Infinity.

Descriptionfloor is a static method that takes only one parameter and returns a rounded down value.

2. Rounding with precision down-to n places example

Edit

References

Edit
  1. Floor and ceiling functions - Wikipedia

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Cross technology - Math.floor()

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join