HP49-50G Square root many (50 or more) digits
|
05-04-2021, 08:19 PM
Post: #4
|
|||
|
|||
RE: HP49-50G Square root many (50 or more) digits
Just corrected the code
for cases of the type sqrt (2E-2). Besides you can now choose how many digits you want to be calculated by using as input: {X xx}, - where X is the number of which you want the square root - and where cx is number of digits to be calculated. By default, the number xx is 50. In that case, you can directly enter as argument: X or "XX" (double quotation mark). The full, new code is: \<< "Version 4 Give 1 Arg \[] 2.5 or 2.5E6 or -2.5 or 2.5-E6 or \[] or" "1234567891234567" "with quotation mark! \[] or {X xx} with X: like above & xx: # digits " 3 DROPN DUP TYPE 5 == IF THEN OBJ\-> DROP ELSE 50 "Put above 100 if you want 100 digits" DROP END \-> digit \<< DUP TYPE 2 \=/ IF THEN \->STR END DUPDUP SIZE SWAP OBJ\-> \-> x0 s0 x1 \<< -3 SF -105 CF "\v/" x0 + x1 \v/ x0 "-" "" SREPL DROP 'x0' STO x0 DUP "E" POS DUP 0 == IF THEN DROP 1 s0 ELSE 1 SWAP 1 - END SUB "." "" SREPL DROP OBJ\-> \->STR DUP SIZE 's0' STO 'x0' STO x1 MANT x1 XPON \-> man xpo \<< s0 2 / FP 0 \=/ IF THEN 0 x0 xpo 2 / FP 0 \=/ { SWAP } IFT + ELSE xpo 2 / FP 0 == IF THEN 0 x0 + 0 + ELSE x0 END END DUPDUP 'x0' STO 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 digit FOR i st i digit SUB OBJ\-> 0 == IF THEN digit i - 1 + " last # of \v/ =0" + 4 ROLLD 1 i 1 - SUB digit 'i' STO END NEXT OBJ\-> DUP2 \-> r1 r2 \<< r1 DUP TYPE 1 == IF THEN IM END MANT \->STR "." "" SREPL DROP DUP "E" POS DUP 0 > IF THEN 1 - 1 SWAP SUB OBJ\-> ELSE DROP OBJ\-> END r2 == IF THEN DROP END \>> \>> \>> \>> \>> \>> \>> \>> |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
HP49-50G Square root many (50 or more) digits - Gil - 04-24-2021, 11:08 PM
RE: HP49-50G Square root many (50 or more) digits - Gil - 04-27-2021, 05:30 PM
RE: HP49-50G Square root many (50 or more) digits - Gil - 05-04-2021, 02:24 PM
RE: HP49-50G Square root many (50 or more) digits - Gil - 05-04-2021 08:19 PM
|
User(s) browsing this thread: 1 Guest(s)