08-28-2018, 04:28 AM
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
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
Source:
Keith Oldham, Jan Myland, and Jerome Spanier An Atlas of Functions Second Edition, Springer. 2009 ISBN 978-0-387-48806-6
int(10^n * x + 0.5) / 10^n
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
Source:
Keith Oldham, Jan Myland, and Jerome Spanier An Atlas of Functions Second Edition, Springer. 2009 ISBN 978-0-387-48806-6