HP Forums

Full Version: (50g) USER key ": division" a) decimal into (pi) fractions b) no limits
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
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
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
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
DIGITS.MANY.5.2.hp

with .hp ending.
Pages: 1 2
Reference URL's