#41 Faster large integer->string conversion?

open
nobody
general (11)
5
2010-01-14
2010-01-14
Steve Wampler
No

I'm not sure if anything can be done, but the conversion from large integer to string
takes inordinately look. For example, I just computef fib(1000000) in 36 cpu seconds,
but the conversion of the ~209000 digit result to a string for output took well over
5 cpu *minutes*. Is that really necessary?

Discussion

  • I would welcome contributions from anyone who wishes to tune this operation.

     
  • Charles Evans
    Charles Evans
    2012-07-17

    libgmp10 would probably help if used for all largeints, especially on 32bit iconx?,
    but AFAIK exact conversion to decimal is extremely slow.
    I suggest a function that produces n correct digits then lots of 0's.
    I'm not sure how...