Thread Kaufmännisch korrekt runden
(67 answers)
Opened by bianca at 2009-12-11 07:14 2009-12-13T09:14:47 topeg Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 my %test = ( '0.0000000075,9' => '0.000000008', '-0.0000000075,9' => '-0.000000008', ); my $space = '.' x 25; foreach my $test (sort {(split /,/,$a)[0] <=> (split /,/,$b)[0] } keys %test) { my ($wert,$stellen) = split /,/,$test; my $gerundet = &{$sub} ($wert,$stellen); print "\'$wert\'" . substr ($space,0,25 - length ($wert)) . "auf $stellen Stelle(n): \'$gerundet\'" . substr ($space,0,25 - length ($gerundet)) . ($gerundet eq $test{$test} ? ' OK' : " FEHLER! Erwartet \'$test{$test}\'") . "\n"; } 10 print "Hallo"
20 goto 10 |