in reply to Wrong calculations in for loop
Luckily you can run the script with only very small changes under Perl 6, and it produces the output you expect:
use v6; my $zmax = 60; # Maximum depth in your model my $dz = 0.05; # Grid spacing in z-direction loop (my $i=0; $i <= $zmax; $i = $i+$dz) { say $i; }
produces
... 3.6 3.65 3.7 3.75 ... 59.9 59.95 60
It accomplishes that magic by doing math with rationals (stored as integer numerator and denominator) by default.
In Section
Seekers of Perl Wisdom