I have $\lceil x \rceil = -\lfloor -x \rfloor$, but I can't figure out how to rely on this in order to get $\lfloor x \rfloor$ from $\lceil x−1 \rceil$.

For the record, I am only interested in non-negative real values.

I wish to avoid the use of $modulo$, $abs$, $round$ and $if$.

The motivation behind this question is as follows:

$$x-\frac{1}{2}-\frac{\arctan(\tan(\pi(x-\frac{1}{2})))}{\pi}=\lceil x-1 \rceil$$

How do I "manipulate" the value of $x$ in order to get $\lfloor x \rfloor$ instead of $\lceil x-1 \rceil$?


I also have this if it helps:

$$x+\frac{1}{2}+\frac{\arctan(\tan(\pi(-x-\frac{1}{2})))}{\pi}=\lceil x \rceil$$

  • 2
    $\begingroup$ If $x\in\mathbb N$, $\lceil x-1 \rceil = x-1 = \lfloor x \rfloor - 1$, else $\lceil x-1\rceil = \lfloor x \rfloor$. Without additional information, this is impossible. ($\pm0$) $\endgroup$ – AlexR Apr 10 '14 at 16:15
  • $\begingroup$ What about $\lceil{x-1\rceil}=\lceil{x\rceil}-1$? $\endgroup$ – npisinp Apr 10 '14 at 16:16
  • $\begingroup$ You can pull integer addition from ceiling. From there you already have all you need... $\endgroup$ – The Great Duck Mar 4 '16 at 5:11

You know that $\lfloor x\rfloor=-\lceil-x\rceil$, so if you replace $x$ by $-x$ and multiply the equation by $-1$, you get $$x-\frac{1}{2}-\frac{\arctan(\tan(\pi(x-\frac{1}{2})))}{\pi}=-\lceil -x \rceil=\lfloor x\rfloor$$

  • $\begingroup$ Can you please see updated question, as to the motivation behind it? $\endgroup$ – barak manos Apr 10 '14 at 16:30
  • $\begingroup$ No it doesn't. Take a look at your proposed function. It is identical to the first one in my question, which yields $\lceil x-1 \rceil$. $\endgroup$ – barak manos Apr 10 '14 at 16:43
  • $\begingroup$ @barakmanos Right. I forgot $x$ can't be an integer, then it's even true that $\lceil x-1\rceil=\lfloor x\rfloor$ and you don't have to derive it from the updated version like I did. Is it clear how I did it? $\endgroup$ – user2345215 Apr 10 '14 at 16:47
  • $\begingroup$ Yes it is. But it doesn't provide an answer to my question, unless I use $if$ inside the function. $\endgroup$ – barak manos Apr 10 '14 at 17:03
  • $\begingroup$ @barakmanos Well, graphing it [here] alongside a floor function seems to be the exact same function as a result. [here]=desmos.com/calculator/yuousd7vdl $\endgroup$ – Conor O'Brien Dec 10 '14 at 2:54

If $x\in\mathbb N$, $\lceil x-1 \rceil = x-1 = \lfloor x \rfloor - 1$, else $\lceil x-1\rceil = \lfloor x \rfloor$. Without additional information, this is impossible.

  • $\begingroup$ Thanks @AlexR, but what do you mean by "additional information"? Also, I wish to avoid the use of $modulo$, $abs$, $round$ and $if$ (updated the question accordingly). $\endgroup$ – barak manos Apr 10 '14 at 16:19
  • $\begingroup$ @barakmanos This means if $\lceil x-1 \rceil$ is the only piece of information you have, you can't figure out $\lfloor x \rfloor$. You need the information if $x\in\mathbb N$ in some form or another. For example $(x-\lceil x-1\rceil > 0)$ (as a boolean) would suffice. If it is false, $x\in\mathbb N$, else $x\notin\mathbb N$. And from there you can use the two formulas given. $\endgroup$ – AlexR Apr 10 '14 at 16:21

Changing the $\dfrac{1}{2}$ found in the equation to a $\dfrac{1}{-2}$, we are resulted with this:


$$f(x)=x+\frac{1}{-2}+\frac{\arctan \left(\tan \left(\pi \left(-x-\frac{1}{2}\right)\right)\right)}{\pi }=\lfloor x\rfloor$$


$$f(1)=1$$ $$f(1.5)=1$$ $$f(\pi)=3$$ $$f(e)=2$$ $$f(-1)=-1$$ $$f(-1.5) = -2$$



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.