(12C) Banker's Rounding Method
11-27-2018, 05:31 AM
Post: #1
 Eddie W. Shore Senior Member Posts: 1,235 Joined: Dec 2013
(12C) Banker's Rounding Method
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 002  INTG 003  STO 1 004  LSTx   005  FRAC 006  STO 2 007   . 008  5 009   - 010   x=0 011   GTO 018 012   RCL 0 013   FIX 0 014   RND 015   STO 4 016   FIX 2 017   GTO 000 018   RCL 1  019   2 020   รท 021   FRAC 022   x=0 023   GTO 029 024   RCL 1 025   1 026   + 027   STO 4 028   GTO 000 029   RCL 1 030   STO 4 031   GTO 000

Original blog post: https://edspi31415.blogspot.com/2018/11/...nkers.html
 « Next Oldest | Next Newest »

 Messages In This Thread (12C) Banker's Rounding Method - Eddie W. Shore - 11-27-2018 05:31 AM RE: (12C) Banker's Rounding Method - Albert Chan - 11-27-2018, 06:42 PM RE: (12C) Banker's Rounding Method - Eddie W. Shore - 12-08-2018, 08:35 PM

User(s) browsing this thread: 1 Guest(s)