|
(50G) 'Full digit calculation in huge algebraic expression with +-*/^! operators +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (https://www.hpmuseum.org/forum/forum-10.html) +--- Forum: General Software Library (https://www.hpmuseum.org/forum/forum-13.html) +--- Thread: (50G) 'Full digit calculation in huge algebraic expression with +-*/^! operators (/thread-23705.html) |
(50G) 'Full digit calculation in huge algebraic expression with +-*/^! operators - Gil - 2025-06-17 Suppose that you have '25.+2/(3.+73.15)*3^((2+4)/3)' as input. Then the program will give as outputs, with last line showing the complete mantissa (the full digits): num1: 25.2363755745 '25/1+2/(3/1+7315/100)*3^((2+4)/3)' '38435/1523' '25+360/1523' ~:25.2363755745 2523637557452396585686145764937623112278397898883782009192383453709783322390019697964543663821405121470781352593565331582403151674326986211424819435325016414970453053184504267892317793827971109652002626 The operators allowed are + - * /. ^x also will provide correct results/digits provided that x is an integer (>=0 or <0). In version 7, x ! is also allowed, x beeing integer/real >=0, with fraction part of x =0 No way of using the SIN, LN, EXP, etc. functions. RE: (50G) 'Full digit calculation for huge alg. expression with +-*/^! - Gil - 2025-06-23 This new version does more checks of the intermediary results. Approximations are indicated by ~. Besides the correct approximation and the "full size" digits result, incorrect results when applying ->NUM to the initial algebraic expression, is equally indicated here by by ?. Together with the mixing of + - * / operations with parenthèses in the algebraic expression, this version accepts now factorials x! and powers x^y, x & y being integers or real with FP(x) = F(y) =0. Example 1 your :Input: '1.475E35*((17/9)^2.+7.9)*(31./7.)*1.E-32' :num: 74909.9691358 '1475/1000*100000000000000000000000000000000000*((17/9)^(2/1)+79/10)*(31/1/(7/1))*(1/1/100000000000000000000000000000000)' '12135415/162' '74909+157/162' :~: 74909.9691358 74909969135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135 Example 2 :Input: '1.475E35*((17/9)^2.+7.9)*(31./7.)*1.E-32*(2.8+.2)!' :num: 449459.814815 '1475/1000*100000000000000000000000000000000000*((17/9)^(2/1)+79/10)*(31/1/(7/1))*(1/1/100000000000000000000000000000000)*(28/10+2/10)!' '12135415/27' '449459+22/27' :~: 449459.814815 4494598148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148 Example 3 { :Input: '1.475E35*((17/9)^2.+7.9)*(31./7.)*1.E-32*10.^600' :num?: 9.99999999999E499 '1475/1000*100000000000000000000000000000000000*((17/9)^(2/1)+79/10)*(31/1/(7/1))*(1/1/100000000000000000000000000000000)*(10/1)^600' '6067707500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000/81' '74909969135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135+65/81' :~: "7.49099691358E604" 74909969135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469135802469 "Check num. values" Thanks in advance for eventual testing and indicating me errors/bugs or wished improvements. Regards RE: (50G) 'Full digit calculation in huge algebraic expression with +-*/^! operators - Gil - 2025-06-24 New Version 4 with slight changes. Other example Suppose you want to have many digits of the number e. You know that e = 1/0! + 1/1! +1/2! + 1/3!+ Enter, first, the corresponding expression by the following program: \<< 0 0 ROT FOR i i ! INV + NEXT \>> 'PG.e' STO Then enter 100 &press PG.e To get '2+1/2+1/6+1/24+1/120+1/720+1/5040+1/40320+1/362880+1/3628800+1/39916800+1/479001600+1/6227020800+1/87178291200+1/1307674368000+1/20922789888000+1/355687428096000+1/6402373705728000+1/121645100408832000+1/2432902008176640000+1/51090942171709440000+1/1124000727777607680000+1/25852016738884976640000+1/620448401733239439360000+1/15511210043330985984000000+1/403291461126605635584000000+1/10888869450418352160768000000+1/304888344611713860501504000000+1/8841761993739701954543616000000+1/265252859812191058636308480000000+1/8222838654177922817725562880000000+1/263130836933693530167218012160000000+1/8683317618811886495518194401280000000+1/295232799039604140847618609643520000000+1/10333147966386144929666651337523200000000+1/371993326789901217467999448150835200000000+1/13763753091226345046315979581580902400000000+1/523022617466601111760007224100074291200000000+1/20397882081197443358640281739902897356800000000+1/815915283247897734345611269596115894272000000000+1/33452526613163807108170062053440751665152000000000+1/1405006117752879898543142606244511569936384000000000+1/60415263063373835637355132068513997507264512000000000+1/2658271574788448768043625811014615890319638528000000000+1/119622220865480194561963161495657715064383733760000000000+1/5502622159812088949850305428800254892961651752960000000000+1/258623241511168180642964355153611979969197632389120000000000+1/12413915592536072670862289047373375038521486354677760000000000+1/608281864034267560872252163321295376887552831379210240000000000+1/30414093201713378043612608166064768844377641568960512000000000000' : Then press directly manyDigits program to get: Input: '2+1/2+1/6+1/24+1/120+1/720+1/5040+1/40320+1/362880+1/3628800+1/39916800+1/479001600+1/6227020800+1/87178291200+1/1307674368000+1/20922789888000+1/355687428096000+1/6402373705728000+1/121645100408832000+1/2432902008176640000+1/51090942171709440000+1/1124000727777607680000+1/25852016738884976640000+1/620448401733239439360000+1/15511210043330985984000000+1/403291461126605635584000000+1/10888869450418352160768000000+1/304888344611713860501504000000+1/8841761993739701954543616000000+1/265252859812191058636308480000000+1/8222838654177922817725562880000000+1/263130836933693530167218012160000000+1/8683317618811886495518194401280000000+1/295232799039604140847618609643520000000+1/10333147966386144929666651337523200000000+1/371993326789901217467999448150835200000000+1/13763753091226345046315979581580902400000000+1/523022617466601111760007224100074291200000000+1/20397882081197443358640281739902897356800000000+1/815915283247897734345611269596115894272000000000+1/33452526613163807108170062053440751665152000000000+1/1405006117752879898543142606244511569936384000000000+1/60415263063373835637355132068513997507264512000000000+1/2658271574788448768043625811014615890319638528000000000+1/119622220865480194561963161495657715064383733760000000000+1/5502622159812088949850305428800254892961651752960000000000+1/258623241511168180642964355153611979969197632389120000000000+1/12413915592536072670862289047373375038521486354677760000000000+1/608281864034267560872252163321295376887552831379210240000000000+1/30414093201713378043612608166064768844377641568960512000000000000' :num: 2.71828182846 '2+1/2+1/6+1/24+1/120+1/720+1/5040+1/40320+1/362880+1/3628800+1/39916800+1/479001600+1/6227020800+1/87178291200+1/1307674368000+1/20922789888000+1/355687428096000+1/6402373705728000+1/121645100408832000+1/2432902008176640000+1/51090942171709440000+1/1124000727777607680000+1/25852016738884976640000+1/620448401733239439360000+1/15511210043330985984000000+1/403291461126605635584000000+1/10888869450418352160768000000+1/304888344611713860501504000000+1/8841761993739701954543616000000+1/265252859812191058636308480000000+1/8222838654177922817725562880000000+1/263130836933693530167218012160000000+1/8683317618811886495518194401280000000+1/295232799039604140847618609643520000000+1/10333147966386144929666651337523200000000+1/371993326789901217467999448150835200000000+1/13763753091226345046315979581580902400000000+1/523022617466601111760007224100074291200000000+1/20397882081197443358640281739902897356800000000+1/815915283247897734345611269596115894272000000000+1/33452526613163807108170062053440751665152000000000+1/1405006117752879898543142606244511569936384000000000+1/60415263063373835637355132068513997507264512000000000+1/2658271574788448768043625811014615890319638528000000000+1/119622220865480194561963161495657715064383733760000000000+1/5502622159812088949850305428800254892961651752960000000000+1/258623241511168180642964355153611979969197632389120000000000+1/12413915592536072670862289047373375038521486354677760000000000+1/608281864034267560872252163321295376887552831379210240000000000+1/30414093201713378043612608166064768844377641568960512000000000000' '2666905705783137373306341322880702364612402788688346977445977371 / 981099780700431549793955102131121575625085211901952000000000000' '2+704706144382274273718431118618459213362232364884442977445977371/981099780700431549793955102131121575625085211901952000000000000' :~: 2.71828182846 271828182845904523536028747135266249775724709369995957496696762772341929805354853872283511766064504308549791388095014223536288443731116412678523219063776004717953244401845835640128760504015488891037251 RE: (50G) 'Full digit calculation in huge algebraic expression with +-*/^! operators - Gil - 2025-06-26 New version 7 RE: (50G) 'Full digit calculation in huge algebraic expression with +-*/^! operators - carey - 2025-06-26 Is there a reason this RPL code is one large program and not a series of short functions/commands? This is a sincere question and not a criticism (I believe in "to each there own"), but if I was new to RPL and didn't already know that RPL code can (usually) be written as an elegant collection of short functions, seeing this would make me run from RPL. RE: (50G) 'Full digit calculation in huge algebraic expression with +-*/^! operators - Gil - 2025-06-26 Yes, to Carey's good question, and the reason is quite simple : This program manyD (many Digits) is assigned to a shortcut user key — to be used directly in whichever directory I am in. « PATH —> p « HOME HOME1 TOOLS manyD p EVAL » » 65.3 ASN [65.3: 6=6th line of the calculator keys; 5=5th column;. 3=red/right; then 65.3 corresponds to left-shift ALPHA and :key.] And for me it's easier to have one shortcut user key associated to one single program, with no small short programs (subroutines), above all when moving files: here my whole program is just simply located, as shown above, in {HOME HOME1 TOOLS}. By the way, all my variables or programs are never saved directly in HOME, but in {HOME HOME1} or {HOME HOME1 DIR.X }. Then, regularly I copy the entire HOME1 directory to my telephone. But for reading or understanding, sometimes with repeated instructions here, I recognise that my program is not elegant at all. However, the purpose of it is of course not to serve as an example. It is just useful for my :a/digits and works very smoothly, sometimes enabling huge calculations in one step that WolframAlpha does not permit. Try this program Sqrt — that uses internally the program manyD — to calculate many digits of the square root of any integer or real number: \<< "1 Arg: real/integer EX 81 to find its \v/ X By default: 200-3 digits. More ? change manyD" DROP DUP \v/ \->NUM \-> A X \<< "(X+A/X)/2" 1 5 START "X" "((X+A/X)/2)" SREPL DROP NEXT "X" X \->STR SREPL DROP "A" A \->STR SREPL DROP "'" + "'" SWAP + OBJ\-> PATH \-> p \<< HOME HOME1 TOOLS manyD p EVAL \>> \>> \>> Put 85 and launch it. The result will be: :Input: '((((((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2+85/(((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2))/2+85/((((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2+85/(((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2))/2))/2+85/(((((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2+85/(((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2))/2+85/((((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2+85/(((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2))/2))/2))/2+85/((((((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2+85/(((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2))/2+85/((((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2+85/(((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2))/2))/2+85/(((((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2+85/(((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2))/2+85/((((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2+85/(((9.21954445729+85/9.21954445729)/2+85/((9.21954445729+85/9.21954445729)/2))/2))/2))/2))/2))/2' :num: 9.2195444573 '((((((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2+85/(((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2))/2+85/((((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2+85/(((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2))/2))/2+85/(((((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2+85/(((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2))/2+85/((((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2+85/(((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2))/2))/2))/2+85/((((((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2+85/(((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2))/2+85/((((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2+85/(((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2))/2))/2+85/(((((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2+85/(((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2))/2+85/((((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2+85/(((921954445729/100000000000+85/(921954445729/100000000000))/2+85/((921954445729/100000000000+85/(921954445729/100000000000))/2))/2))/2))/2))/2))/2' '50850514296067459035800126313145222642728725573809060537637157807246084065486955422761846379115167774173580893322567892265082480389363826223066456162967824796268620683204439596331109911543180351691706666396736985543114453376835942884620348941754957616967573308752426580453608788736841112342295130137993226288240630671733573543786330744786138954048703122639199032408104167823695077130871991365534429478275180785856108527626646239255667970559614022013257550656309963998622642444009046568663054258332708929385268181719496872706799904030852684050133565260476004402532785828683120909305943792682841895844050410380127948191817127745588732082272678482283468370456204444688903850651452403469863842429372600250775767636078129619461345345434516302633837053952210777196309443691814031768691271681/5515512673280017284658741284271538532819321495132075274786497243077149469031716490332802409441441162672059091386400593994138544355069124585279859380467093234592744011501784433830212397838704551343517268137336115408049485832837069589629022618554132133995359141605103179877336217255766348794210132006061057337332346741680663967613929337748681420748573612378221271361470753508052963554794355325493620613843286082173527385298218194270502041115406258958630860815063285433921795400861265847109494167685550614174491572913593258734732955697870486924545164751345099296668155328807474077804176005286013670669771073328923344368346567246230512745286242772764672678796502663655351083338335157499782542801747898203205918061710632730413640769750228227709904251256573395356566488936091449600000000000' '9+1210900236547303473871454754701375847354832117620383064558682619551738844201507009766624694142197310125049070844962546317835581193741704955547721738763985684933924579688379691859198330994839389600051253160711946870669080881302316577959145374767768411009341034306497961557582833434943973194403942083443710252249509996607597835260966705048006167311540611235207590154867386251218405137722793436091843953685606046294362059942682490821149600520957691385579803320740395093326483836257653944677606749162753401814844025497157544094203302750018301729227082498370110732519387869415854209068359745108718859816110750419817848876698022529514117374696493527401414261287680471790744100606435985971820957213641516421922505080682435045738578417682462253244698792643050218987211043266990985368691271681/5515512673280017284658741284271538532819321495132075274786497243077149469031716490332802409441441162672059091386400593994138544355069124585279859380467093234592744011501784433830212397838704551343517268137336115408049485832837069589629022618554132133995359141605103179877336217255766348794210132006061057337332346741680663967613929337748681420748573612378221271361470753508052963554794355325493620613843286082173527385298218194270502041115406258958630860815063285433921795400861265847109494167685550614174491572913593258734732955697870486924545164751345099296668155328807474077804176005286013670669771073328923344368346567246230512745286242772764672678796502663655351083338335157499782542801747898203205918061710632730413640769750228227709904251256573395356566488936091449600000000000' :~: 9.21954445729 92195444572928873100022742817627931572468050487224640080077522054426710268018754607678940907932805649403398088788716841521246633465171722339398057111487771732015843132779951574309724454413579467764257589061769043075079601450117904442268436315414795139 With the corresponding full digit in the last stack. RE: (50G) 'Full digit calculation in huge algebraic expression with +-*/^! operators - Gil - 2025-07-09 New Version 8 Code \<< "1 Arg Version8 \|>ex '7+3.!*(2*10.^600. )/(4-3.27E-15)*4.^-7.' or '73179/17^2/13' or .275 or 3.275 \|>mix 4 operat. + - * / & any real/integ/frac \|>& x^y: x real/integer/fract y integer or FP(y)=0 \-> '(2./3.)^3.' : ok '(2./3.)^-3.': ok '3^(1/2)': not ok \|>& x!: x\>=0 & x integer or FP(x)=0 \|>xE-499xE0 xE499 OK: |xEy| <1E500, x real, -499\<=y_integer\<=499 \|>for |#| \>= 1E500, say 2E600, write (2.*10.^600.) or (2*10^600) always with () \|> If intermed.|result| \<=1E-500 \->impossible: 7 * (2^600) \-> ok 7 / (2^600) \-> error 1.E-450*1.E-99\-> err \|>in '': no var-name & no \v/ SIN LN EXP etc. \|>local var n (min di- gits) by default=360. 6 lines below, you can change it. " DROP STD RAD -3 CF -20 SF -21 CF -105 CF DTAG DUP DUP TYPE 0 0 0 0 0 0 { } { "E-" "E" } 360 "default: 360" DROP \-> x num t ls ds p p1 p2 o lx lE n \<< \<< DUP2 \->STR SWAP DTAG \->STR "E" POS 1 - OVER SIZE DUP2 "" UNROT START "0" + NEXT 4 ROLLD SUB \=/ IF THEN SWAP DTAG "~" \->TAG SWAP END DEPTH DUP 'ds' STO \->LIST REVLIST 'ls' STO 2 ds FOR i ls i GET DUP TYPE 12 == IF THEN OBJ\-> "num" == IF THEN "\->wrong!" \->TAG i SWAP ls UNROT PUT ds 'i' STO ELSE DROP END ELSE DROP END NEXT REVLIST OBJ\-> DROP \>> \-> msg \<< x "Input" \->TAG t 0 \=/ t 28 \=/ AND IF THEN DUP IFERR \->NUM THEN "Try, instead input 'a', '1/(a)'. Res='1/Res'" DOERR END DUP DUP XPON ABS R\->I 'n' STO+ 'num' STO "num" \->TAG END x \->STR ".!" "!" SREPL DROP "'" "" SREPL DROP 'x' STO 1 2 FOR i WHILE x lE i GET POS DUP 'p' STO 0 \=/ REPEAT 0 'p1' STO 0 'p2' STO p 1 - 1 FOR i x i i SUB 'o' STO IF o "+" SAME o "-" SAME OR o "*" SAME OR o "/" SAME OR o "^" SAME OR o "(" SAME OR THEN i 'p1' STO 0 'i' STO END -1 STEP x 1 p1 SUB "(" + x p1 1 + p 1 - SUB + i 1 == "/" "*" IFTE + p i NEG 4 + + x SIZE FOR i x i i SUB 'o' STO IF o "+" SAME o "-" SAME OR o "*" SAME OR o "/" SAME OR o "^" SAME OR o ")" SAME OR THEN i 'p2' STO 0 'i' STO END NEXT p2 0 == IF THEN x SIZE 1 + 'p2' STO END x p i NEG 3 + + p2 1 - SUB OBJ\-> ALOG + ")" + x p2 x SIZE SUB + 'x' STO END NEXT WHILE x "." POS DUP 'p' STO 0 \=/ REPEAT 0 'p1' STO 0 'p2' STO 0 'o' STO p 1 - 1 FOR i x i i SUB 'o' STO IF o "+" SAME o "-" SAME OR o "*" SAME OR o "/" SAME OR o "^" SAME OR o "(" SAME OR THEN i 'p1' STO 0 'i' STO END -1 STEP IF p1 0 \=/ THEN x 1 p1 SUB 'lx' STO+ END "(" x p1 1 + p 1 - SUB + 'lx' STO+ p 1 + x SIZE FOR i x i i SUB 'o' STO IF o "+" SAME o "-" SAME OR o "*" SAME OR o "/" SAME OR o "^" SAME OR o ")" SAME OR THEN i 'p2' STO 0 'i' STO END NEXT IF p2 0 \=/ THEN x p 1 + p2 1 - SUB "/" + p2 p - 1 - ALOG R\->I + ")" + 'lx' STO+ x p2 DUP SUB 'lx' STO+ x p2 1 + x SIZE SUB 'x' STO ELSE x p 1 + x SIZE SUB "/" + x SIZE p - ALOG R\->I + ")" + 'lx' STO+ "" 'x' STO END END x 'lx' STO+ lx DUP SIZE 0 \=/ IF THEN REVLIST 'lx' STO "" 1 lx SIZE FOR i lx i GET + NEXT "'" + "'" SWAP + OBJ\-> DUP2 SAME { DROP } IFT DUP EVAL DUP2 SAME { DROP } IFT EVAL DUP TYPE 9 == IF THEN DUP OBJ\-> DROP2 ABS SWAP ABS < IF THEN DUP PROPFRAC END t 0 \=/ IF THEN DUP n ALOG R\->I * PROPFRAC PROPFRAC DUP TYPE 9 == IF THEN OBJ\-> 3 DROPN END DUP \->STR DUP DUP SIZE DUP n 1 + - R\->I ROT 1 1 SUB "." + 4 ROLL 4 ROLL 2 SWAP SUB + OBJ\-> "E" + OVER + SWAP ABS 500 < IF THEN OBJ\-> END SWAP DUP2 \->STR SWAP DUP TYPE 2 \=/ { \->STR } IFT DUP "E" POS DUP 0 \=/ IF THEN 1 - 1 SWAP SUB ELSE DROP END "." "" SREPL DROP SIZE 1 + OVER SIZE DUP2 "" UNROT START "0" + NEXT 4 ROLLD SUB SAME NOT IF THEN SWAP "~" \->TAG SWAP END OVER DUP DTAG TYPE 2 \=/ IF THEN num - PICK3 / ABS .0000000001 > IF THEN msg EVAL END ELSE DROP msg EVAL END END ELSE DUP DUP \->STR DUP DUP 1 1 SUB "." + UNROT SIZE DUP 4 ROLLD 2 SWAP SUB + OBJ\-> SWAP 1 - R\->I DUP UNROT "E" SWAP + + SWAP ABS 499 \<= { OBJ\-> } IFT SWAP OVER DUP DTAG TYPE 2 \=/ IF THEN num - PICK3 / ABS .0000000001 > IF THEN msg EVAL END ELSE TYPE 2 == IF THEN msg EVAL ELSE DUP ABS LOG num ABS LOG -105 SF \=/ { msg EVAL } IFT END END END END \>> \>> \>> |