Sunday, October 27, 2019

HP 12C and HP 41C/DM41L: Rounding Numbers

HP 12C and HP 41C/DM41L:  Rounding Numbers

Introduction

The following program rounds positive numbers to the desired decimal amount of places.  For example,  √3 rounded to 3 places is 1.732.  e^2 rounded to 2 places is 7.39. 

Set up your stack like this:
Y:  number
X: number of decimal places

HP 12C Program: Rounding

Step;  Code;   Key
01;  1;  1
02;  0;  0
03;  34;  x<>y
04;  21;  y^x
05;  36;  ENTER
06;  33;  R↓
07;  20;  *
08;  36;  ENTER
09;  43,24;  FRAC
10;  40;  +
11;  43, 25;  ITNG
12;  33;  R↓
13;  33;  R↓
14;  33;  R↓
15;  10;  ÷
16;  43,33,00;  GTO 00

HP 41C Program:  Rounding

01  LBL^T ROUND
02  10↑X
03  STO T
04 *
05 ENTER↑
06 FRC
07 +
08 INT
09 R↑
10 /
11 RTN
12 END

Examples:

Round √3 rounded to 3 places

Y:  3, sqrt   (√3)
X:  3

Result:  1.732

Round e^2 rounded to 2 places. is 7.39. 

Y: 2,  e^x  (e^2)
X:  2

Result:  7.39

Eddie

All original content copyright, © 2011-2019.  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.

  Casio fx-7000G vs Casio fx-CG 50: A Comparison of Generating Statistical Graphs Today’s blog entry is a comparison of how a hist...