Post Reply 
(50g) USER key ": division" a) decimal into (pi) fractions b) no limits
05-13-2021, 06:29 PM
Post: #21
RE: (50g) USER key ": division" a) decimal into (pi) fractions b) no limits
New version 4.2
For the 65.3 assigned key.

\<< "Version 4.2

1 single Arg like
\[]'7/3*'
\[] or {'7/3*' 300}
for 300 digits
" DROP DUP TYPE 5 ==
IF
THEN OBJ\-> DROP
ELSE 100 "Put above 200 if
you want by default
200 digits & not 100" DROP
END SWAP DUP UNROT 0 0 0 RCLF \-> digit 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 digit ^ * PROPFRAC PROPFRAC -105 SF DUP TYPE 9 ==
IF
THEN OBJ\-> 3 DROPN
END
ELSE DROP
END f STOF
\>>
\>>
65.3 ASN

You can chose how many digits have to be shown when executing '73-6/82*4/3' ROOT2.

Instead of writing the above, give as argument
{'73-6/82*4/3' 400} ROOT2 if you want 400 digits.

Regards,
Gil


Attached File(s)
.doc  ROOT2.V4.2.DOC (Size: 837 bytes / Downloads: 1)
Find all posts by this user
Quote this message in a reply
05-13-2021, 06:39 PM
Post: #22
RE: (50g) USER key ": division" a) decimal into (pi) fractions b) no limits
The file document included in my previous post is correct, but of course not its name — that should be called 'fraction_digit' or something similar.

Regards,
Gil
Find all posts by this user
Quote this message in a reply
05-13-2021, 07:05 PM
Post: #23
RE: (50g) USER key ": division" a) decimal into (pi) fractions b) no limits
The file document included in my previous post is correct, but of course not its name — that should be called 'fraction_digit' or something similar.

Regards,
Gil
Find all posts by this user
Quote this message in a reply
05-13-2021, 07:17 PM (This post was last modified: 01-12-2023 02:05 PM by Gil.)
Post: #24
RE: (50g) USER key ": division" a) decimal into (pi) fractions b) no limits
Version 5
for 65.3 key assignment.

Sorry, I was somewhat in a hurry :

The approximate mode, when scivsted, gives an error.

I corrected (in bold) the previous version.

Do the following, please:
1) 65.3 DELKEYS
2) Put the program
\<< "Version 5

1 single Arg like
\[]'7/3*'
\[] or {'7/3*' 300}
for 300 digits
" DROP DUP TYPE 5 ==
IF
THEN OBJ\-> DROP
ELSE 100 "Put above 200 if
you want by default
200 digits & not 100" DROP
END SWAP DUP UNROT 0 0 0 RCLF \-> digit x1 x2 x21 num f
\<< RAD STD -3 CF -105 CF digit \->STR "." "" SREPL DROP OBJ\-> 'digit' STO 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 digit ^ * PROPFRAC PROPFRAC -105 SF DUP TYPE 9 ==
IF
THEN OBJ\-> 3 DROPN
END
ELSE DROP
END f STOF
\>>
\>>

in the stack.
3) Then write
65.3 ASN

Thanks and enjoy!

Gil


Attached File(s)
.hp  DIGITS. MANY.5.2.hp (Size: 885 bytes / Downloads: 1)
Find all posts by this user
Quote this message in a reply
01-12-2023, 02:07 PM
Post: #25
RE: (50g) USER key ": division" a) decimal into (pi) fractions b) no limits
DIGITS.MANY.5.2.hp

with .hp ending.


Attached File(s)
.hp  DIGITS. MANY.5.2.hp (Size: 885 bytes / Downloads: 1)
Find all posts by this user
Quote this message in a reply
Post Reply 




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