Can someone explain to me what the floor and cealing functions are actually doing numerically?
how does a floor function work? - Mathematics Stack Exchange
discrete mathematics - Solving equations involving the floor function - Mathematics Stack Exchange
What is the purpose of the Floor and Ceiling Functions?
Videos
When I truncate a number what my brain actually does is ignoring the fractional part of said number. But its not doing any real math.
I understand I can express a truncate function with conditional floor and cealing functions... but thats is not what I need.
I need someone to teach me how to arrive from a number to its integer using only mathematical operations and not logical functions.
I need to know...
Plz help me someone...
This is better suited for the programming forums but....
Your computer program is probably working with a binary representation of a number. To compute the floor function, the computer does exactly the same thing you do: e.g. if it holds a representation of the positive binary numeral
$$ 100110.01011101 $$
then it simply replaces every digit to the right of the point with a zero:
$$ 100110.00000000 $$
The processor your program runs on likely has assembly language instructions for performing this exact operation when a number is stored in a register in IEEE 754 standard format (which is almost always used to store floating-point numbers).
if you are asking about what the computer does it is like this:
you have the variable
which means that out off all the integers that beneath take the largest.
now the computer doesn't has the function or the group
or any of those stuff
so he do it differently, the computer save memory with
's and
's, bits, integer he saves with 32-bits(usually)
for understanding with 8-bits it looks like this:
$1111~1111$bits
$1000~0000$bits
$0111~1111$bits
now for float he has a different method, 32-bit format looks like this:
$\underbrace{0}_{0=positive\\1=negative}\underbrace{00000000}_{the~exponent }~~\underbrace{00000000000000000000000}_{the~fraction~part}$
now how exactly this format works is not important now, but you can see from this format that if you have the float, for example, $0~~10000000~11000000000000000000000(=3.5)$ the computer can just ignore the last 22 bits and take only $0~~10000000~1$, the computer can extract all he needs from the first 10 bits if you do interested in how the float itself works:
the computer look at the first bit and put it in var name AXL(for this example) and do now he takes the last part and do $DX=1+\text{[the bit]}^\text{[the bit position]}+\text{[the bit]}^\text{[the bit position]}+...$
and the end result is:
$AX\times (DX\times 2^{\text{[the middle part value]}})$
now because that every part after the 10th bit is quarter or less you don't need them when you use floor
HINT: Let $n=\lfloor x\rfloor$, so that $n\le x<n+1$. Let $\alpha=x-n$, the fractional part of $x$, so that $x=n+\alpha$. You’re looking for those $x$ such that $\lfloor 2x\rfloor=3\lfloor x\rfloor$, i.e., such that $\lfloor 2(n+\alpha)\rfloor=3n$.
Clearly $\lfloor 2(n+\alpha)\rfloor=\lfloor 2n+2\alpha\rfloor$, and because $2n$ is an integer, $\lfloor 2n+2\alpha\rfloor=2n+\lfloor 2\alpha\rfloor$. Can you finish it from here?
$\newcommand{\+}{^{\dagger}}% \newcommand{\angles}[1]{\left\langle #1 \right\rangle}% \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}% \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}% \newcommand{\dd}{{\rm d}}% \newcommand{\isdiv}{\,\left.\right\vert\,}% \newcommand{\ds}[1]{\displaystyle{#1}}% \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}% \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}% \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}% \newcommand{\ic}{{\rm i}}% \newcommand{\imp}{\Longrightarrow}% \newcommand{\ket}[1]{\left\vert #1\right\rangle}% \newcommand{\pars}[1]{\left( #1 \right)}% \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}}% \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}% \newcommand{\sech}{\,{\rm sech}}% \newcommand{\sgn}{\,{\rm sgn}}% \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}}% \newcommand{\verts}[1]{\left\vert #1 \right\vert}% \newcommand{\yy}{\Longleftrightarrow}$
- If $x$ $\large\tt is$ an integer, we have $2x = 3x\quad\imp\quad \color{#0000ff}{\large x = 0}$.
- if $x$ $\large \tt\mbox{is not}$ an integer: $x = n + \delta$ where $n$ is an integer and $0 < \delta < 1$. Then,
$$
\floor{2x} = 3\floor{x}
\quad\imp\quad
\floor{2n + 2\delta} = 3\floor{n + \delta} = 3n
\tag{1}
$$
We have two sub-cases:
- $0 < \delta < 1/2$: $\pars{1}$ is reduced to: $$ 2n = 3n\quad\imp\quad n = 0\quad\imp\quad \color{#0000ff}{\large x\ \in\ \pars{0,{1 \over 2}}} $$
- $1/2 \leq \delta < 1$: $\pars{1}$ is reduced to: $$ 2n + 1 = 3n\quad\imp\quad n = 1\quad\imp\quad \color{#0000ff}{\large x\ \in\ \pars{1,2}} $$
Then, the solution becomes $\ds{\color{#0000ff}{x \in \left[0,{1 \over 2}\right) \bigcup \pars{1,\vphantom{1 \over 2}2}}}$.
How about $x < 0$ ?. I left it to the OP.



