[VA] SRC#002- Almost integers and other beasties
|
02-10-2019, 04:06 PM
(This post was last modified: 02-10-2019 04:14 PM by Gerson W. Barbosa.)
Post: #28
|
|||
|
|||
RE: [VA] SRC#002- Almost integers and other beasties
(02-10-2019 03:26 PM)Albert Chan Wrote:(02-10-2019 12:48 PM)Gerson W. Barbosa Wrote: Number of iterations = Ceil(W(10^n*ln(2))/ln(2)), where n = number of digits and W(x) is the Lambert W function. Starting with log₁₀(k.2ᵏ) = n, I solved k.2ᵏ = 10ⁿ for k. Well, actually W|A did :-) k = W(10ⁿ.ln(2))/ln(2) BTW, it's better to replace ALOG 2 LN * LN with 10 LN * 2 LN LN + just in case you want to evaluate it to one thousand digits or more: 1000 \<< RCLF SWAP -105 CF -3 CF DUP 'DIGITS' STO 10 LN * 2 LN LN + DUP LN - LASTARG SWAP / + 2 LN / CEIL 0 1 ROT FOR k 1 FNEG k FY\|^X k FDIV 2 k FY\|^X 1 FSUB FDIV FADD NEXT DUP FADD 2 FLN FDIV 12 FINV FADD FPI FSQ 6 FDIV 2 FLN FSQ FDIV FADD ZZ\<-\->F NEG SWAP \->STR DUP SIZE ROT \=/ -51 FC? { "." } { "," } IFTE UNROT { DUP TAIL SWAP HEAD } { "0" } IFTE UNROT + + SWAP STOF \>> EVAL -> 1.000000000001237412575736110228719610646672874297732048196548443844171825640530428850913885586193524976268453340086191658374509030019046729786005370140207590865397221066886209167246612158255597136947833662811711180501522046958297318386956749813586119403326983996836799698362386464361717810944715248515847063950123049027855289479337807074973722174863007602234598952082713436126867407223085711221417206013336683950248036912034243322848607544096465559742710057944068020597818546946376873631661338090760132715563114425400886965240835824220034845681146540332945848091156055661073808986770237768671181359710868112079802546002171398844199048674600407150411381977070159608769770037395721001869135492839448159377839257477067778776337799415286212226231921875049198549974749265675547171167195366657491492695699893916926664962342406045357897998136027548661020448361327035579555228205809418530092189232789163297481121766653027554098532310918458342580878445369891507372744436069036208883146409368525831685839774710 (363.97 seconds on the emulator) # B529h, 363 bytes |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)