What are some uses of the ceiling function?
1 18 Apr 2018 16:19 by u/TOP_PAID_SHILL
I know there's a lot of applications for using the floor or round function but I've struggled to think of many explicit reasons to use the ceiling function. The only one I can think of are transit schedules where if you miss one bus you have to wait for the next one.
4 comments
0 u/SquarebobSpongebutt 18 Apr 2018 16:58
Rounding to the nearest multiple of another number. This could be useful when determining how many cases of x amount are needed to fill at least y amount of need (ie: how many cases of 24 light bulbs are needed for 639 fixtures (Ceiling(639,24)/24 in Excel for case count). This is the standard Excel implementation that takes 2 parameters of the value and the significance.
0 u/Sosacms 18 Apr 2018 17:12
Any situation where a partial counts as a whole. Charging by the hour? 1.1hrs is charged with 2hrs. Container only holds 5 but you have 6, need 2 containers. I'm sure there are plenty of situations I can even consider when even a slight excess is counted as another whole.
0 u/Veridic 18 Apr 2018 18:14
Listing a price.
0 u/meowman9000 22 Apr 2018 20:59
I use it in my game so that no background tiles are left non-visible. Obviously a character will rarely line up exactly with an even number of background tile, and its important that any half tiles are shown. So a decimal number is not useful, and you can only show a rounded number of tiles, and you dont want to cut off any visible tiles.