Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Calculate/Interpolate size of y in x^y = z when you do know "number of digits z" and base x? Date: Mon, 11 May 2015 13:56:21 +0100 Organization: A noiseless patient Spider Lines: 26 Message-ID: <87oalr8e8a.fsf@bsb.me.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="16834"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/P9aNQ8V3OSZy6US8qD+O3eFciwGTRW/s=" Cancel-Lock: sha1:yYqRjuq2CncBS5oC6/S8HEiAvWw= sha1:Zvvt4EAHhRQHoMPKV2R3swgDlI0= X-BSB-Auth: 1.03bebd65050167838c3d.20150511135621BST.87oalr8e8a.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27587 jonas.thornvall@gmail.com writes: > Den måndag 11 maj 2015 kl. 13:28:06 UTC+2 skrev jonas.t...@gmail.com: >> Den måndag 11 maj 2015 kl. 13:22:30 UTC+2 skrev jonas.t...@gmail.com: >> > If i have a very bignumber z in decimal, i know the number of >> > digits let us say 100 digits and base is x=64. >> > >> > How can i interpolate, find a closeby y (where base is x). >> > I do understand that i can add 1 to y until i reach the neighbourhood. >> > >> > But is there any general rule to use to close in faster when you >> > do know x and the number of digits in z? >> >> Sorry i was not clear i look for the closest integer of y bigger or smaller. > > But maybe assuming y is large like 1000 doing a search closing in by > setting min and max is faster, than doing the calculation using > logaritms? It depends on how y is represented. You say it is "in decimal". If that means it's a string then you just find the . and remove any trailing digits. This is so obvious that it can't be whay you mean. How is z stored in the program? -- Ben.