Post Reply 
Sharp EL-5100 Instruction Manual - PDF, full text searchable
05-18-2022, 02:53 AM
Post: #14
RE: Sharp EL-5100 Instruction Manual - PDF, full text searchable
A charming quirk of the vintage EL-5100 is that 1.9+ᴱ10-ᴱ10 = 1 because of non-rounding to 10 digits. So adding and subtracting \( 10^{10} \) removes the fractional part. This comes in handy to "hack" algebraic expressions on the EL-5100 that require truncation, rounding, fractional part and mod, which I listed in a previous post together with some example AER programs that use these functions.

So I was surprised to discover an exception to this rule 0.1+ᴱ10-ᴱ10 = 0.1 and -0.1+ᴱ10-ᴱ10 = -1. By contrast, fractions smaller than \( \pm .1 \) and values larger than \( \pm 1 \) with a fraction are truncated to a whole number.

To make sure that truncation towards zero always works, we just need a more elaborate expression (10A+ᴱ11)×.1-ᴱ10 to trick the internal BCD calculation logic to discard a remaining fractional digit. That works for any value A. For non-negative A, the simpler expression A+1+ᴱ10-1-ᴱ10 suffices (obviously, since we simply avoid .1 to .9).

So I made a minor update to the EL-5100 "hacks" post to replace truncation and related functions with the simpler A+1+ᴱ10-1-ᴱ10 expression, since the example AER programs assume non-negative inputs.

Here is another new AER program example that uses this trick:

Base conversion
Code:
1;A STO C ÷B+1+ᴱ10-1-ᴱ10 STO A C-AB

Store a positive value in A to convert and positive non-zero base in B
Press COMP to display the least significant digit
Press COMP to display the next digit and so on until the most significant digit is displayed (and A is zero)

Example to display 5042 in hex:
5042 STO A
16 STO B
COMP
1;ANS= 2.
COMP
1;ANS= 11.
COMP
1;ANS= 3.
COMP
1;ANS= 1.

Hence, 5042 in hex is 13B2

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Sharp EL-5100 Instruction Manual - PDF, full text searchable - robve - 05-18-2022 02:53 AM



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