Simple Perl For-Loop
问题 I have a for loop and I want to increment the variable by 0.1 each time, however the value changes differently from the increment and I am unsure as to why. I've simplified the for loop and it still gives a strange output: for (my $t = 1000; $t < 1500 ;$t+=0.1) { print "$t\n"; } It prints: 1034.9 1035 1035.1 1035.2 1035.3 1035.4 1035.49999999999 1035.59999999999 1035.69999999999 1035.79999999999 1035.89999999999 1035.99999999999 1036.09999999999 1036.19999999999 1036.29999999999 [it then goes