Showing posts with label rounding numbers. Show all posts
Showing posts with label rounding numbers. Show all posts

Saturday, September 15, 2018

HP 20S and HP 21S: Rounding Numbers

HP 20S and HP 21S:  Rounding Numbers

Introduction

The following program will allow the user to round any positive number to any number of decimal places, regardless of fixed decimal settings. 

This is based off the algorithm:

x_rounded = int(10^n * x + 0.5) ÷ 10^n

Note:  You can check out the programs for the HP 12C and DM 41L/HP 41C here:  
http://edspi31415.blogspot.com/2018/08/hp-12c-platinum-and-dm-41l-rounding.html

HP 20S and HP21S Program: Rounding Numbers

Key codes for both calculators are the same.

Step Key Key Code
01 LBL C 61, 41, C
02 10^x 51, 12
03 STO 0 21, 0
04 SWAP 51, 31
05 × 55
06 RCL 0 22, 0 
07 + 75
08 . 73
09 5 5
10 = 74
11 IP 51, 45
12 ÷ 45
13 RCL 0 22, 0
14 = 74
15 RTN 61, 26

Instructions

Enter x, press [INPUT], enter n (number of decimal places)

Examples

For these examples, I have set the calculator in ALL setting ( [right shift], [ ) ] )

Example 1:  Round π to 4 places.

π [ INPUT ] 4  [XEQ] (C)

Result:  3.1416

Example 2:  Round e^2.2 to 6 places

2.2 [e^x] [INPUT] 6 [XEQ] (C)

Result:  9.025013

Note:  I typed this blog entry by using the Jarte word processor (http://www.jarte.com/index.html).  I am using the free version for the first time (there is also a paid version). Jarte is based off of WordPad, but adds spell check and nicer editing features.  

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.

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.

Casio fx-4000P: Antennas

Casio fx-4000P: Antennas Vertical and Horizontal Bandwidth Given the height (h) and length (l) of an antenna plate, along with w...