Monday, November 26, 2018

TI-84 Plus and HP 12C Platinum: Banker's Rounding Method

TI-84 Plus and HP 12C Platinum:  Banker's Rounding Method

Introduction 

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.

TI-84 Plus Program:  BANKRND

"2018-11-22 EWS"
Disp "BANKER'S ROUNDING"
Prompt X
iPart(X) → I
fPart(X) → F

If F=0.5
Then

If fPart(I/2)=0
Then
I → N
Else
I+1 → N
End

Else
round(X,0) → N
End
Disp N

HP 12C Platinum Program: Banker's Rounding

Note: Use two-digit addresses for the regular HP 12C.

Memory addresses needed: registers 0 through 4.  

Step  Key

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

Source:

"Bankers Rounding"  http://wiki.c2.com/?BankersRounding  Retrieved November 22, 2018


Eddie

All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.

Fun with the HP 30b

Fun with the HP 30 b Introduction The following programs are for the HP 30b Business Professional. Did you know that the 30b...