HP Forums
(12C) Rounding Positive Numbers - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (12C) Rounding Positive Numbers (/thread-11282.html)



(12C) Rounding Positive Numbers - Eddie W. Shore - 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