Is it possible to simulate a floor() function with elementary arithmetic?

I’m using a “programming language” that only allows basic operations: addition, subtraction, multiplication, and division.

Is it possible to emulate a floor function (i.e. drop the decimals a number) by using only those operators? I’m only interested in positive numbers

Edit: Here’s the documentation describing what’s possible (which is only elementary arithmetic)


where c1,c2 are some constants, and f1 represents addition and subtraction, and f2 represents multiplication and division. Functions f1 and f2 have inverse function, but x does not have an inverse function. So, if we assume it is possible to find x from x using f1 and f2, then it is possible to find x from x. Contradiction.

Source : Link , Question Author : fregante , Answer Author : Community

Leave a Comment