Post Reply 
A tiny synthetic HP41 challenge
12-07-2016, 07:17 PM (This post was last modified: 12-07-2016 07:21 PM by Dieter.)
Post: #1
A tiny synthetic HP41 challenge
I'm not an expert if it comes to synthetic programming on the HP41, so probably someone else here may have a better idea than me for the following little challenge.

The task: truncate a number after six or seven significant digits and normalize it to the domain 0 <= X < 1.

Some examples:
3,141592654 => 0,314159 or 0,3141592
ā€“1,234567809 Eā€“32 => 0,123456 or 0,1234567
9,999999999 E+99 => 0,999999 or 0,9999999
0,123456 => 0,123456

Here's my solution:

Code:
CLA
ABS
STO M
ASTO M
ASTO M
ASTO M
>"\x00\x09\x99"
RCL M
CLA
END

The append command adds three bytes (decimal 0, 9, 153 or hex 00, 09, 99) to clear the last three digits and set the exponent to ā€“1.

I am sure you can do better. So what's your idea here?

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
A tiny synthetic HP41 challenge - Dieter - 12-07-2016 07:17 PM
RE: A tiny synthetic HP41 challenge - hth - 12-08-2016, 06:25 PM
RE: A tiny synthetic HP41 challenge - hth - 12-08-2016, 08:34 PM



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