Any experiences with Rakudo Perl 6?

Discussion in 'Perl Misc' started by gamo@telecable.es, Oct 11, 2013.

  1. Guest

    I'm interested specially with the speed of Perl 6 compiled
    programs. Numeric programs in particular.

    I have read the examples of Perl6::Coockbook module and I
    think there are a lot of basic programs that could be
    translated from Perl 5 to 6 without much pain.

    TIA
     
    , Oct 11, 2013
    #1
    1. Advertising

  2. Guest

    Forget about it. It's unusable because hangs out.

    I used this program to test

    #!/usr/bin/perl6

    use v6;

    =begin pod

    Calculate the N(0,1) prob. value corresponding to Z

    =end pod

    # say "Enter Z: ";
    my $z = 1; # @ARGV[0]; # $*IN; # .lines;
    # chomp $z;
    die "Wrong number" unless $z;

    my $step = 1/1000000;
    my $r = 0.5;
    my $pi = 3.14159265358979324;
    my $static = 1/(1000000*sqrt(2*$pi));
    my $e = exp(1);
    my $i = $step;
    loop {
    $i += $step;
    if $i > $z {
    last;
    }
    $r += $static*($e**(-0.5*$i*$i));
    }
    $r = sprintf ("%.7f",$r);
    say "P[Z<=$z] = $r";
    my $rleft = 1 - $r;
    $r -= $rleft;
    say "P[-$z<=Z<=$z] = $r";

    exit 0;


    # After correcting it more than 20 times, it shows no error but doesn't run
     
    , Oct 12, 2013
    #2
    1. Advertising

  3. >>>>> "gamo" == gamo <> writes:

    gamo> Forget about it. It's unusable because hangs out.

    It's unusable because the author of the code doesn't understand how
    computers do math. This is not a problem with Perl 6 but a problem in
    translating abstract concepts with theoretically infinite precision into
    electrons moving on silicon.

    http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

    Read and be enlightened.

    Charlton



    gamo> I used this program to test

    gamo> #!/usr/bin/perl6

    gamo> use v6;

    gamo> =begin pod

    gamo> Calculate the N(0,1) prob. value corresponding to Z

    gamo> =end pod

    gamo> # say "Enter Z: "; my $z = 1; # @ARGV[0]; # $*IN; # .lines; #
    gamo> chomp $z; die "Wrong number" unless $z;

    gamo> my $step = 1/1000000; my $r = 0.5; my $pi =
    gamo> 3.14159265358979324; my $static = 1/(1000000*sqrt(2*$pi)); my
    gamo> $e = exp(1); my $i = $step; loop { $i += $step; if $i > $z {
    gamo> last;
    gamo> }
    gamo> $r += $static*($e**(-0.5*$i*$i));
    gamo> }
    gamo> $r = sprintf ("%.7f",$r); say "P[Z<=$z] = $r"; my $rleft = 1 -
    gamo> $r; $r -= $rleft; say "P[-$z<=Z<=$z] = $r";

    gamo> exit 0;


    gamo> # After correcting it more than 20 times, it shows no error
    gamo> but doesn't run



    --
    Charlton Wilbur
     
    Charlton Wilbur, Oct 21, 2013
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. a

    any subway experiences

    a, Jun 17, 2006, in forum: Python
    Replies:
    11
    Views:
    535
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=
    Jun 19, 2006
  2. Strawberry
    Replies:
    0
    Views:
    328
    Strawberry
    Dec 15, 2006
  3. Dilbert
    Replies:
    4
    Views:
    460
    Dilbert
    May 22, 2010
  4. Dilbert
    Replies:
    2
    Views:
    153
    Dilbert
    Aug 8, 2010
  5. Dilbert
    Replies:
    2
    Views:
    435
    Dilbert
    Aug 17, 2012
Loading...

Share This Page