So, I was playing around with desmos, and was curious to find a function for finding the floor, ceiling, and a formula to round a number. I came up with this, using summations:
Rounding function:
$$\sum_{n=0}^{\frac{x}{|h|}} h - \sum_{n=0}^{\frac{-x}{|h|}} h$$
Floor function:
$$\sum_{n=0}^{\frac{x - 0.5}{|h|}} h - \sum_{n=0}^{\frac{0.5 - x}{|h|}} h$$
Ceiling function:
$$\sum_{n=0}^{\frac{x+0.49999...999}{|h|}} h - \sum_{n=0}^{\frac{-(x+0.49999...999)}{|h|}} h$$
Now, let me go over what all the variables here mean. $z$ and $w$ are only placeholder variables for the actual functions because I can't seem to be able to fit more than 1 character on the top of the sigma symbol for the summation. x is the value that has to be rounded off. $k$ is a place holder value for the 3 values -0.5, 0, and 0.5, over which I'll go over soon. $x$ is the number that needs to be estimated. $h$ is the number to who's multiple $x$ is being rounded off to. For example, if $x$ is 11.3, and $h$ is 3, then the estimated value is 3 (we're assuming $k$ is 0 over here). This is the rounding function.
The floor function is similar, except 0.5 is subtracted from $x$, and the same process happens. For the standard function, where it rounds off the number to it's closest lower integer, the value of $h$ would be 1. However, if you would like for it to round it off to the lower integer it is between of any other number's multiple, you can set the value of $h$ as the number who's multiples you wish to use for this to get the job done.
The same should be said for the ceiling function, except it gives the higher integer it is closest to.
I would like to know your opinion on this, and other functions for this purpose that have been created. I would also be interested in knowing if there is any way to make this more efficient.
I would also like to link the desmos graph I used to play around with it, so you can also check it out. Any further help would be greatly appreciated!