Post Reply 
(50g) USER key ": division" a) decimal into (pi) fractions b) no limits
01-28-2021, 06:52 PM
Post: #20
RE: HP50G USER key ": division" a) decimal into (pi) fractions b) no limits
One more improvement in assignment user key 65.3

i.e. the addition of the single STD instruction right at the beginning

for 'fractions' => irreductible fraction & many decimals.

Before that, if you wrote
4 FIX
.218
'7/9'
*
you would get '0.2180*(7/9)'.
And executing just after that
LEFT-SHIFT USER
RIGHT-SHIFT DIVISION-KEY
would give an error.

Thanks to the STD instruction, right at the beginning, the problem is easily solved.

Here the new, full code, in bold the change :

\<< DUP 0 0 0 RCLF \-> x1 x2 x21 num f

\<< RAD STD -3 CF -105 CF x1 \->STR "." "" SREPL 0 ==
IF
THEN DROP
ELSE OBJ\-> 'x2' STO x2 x1 / \->NUM LOG DUP FP 0 \=/
IF
THEN DROP "Instead of decimals (ab.c),

Try fractions
('abc/10') !" DOERR
END \->STR "." "" SREPL DROP OBJ\-> ALOG 'x21' STO
IF x21 1 >
THEN x2 x21 /
ELSE
IF x21 1 <
THEN x2 x21 INV *
ELSE x2
END
END \->STR "." "" SREPL DROP OBJ\->
END DUP EXPAND DUP2 SAME DROPN DUP \->NUM DUP 'num' STO num ABS 100000000000 > num FP 0 \=/ OR
IF
THEN OVER 10 100 ^ * PROPFRAC PROPFRAC -105 SF DUP TYPE 9 ==
IF
THEN OBJ\-> 3 DROPN
END
ELSE DROP
END f STOF
\>>
\>>
65.3 ASN

Regards,
Gil
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP50G USER key ": division" a) decimal into (pi) fractions b) no limits - Gil - 01-28-2021 06:52 PM



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