Usage of Ciel and Floor in Java

0 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 0 Filament.io 0 Flares ×

Java Math package provides the ciel(double d)  and floor(double d) functions. The ciel function is used to get the smallest integer that is not less than the input.

Obviously this means the ciel will round it to the next higher non decimal number. For example ciel(2.4) returns 3.
Floor (floor()) returns the greater integer not greater than the input. In other words it will give a value that is less than or equal to the input. For example floor(2.4) returns 2.


double ceil(double d)
double ceil(double d)

Ciel function Example

 Floor function Example