Post Reply 
(50g) USER key ": division" a) decimal into (pi) fractions b) no limits
01-26-2021, 08:58 PM
Post: #19
RE: HP50G USER key ": division" a) decimal into (pi) fractions b) no limits
HP49-50G
Two assignment user keys
New slight change in both of them.
In bold below, right at the beginning.

1st assignment key 65.1
Decimals to fraction:
\<< RCLF \-> x f
\<< -3 CF RAD x TYPE 9 \=/
IF
THEN x DUP DUP ABS 1 <
IF
THEN \->Q
ELSE \->Q DUP PROPFRAC
END
ELSE x DUP PROPFRAC DUP2 SAME DROPN
END \->STR "+-" "-" SREPL DROP OBJ\-> f STOF
\>>
\>>
65.1 ASN
Example .8 returns '4/5'


1st assignment key 65.3
Fraction to fractions & decimals
\<< DUP 0 0 0 RCLF \-> x1 x2 x21 num f
\<< RAD -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
Example
'77/13+99/31' will return the 4 lines/stacks:
'77/13+99/31' (stack level 4)
'3674/403' (stack level 3)
9.11663 (stack level 2)
91166253101736972704714640198511166253101736972704714640198511166253101736972704​714640198511166253101 (stack level 1).

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-26-2021 08:58 PM



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