floor() function from scratch.
Manipulating like converting float to string, and cutting all after dot are allowed.
All languages are allowed.
Any usage of built in language functions (like
toInteger()) or similar is not allowed, casting operators are not allowed.
So, your task is implement floor() function without using casting and built in language functions.
Your function must support at least max 32-bit integer values (you will never receive negative values).
Forced casting (like
somevar as float) and normal casting - such as
(int) somevar -
is not allowed, any built in functions, not allowed, all other stuff allowed.
Winner: Shortest implemention.