Post Reply 
HP49-50G Square root many (50 or more) digits
04-27-2021, 05:30 PM
Post: #2
RE: HP49-50G Square root many (50 or more) digits
Version 2

You can keep the version 1.

For 50 digits, this new version instead going to a loop =
"51-1" and k<51,

has its loop that goes, more logically, directly up to the required digit 50 (not 51-1) and k<= 50 (not k<51).

The new code and in bold the changes
\<< "\[] 1 Arg

\[] Put below 100 if
you want 100 digits
" DROP 50 \-> digit
\<< -105 CF DUP "\v/" SWAP + SWAP DUP \v/ SWAP DUP \->STR SWAP FP \-> nb f
\<<
IF f 0 \=/
THEN nb "." POS 1 - \-> pos
\<< nb "." "" SREPL DROP DUP SIZE \-> nb1 sz1
\<< pos 2 / FP 0 ==
IF
THEN sz1 2 / FP 0 \=/
IF
THEN nb1 0 + 'nb1' STO
END
ELSE sz1 2 / FP 0 ==
IF
THEN nb1 0 + 'nb1' STO
END
END nb1
\>>
\>>
ELSE nb "." "" SREPL DROP
END
\>> DUP SIZE 2 / FP 0 == "" 0 IFTE SWAP + DUP SIZE 2 / \-> n sz
\<< { } 0 sz 1 -
FOR i n i 2 * 1 + DUP 1 + SUB OBJ\-> +
NEXT 'n' STO 0 0 0 0 1 \-> a b m s k
\<<
WHILE k digit \<=
REPEAT a b - 100 * 'a' STO k sz \<=
IF
THEN n k GET 'a' STO+
END 1 'k' STO+ 9 's' STO
WHILE 20 m * s + s * a >
REPEAT -1 's' STO+
END 20 m * s + s * 'b' STO 10 m * s + 'm' STO
END m \->STR \-> st
\<< st 2 50
FOR i st i digit SUB OBJ\-> 0 ==
IF
THEN 1 i 1 - SUB digit 'i' STO
END
NEXT OBJ\-> DUP2 ==
IF
THEN SWAP DROP
END
\>>
\>>
\>>
\>>
\>>

Then for assigning to sqrt-key write :
52.3 ASN ENTER.

Regards,
Gil


Attached File(s)
.doc  ROOT2.V2.DOC (Size: 1.04 KB / Downloads: 1)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP49-50G Square root many (50 or more) digits - Gil - 04-27-2021 05:30 PM



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