On Thu, Mar 21, 2019 at 5:17 PM Aaron Sherman <a...@ajs.com> wrote:
>
> 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: a...@ajs.com
> Toolsmith, developer, gamer and life-long student.

Hi Aaron, Replicating with Rakudo version 2020.06, I don't see the problem
with your fourth command. All four of the commands that use your
Math::Sequences::Integer module take about 1 sec real / 0.08-0.09 sec sys
to run. These four are consistent (but slower) than your numbers in all
probability because I'm on an older laptop.

The fifth command you posted (sans module) takes 0.225s real / 0.051s sys,
just in case you need those times.

HTH, Bill.

#`{Note: did "zef install Math::Sequences::Integer" prior to running the
timing code, testing OK, two modules installed--versions listed:
===> Installing: Lingua::EN::Numbers:ver<2.6.0>
===> Installing: Math::Sequences:ver<0.0.6>
then I ran Aaron's code at the terminal}

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

real    0m1.101s
user    0m1.032s
sys    0m0.086s
user@bmbook:~$ time PERL6LIB=lib perl6 -MMath::Sequences::Integer -e 'put
FatPi(310).perl'
FatRat.new(1570796326794896619231321691639751442098584699687552910487472296153908203143104499314017412671058533991074043256641153323546922304775291115862679704064240558725142051350969260552779822311474477465190982214405487832966723064237824116893391582635600954572824283461730174305227163324106696803630124570636862293503,
500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)

real    0m0.979s
user    0m0.980s
sys    0m0.080s
user@bmbook:~$ time PERL6LIB=lib perl6 -MMath::Sequences::Integer -e 'put
FatPi(309).base(2)'
11.001001000011111101101010100010001000010110100011000010001101001100010011000110011000101000101110000000110111000001110011010001001010010000001001001110000010001000101001100111110011000111010000000010000010111011111010100110001110110001001110011011001000100101000101001010000010000111100110001110001101000000010011011101111011111001010100011001101100111100110100111010010000110001101100110000001010110000101001101101111100100101111100010100001101110100111111100001001101010110110101101101010100011100001001000101111001001000010110110101011101100110001001011110011111101100011011110100010011000100001011101001101001100011011111101101011010110000101111111111010111001011011011110100000001101011011111101101111011100011100001101011111110110101101010001001100111111010010110101110100111110010010000010001011111000100101100011111111001100100100100101000011001100101000111101100111001000101101100111101110000100000000001111100101110001010000101100011101111110000010110011000110110100100100000110110000111000101010111010011101

real    0m1.071s
user    0m1.034s
sys    0m0.088s
user@bmbook:~$ time PERL6LIB=lib perl6 -MMath::Sequences::Integer -e 'put
FatPi(310).base(2)'
11.00100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001000100010100110011111001100011101000000001000001011101111101010011000111011000100111001101100100010010100010100101000001000011110011000111000110100000001001101110111101111100101010001100110110011110011010011101001000011000110110011000000101011000010100110110111110010010111110001010000110111010011111110000100110101011011010110110101010001110000100100010111100100100001011011010101110110011000100101111001111110110001101111010001001100010000101110100110100110001101111110110101101011000010111111111101011100101101101111010000000110101101111110110111101110001110000110101111111011010110101000100110011111101001011010111010011111001001000001000101111100010010110001111111100110010010010010100001100110010100011110110011100100010110110011110111000010000000000111110010111000101000010110001110111111000001011001100011011010010010000011011000011100010101011101001110011010011

real    0m0.986s
user    0m0.941s
sys    0m0.081s
user@bmbook:~$ time perl6 -e 'put
FatRat.new(1570796326794896619231321691639751442098584699687552910487472296153908203143104499314017412671058533991074043256641153323546922304775291115862679704064240558725142051350969260552779822311474477465190982214405487832966723064237824116893391582635600954572824283461730174305227163324106696803630124570636862293503,
500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000).base(2)'
11.00100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001000100010100110011111001100011101000000001000001011101111101010011000111011000100111001101100100010010100010100101000001000011110011000111000110100000001001101110111101111100101010001100110110011110011010011101001000011000110110011000000101011000010100110110111110010010111110001010000110111010011111110000100110101011011010110110101010001110000100100010111100100100001011011010101110110011000100101111001111110110001101111010001001100010000101110100110100110001101111110110101101011000010111111111101011100101101101111010000000110101101111110110111101110001110000110101111111011010110101000100110011111101001011010111010011111001001000001000101111100010010110001111111100110010010010010100001100110010100011110110011100100010110110011110111000010000000000111110010111000101000010110001110111111000001011001100011011010010010000011011000011100010101011101001110011010011

real    0m0.225s
user    0m0.219s
sys    0m0.051s
user@bmbook:~$ perl6 --version
This is Rakudo version 2020.06 built on MoarVM version 2020.06
implementing Raku 6.d.
user@bmbook:~$ raku --version
This is Rakudo version 2020.06 built on MoarVM version 2020.06
implementing Raku 6.d.

Reply via email to