Linear time baseconversion
jonas.thornvall at gmail.com
jonas.thornvall at gmail.com
Tue Jun 30 04:52:08 EDT 2015
Den tisdag 30 juni 2015 kl. 02:09:17 UTC+2 skrev Ben Bacarisse:
> Ian Kelly <ian.g.kelly at gmail.com> writes:
>
> > On Mon, Jun 29, 2015 at 4:56 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> >> On Mon, Jun 29, 2015 at 4:39 PM, <jonas.thornvall at gmail.com> wrote:
> >>> http://jt.node365.se/baseconversion8.html
> <snip>
> > By the way, I think you have a bug. I did my time testing by
> > concatenating the default input number to itself several times. At
> > 5184 decimal digits, which was the last case I tried, the 58th output
> > digit was 1111111, after which point the remaining 672 output digits
> > are all 12665464, which seemed rather improbable.
>
> Yes, it's a bug. Because it's off-topic, I won't say more here but I
> posted a simpler test case to comp.lang.javacript just now (10000000
> converted to base 100). I would not normally reply here, but I wanted
> to acknowledge your post as prompting me to look for other cases.
> Followup-to: set.
>
> --
> Ben.
Thank you, for finding the bug Ben, it turned out i did basicly same thing two times. One of the times was the more general case and that turned out to do the correct thing.
jt.node365.se/baseconversion9.html
It still bug out on very big numbers if base outside integer scope.
I am very keen on suggestions regarding the logic to make it faster.
I will read in base into an array holding bignumb, and then it should work for anybase and any number as far i can understand.
More information about the Python-list
mailing list