Difference between revisions of "Rounding"
m |
m |
||
| Line 10: | Line 10: | ||
==History== | ==History== | ||
| − | In general, as the versions progressed, more and more things started to use random rounding. For example, [[AC] and [[EV]] weren't randomly rounded until [[0.33]]. | + | In general, as the versions progressed, more and more things started to use random rounding. For example, [[AC]] and [[EV]] weren't randomly rounded until [[0.33]]. |
Revision as of 06:39, 9 November 2025
Version 0.33: This article is up to date for the latest stable release of Dungeon Crawl Stone Soup.
Crawl uses several types of rounding:
- Always round up: Numbers are rounded up.
- Always round down (truncate): Numbers are rounded down, thus ignoring the decimal place. By default, C++ truncates numbers, so if there's no other indication in the code, it'll be rounded down.
- Round half up: 0.5 and up are rounded up, else round down. This may be used for ranges and other numbers that can't feasibly be randomised.
- Weighted rounding (rounded in a weighted manner): The number is tracked, typically to the hundredths place. The decimal place remainder is the % chance to round up. This is very commonly used to avoid hard breakpoints, e.g., spell damage, shield encumbrance, time used to take actions, AC/EV all use weighted rounding.
History
In general, as the versions progressed, more and more things started to use random rounding. For example, AC and EV weren't randomly rounded until 0.33.