Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Why does Roll20 round up instead of Rounding down?

June 06 (12 years ago)
Matt
Plus

One thing that has somewhat complicated Macro writing for me in Roll20 is the fact that the program rounds up instead of rounding down when doing math. This is problematic because just about any game system I have ever played rounds down.

So for example, when I wrote the macro for my Paladin's lay on hands, it had to be /roll ((level-1)/2)d6 instead of (level/2)d6.

It rounds mathematically correct. 0.5 gets rounded up. If you try something like /roll (4/3)d6 or so, it would roll only 1, since .33 gets roudned down.

You're correct of course that most game systems round down, so something like a floor() function would sure be nice, and I'm sure with the API it's possible, but not sure how well you can do dicerolls with it yet.

Another workaround is something like
/roll ((level/2)-0.01)d6
or so, making 3.5 into 3.49 and then it gets rounded down, while a 2 is made into 1.99 and rounded up, leaving it at 2.

June 06 (12 years ago)
Matt
Plus

Ah, I see. I run Pathfinder and rarely is there a situation where you get below a .5 in terms of fractions because enhancements typically happen every 1 or 2 levels.

I bet you though that if Roll20 was rounding down all the time even if something was .99 or so, then other people would complain that it's not mathematically correct. Or that it should round up because that's how their game system does it.

Can't ever please everyone, but as long as there's a relatively simple way of getting it to do what you want, it's not a big problem really.

June 06 (12 years ago)

Well, you might be right, but when there is a standard, and that standard is neither right or wrong but just a standard, then why break from it?

In other words, what I am saying is, if computers have been rounding down since the beginning of times (even in excel, if you say "INT(456.789)", the result will be 456, and type casting, "int ( )" is done a lot in programming) computers have been rounding down and programmers have since the beginning of times been working with that system, and if this systems or practice is neither right or wrong, simply standard... then why change it and not only possibly confuse your average newbie, but also seasoned programmers?

But then again... I'm not really looking for an answer (I already have it) but rather to pose you all with this question. The question is more important than the answer and bla bla bla...

June 06 (12 years ago)
Gauss
Forum Champion

Yokhen, what you are describing isn't rounding, it is truncation. Here is a an article on it: http://www.jimloy.com/arith/rounding.htm

Now, I don't know why it is rounding as opposed to truncation since I'm not a Dev, but it is probably because as a dice roller that performs mathematics it should have the mathematical standard rather than the programming standard which would be rounding. If it was set to truncation instead the average user would probably get be upset when numbers get truncated.

- Gauss

BTW - the rounding thing only seems to happen when the number is being used as the number of dice to roll rather than a modifier.  In my experience, it does no rounding when the math involved is for a modifier to the roll, which is kind of weird, because then you see decimals, potentially out four or five spaces.

June 06 (12 years ago)
Gauss
Forum Champion

Carl, that is because you cannot roll a fractional number of dice. It must change the number to a whole number before rolling the dice.

Rounding after the roll is made is not required by the system (dice rolling system) and if it did round up or down someone would say "But my game system doesn't do that!" 

- Gauss

June 06 (12 years ago)

My System doesn't do that!

June 07 (12 years ago)
Matt
Plus

Yokhen said:

My System doesn't do that!

CURSES!

Gauss said:

Carl, that is because you cannot roll a fractional number of dice. It must change the number to a whole number before rolling the dice.

Rounding after the roll is made is not required by the system (dice rolling system) and if it did round up or down someone would say "But my game system doesn't do that!" 

- Gauss

It's why I really wish there was a roundUp and roundDown function.  It's ubiquitous in tabletop gaming, it's meant to make the numbers easier to tally mentally.  It's an odd omission given the presence of stuff like exploding dice.
June 08 (12 years ago)
Matt
Plus

Helmic said:

Gauss said:

Carl, that is because you cannot roll a fractional number of dice. It must change the number to a whole number before rolling the dice.

Rounding after the roll is made is not required by the system (dice rolling system) and if it did round up or down someone would say "But my game system doesn't do that!" 

- Gauss

It's why I really wish there was a roundUp and roundDown function.  It's ubiquitous in tabletop gaming, it's meant to make the numbers easier to tally mentally.  It's an odd omission given the presence of stuff like exploding dice.
YES! Thank you! I was like "This program lets me do exploding dice and has playing cards, but I can't toggle whether I want it to round up or round down?"