(12C) Banker's Rounding Method - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (12C) Banker's Rounding Method (/thread-11852.html) |
(12C) Banker's Rounding Method - Eddie W. Shore - 11-27-2018 05:31 AM The banker's rounding method involves rounding numeric amounts to the nearest integer. When the number ends in 0.5 (1.5, 3.5, 8.5, etc), special rules apply: The decimal gets rounded to the nearest even integer. For example: 0.5, 2.5, and 4.5 round down to 0, 2, and 4 respectively. However, 1.5, 3.5, and 5.5 are rounded up to 2, 4, and 6 respectively. Code: 001 STO 0 Original blog post: https://edspi31415.blogspot.com/2018/11/ti-84-plus-and-hp-12c-platinum-bankers.html RE: (12C) Banker's Rounding Method - Albert Chan - 11-27-2018 06:42 PM I think banker's rounding method apply to non-integers too (edge case round-to-even). For banker's rounding to nearest integer, this is shorter Code: 01 . Example: 1233.5 R/S ==> 1234 1233.9 R/S ==> 1234 1234.5 R/S ==> 1234 1233.49 R/S ==> 1233 1234.51 R/S ==> 1235 Updated: code numbering start from 1, instead of 0 RE: (12C) Banker's Rounding Method - Eddie W. Shore - 12-08-2018 08:35 PM Just a slight correction since the code starts at line 1, not 0: Code: 01 . Otherwise, brilliant! |