Post Reply 
HP-42S - How do I round a number?
03-22-2021, 03:05 PM
Post: #13
RE: HP-42S - How do I round a number?
(03-22-2021 05:03 AM)Werner Wrote:  In the same vein, SCI 03 rounding: (which, incidentally, also fails for 0.9999.. ;-)
Code:
1E8
RCLx ST Y
+
LASTX
-
Free42, use 1E30

A more robust way is with Veltkamp’s splitting, algorithm 3
On various ways to split a floating-point number

C = 1E30 + 1      // Free42-Decimal, SCI 03 (*)
Y = C*X
Z = X-Y+Y          // Z has 34-30 = 4 sig. digits

(*) not quite: SCI-03 does half-way away-from-zero, Z does banker's rounding.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-42S - How do I round a number? - DM48 - 03-21-2021, 08:15 PM
RE: HP-42S - How do I round a number? - Albert Chan - 03-22-2021 03:05 PM



User(s) browsing this thread: 1 Guest(s)