Any experiences with Rakudo Perl 6?

G

gamo

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
 
G

gamo

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
 
C

Charlton Wilbur

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top