Monday, August 27, 2018

HP 12C Platinum and DM 41L: Rounding Numbers


HP 12C Platinum and DM 41L:  Rounding Numbers

Introduction

The following programs will round any positive number to any number of decimal places, regardless of your fix/float settings.  The formula for rounding x to n decimal places:

int(10^n * x + 0.5) / 10^n

HP 12C Platinum Program (also for HP 12C): Rounding a positive number

Step
Key Code
Key

001
1
1

002
0
0

003
34
x<>y

004
21
y^x

005
20
*

006
43, 40
LST x
For HP 12C regular: the code is 43, 36
007
34
x<>y

008
48
.

009
5
5

010
40
+

011
43, 25
ITNG

012
34
x<>y

013
10
÷

014
43, 33, 000
GTO 000


DM 41L (also for HP 41C) Program ROUND: Rounding a positive number

01 LBL ROUND
02 10^X
03 *
04 LASTx
05 x<>y
06 .5
07 +
08 INT
09 x<>y
10 /
11 RTN

Examples

Instructions:  Enter x, press [ENTER], enter n, execute the program

x
n
Result
0.83
1
0.8
8.21365
4
8.2137
170561.7737
0
170562
π
4
3.1416

Source:

Keith Oldham, Jan Myland, and Jerome Spanier  An Atlas of Functions Second Edition,  Springer.  2009 ISBN 978-0-387-48806-6

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.

1 comment:

  1. I've got to give your 12C and 15C programs a try. I recently unpacked my calculators from my move.

    ReplyDelete

TI-84 Plus CE: Simple Elliptic Curves Determined by Two Points

TI-84 Plus CE:  Simple Elliptic Curves Determined by Two Points Introduction The program ECURVE determines the coefficients of a simple...