Ceil () and Floor()

1.9k Views Asked by At

I already know the basic rules for the both functions:

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

But I could not understand the following these:

$$\text{Ceil}(2.6, 0.25)=2.75\\ \text{Floor}(2.6, 0.25)=2.5$$

Why is there a second parameter? How Could I calculate the that to obtain the results above?

PS: I already been researching on google and books, but I only could get what I already know.

Thanks for your collaboration.

2

There are 2 best solutions below

0
On

These are to the nearest multiple of $0.25$, rather than integer (multiple of $1$).

0
On

From the two examples you have, one possible interpretation is $$\text{Floor$(a,b)$ = Largest $x \leq a$ such that $x=nb$, where $n \in \mathbb{Z}$}$$ $$\text{Ceil$(a,b)$ = Smallest $x \geq a$ such that $x=nb$, where $n \in \mathbb{Z}$}$$ The usual floor and ceil function are $$\text{Floor(a) = Floor$(a,1)$}$$ $$\text{Ceil(a) = Ceil$(a,1)$}$$