Mathematical representation of Floor( ) and Ceil( ) for various decimal places.

531 Views Asked by At

I know the basic rules for Floor( ) and Ceil( ):

$$ \text{Floor}(2.5) = 2\\ \text{Ceil}(2.5) = 3 $$

Is there a way to denote the Floor( ) and Ceil( ) function for various decimal places? For example, I know that one way is to write the following for two decimal places:

$$ \frac{\text{Floor}(2.4783 \times 100)}{100} = 2.47 $$

but I was wondering if there was a way to write it without the fractions. Thank you so much!

2

There are 2 best solutions below

0
On BEST ANSWER

Your function scales both input $x$ and output $y$ up by a factor of $100$: $$ \lfloor 100 x \rfloor = 100y, $$ i.e. if we define these scaled coordinates $X = 100x$ and $Y = 100y$, then the equation relating inputs to outputs looks like $$ \lfloor X \rfloor = Y, $$ which you can think of the prototype of the relationship between the variables. Putting all the transformations in one diagram looks like
$$ x \to X \to Y \leftarrow y, $$ so the only way to build the composition $x \to y$ is to invert that last arrow $Y \leftarrow y$ to produce $Y \to y$, namely to divide by the scaling factor, hence we introduce fractions.

As always, we can hide the fraction inside of a definition, which doesn't change the fact that we're dividing by the scaling factor, but cosmetically, it might look nicer. We could, for instance, for any $p > 0$, define a rounding function with precision $\frac1p$ by $$ \operatorname{floor}_p(x) = \frac1p \lfloor p x \rfloor $$ that has the property that $\operatorname{floor}_p(x) = y$ for all $y \leq x \leq y + \frac1p$. With this notation, your example would look like $$ \operatorname{floor}_{100}(2.4783) = 2.47. $$

0
On

You are asking about truncation.

In the linked Wikipedia article, the notation is as follows.

Given a number $ x\in \mathbb {R}_+ $ to be truncated

and $n\in \mathbb {N} _{0}$, the number of digits to be kept after the decimal point,

the truncated value of $x $ is $\operatorname {trunc} (x,n)={\dfrac {\lfloor 10^{n}\cdot x\rfloor }{10^{n}}}$.