develooper Front page | perl.perl6.users | Postings from March 2019

A FatRat.base issue

From:
Aaron Sherman
Date:
March 22, 2019 00:17
Subject:
A FatRat.base issue
Message ID:
CAN=dS7T975cx0R6vsytRBT+Cy5x3=JwtXsDh2xKDNXGupcMwBg@mail.gmail.com
Here's four commands using my Math::Sequence module (note that the
difference between the first and second command is just 1 digit of pi
precision and the 3rd and 4th are just the 1st and 2nd but with a base
conversion):

$ time PERL6LIB=lib perl6 -MMath::Sequences::Integer -e 'put
FatPi(309).perl'
FatRat.new(3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587,
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)

real    0m0.350s
user    0m0.359s
sys     0m0.156s
$ time PERL6LIB=lib perl6 -MMath::Sequences::Integer -e 'put
FatPi(310).perl'
FatRat.new(1570796326794896619231321691639751442098584699687552910487472296153908203143104499314017412671058533991074043256641153323546922304775291115862679704064240558725142051350969260552779822311474477465190982214405487832966723064237824116893391582635600954572824283461730174305227163324106696803630124570636862293503,
500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)

real    0m0.354s
user    0m0.297s
sys     0m0.203s
$ time PERL6LIB=lib perl6 -MMath::Sequences::Integer -e 'put
FatPi(309).base(2)'
11.0010010000111111011010101000100010000101101000110000100011010011000100110001100110001010001011100000001101110000011100110100010010100100000010010011100000100010001010011001111100110001110100000000100000101110111110101001100011101100010011100110110010001001010001010010100000100001111001100011100011010000000100110111011110111110010101000110011011001111001101001110100100001100011011001100000010101100001010011011011111001001011111000101000011011101001111111000010011010101101101011011010101000111000010010001011110010010000101101101010111011001100010010111100111111011000110111101000100110001000010111010011010011000110111111011010110101100001011111111110101110010110110111101000000011010110111111011011110111000111000011010111111101101011010100010011001111110100101101011101001111100100100000100010111110001001011000111111110011001001001001010000110011001010001111011001110010001011011001111011100001000000000011111001011100010100001011000111011111100000101100110001101101001001000001101100001110001010101110100111010

real    0m0.537s
user    0m0.609s
sys     0m0.094s
$ time PERL6LIB=lib perl6 -MMath::Sequences::Integer -e 'put
FatPi(310).base(2)'
^C

real    0m3.992s
user    0m3.969s
sys     0m0.188s

For some reason that last one will run for a VERY long time (I've not yet
seen it finish, but I admit I've only let it run a minute or so). If you
want to test this without my module:

put
FatRat.new(1570796326794896619231321691639751442098584699687552910487472296153908203143104499314017412671058533991074043256641153323546922304775291115862679704064240558725142051350969260552779822311474477465190982214405487832966723064237824116893391582635600954572824283461730174305227163324106696803630124570636862293503,
500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000).base(2)

--
Aaron Sherman, M.:
P: 617-440-4332 // E: ajs@ajs.com
Toolsmith, developer, gamer and life-long student.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About