Page 1 of 1
[Circuits] Round up when dividing?
Posted: Sat Feb 05, 2022 12:18 am
by TheG_Ghaladron
Title says it all really. The arithmetic combinator rounds down when it divides, but I need it to always round up instead. What's the most compact way to do this? My first thought was add 1, but that doesn't work if the division gives an integer.
Re: [Circuits] Round up when dividing?
Posted: Sat Feb 05, 2022 12:51 am
by DaveMcW
Add (Divisor - 1) before you do the division.
Re: [Circuits] Round up when dividing?
Posted: Tue Jun 13, 2023 5:22 am
by DasNasu
Sorry for necroposting but either i missunderstand something or the answer is wrong. simple example:
10 / 9 with round up would be 2, because 10/9 = 1.111...... with rounding up it gives 2. putting this in an arithmetic still outputs 1 because is rounds down after calculation
Re: [Circuits] Round up when dividing?
Posted: Tue Jun 13, 2023 9:32 am
by Stringweasel
DasNasu wrote: ↑Tue Jun 13, 2023 5:22 am
Sorry for necroposting but either i missunderstand something or the answer is wrong. simple example:
Seems correct to me
(10 + (9-1)) / 9 = 18 / 9 = 2
And if your round 2 down, it's still 2. If it's not working for you in-game then there might be a problem in how you used it.