• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes


What  functions returns the largest integer that is less than or equal to x? Is it using Floor i can achieve this ? Some demo code would be appreciated?

by (1.6k points)  
retagged by

1 Answer

0 votes


>Floor Function is used as the Greatest Integer Function.

>Formula to write it is as f(x)=⌊x⌋.

> ⌊x⌋ contains value which is the largest integer and  is less than or equal to x.

Another way to achieve this is by using formula math.ceil(x)-1

Another function in C to help achieve this:

double testfuc(double x) {

  return test(nextafter(x, -1.0/0.0));


by (5.3k points)