Floor()/int() function implementaton

functionimplementation

Does anyone have an idea how is the method/function Int() or floor() implemented?
What I am looking for a respective implementation as the following is for abs() function.

Int Abs (float x){
  if x > 0 
      return x;
   else
      return -x
}

I am struggling to find a solution for it without using the modulus operator.

Best Answer

Seems to me like

floor(n) = n - (n % 1)

should do the trick.