[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Help with bigbnum

Todd

5/5/2007 3:34:00 PM


--- Todd Benson <toddkennethbenson@yahoo.com> wrote:

>
> --- Victor Reyes <victor.reyes@gmail.com> wrote:
>
> > Todd, thank you for the example. I truly
> appreciate
> > it. I'll give it a try.
>
> Don't get too excited. On my system (2.4GHz Intel),
> it looks like it would take about 2.5 hours to
> compute

# The next 3 lines compute 2**32582656 in less than a
minute on my system:


a = 2 ** (2**10 * 9)
b = 1
3541.times { b*=a }
# a**3541, which equals 2**32582656, will fail to
# execute in ruby, but the 3541.times works


# this next line, however,

s = b.to_s

# takes a _very_ long time
# similar (but much longer, I think) to Python's
# rendering of b into a string.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail...