Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Rounding a number to nearest even
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Lie, post: 3535051"] The same as choosing between round-half-odd and round-half-even, arbitrary but not without a reason. Language-wise it is a contradiction. In a loose semantic meaning, it means there is no strong reason for choosing one above the other (round-up vs round down and round-half-even vs round-half-odd) but there are slight advantages on one that would seems silly to be mentioned as the main reason, so arbitrary but not without reason. No, you can only include one of the endpoints, because if both endpoints are included, the integers would be a included twice on the various sets of numbers, e.g. in [1.0 - 2.0] and [2.0 - 3.0] the number 2.0 is included in both ranges, you can't be a member of both ranges because that means if you have a "fair" random number generator, the possibility of integral number to appear would be twice the possibility of non-integral numbers, well that's not a fair random number generator isn't it? Actually, I'm on the side that think numbers should never be rounded[1], except for a final representation to human viewer who should be made aware that the numbers in the presentation should never be used for further calculation, as they are only informative but not normative. In this view, the exact rounding method is irrelevant as numbers used for calculation are never rounded while at the lower level the amount of change caused by rounding has become irrelevant because of the extra precision used. In short, if the rounding algorithm causes you a trouble in the particular field, increase the precision. [1] As computers do have limitation on storage of real number representation, this statement means that real numbers should be kept as precise as the hardware allows or to use decimal and allow extra precision generously. If you include negative numbers, the ARE is zero on round-half-away- from-zero, not in round-up though. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Rounding a number to nearest even
Top