Tuesday, March 09, 2010

Proposal: Rounding errors

Timed out and passed, 10-0. Josh

Adminned at 11 Mar 2010 12:39:25 UTC

To the end of subrule 3.2.1 “Numbers and Variables”, append the following bullet point:

  • If a rule implies that the result of a division should be an integer (for instance, by attempting to store that result in, or add it to, a gamestate variable that can only hold integers), the result of the division is instead the result rounded towards 0.

Because, otherwise I can’t resolve Raiding if the resources don’t divide evenly. This problem has probably come up before, and is likely to come up again, so fixing with a Glossary fix.

Comments

Kevan: he/him

09-03-2010 16:02:09 UTC

for

Josh: Observer he/they

09-03-2010 16:17:57 UTC

for

Klisz:

09-03-2010 16:27:35 UTC

for

Keba:

09-03-2010 18:24:59 UTC

for

Roujo: he/him

09-03-2010 21:03:55 UTC

for Sure, but I think a “round towards the nearest even number” would be better

Purplebeard:

09-03-2010 21:42:14 UTC

for

ais523:

09-03-2010 22:04:52 UTC

@Roujo: I don’t, it might lead to rounding error loops in a future dynasty.

Darknight: he/him

10-03-2010 00:30:20 UTC

for

dbdougla:

10-03-2010 06:26:53 UTC

for

dbdougla:

10-03-2010 06:30:51 UTC

I think Roujo is referring to the method of rounding listed at http://en.wikipedia.org/wiki/Rounding#Round_half_to_even which leads to more accurate average results.  This only makes sense, though, when dividing the integers yields exactly X.5

There’s no way that would lead to a loop or problem that I can see.

ais523:

10-03-2010 16:37:08 UTC

@dbdougla: It produces more accurate results on average, but can be manipulated to drive results upwards or downwards if you aren’t trying random inputs, but instead contriving them. For instance, imagine four people have 1 Coal each. Two of them pool their Coal and distribute it evenly among those 4 people. Now, the other 2 people have 1 more Coal than when they started, and there’s 6 Coal in total. Repeat to gain infinite Coal. There isn’t a rule that lets you do that in this dynasty, but it’s easy to imagine it being possible in another dynasty.

Qwazukee:

10-03-2010 21:48:54 UTC

imperial

Klisz:

10-03-2010 21:52:06 UTC

@ais523,dbdougla: I think by “even number” he means “integer”, not actually even numbers.

ais523:

11-03-2010 09:48:10 UTC

@Darth: I don’t; round-to-even is often used in the financial industries, and does indeed mean rounding to even numbers.