in reply to Re^6: Variables are automatically rounded off in perl (slippery)
in thread Variables are automatically rounded off in perl
Those are actually correct values (rounded to 15 decimal digits of precision) for a perl whose nvtype is an 8-byte double.C:\_32\pscrpt>perl -le "print $];" 5.024000 C:\_32\pscrpt>perl -V:archname archname='MSWin32-x86-multi-thread-64int'; C:\_32\pscrpt>perl -V:nvtype nvtype='double'; C:\_32\pscrpt>type try.pl use warnings; use strict; my $x = 0; for( 1..100 ) { $x += 0.01; print "$x\n" if length $x > 4; } C:\_32\pscrpt>perl try.pl 0.810000000000001 0.820000000000001 0.830000000000001 0.840000000000001 0.850000000000001 0.860000000000001 0.870000000000001 0.880000000000001 0.890000000000001 0.900000000000001 0.910000000000001 0.920000000000001 0.930000000000001 0.940000000000001 0.950000000000001 0.960000000000001 0.970000000000001 0.980000000000001 0.990000000000001 C:\_32\pscrpt>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Variables are automatically rounded off in perl (testing)
by tye (Sage) on Jul 26, 2016 at 01:42 UTC | |
by syphilis (Archbishop) on Jul 26, 2016 at 02:17 UTC |