Thread Auf 2. Kommastelle runden? (31 answers)
Opened by Gast at 2008-05-07 02:31

bianca
 2009-12-12 09:02
#129246 #129246
User since
2009-09-13
6978 Artikel
BenutzerIn

user image
2009-12-11T20:03:12 topeg
Oha stimmt. Bei anderen Sachen klappt es auch nicht. Seltsam, dass mir das bisher nicht aufgefallen ist...

Also hier die überarbeitete Version:


Die läuft durch meine Testumgebung (siehe http://www.perl-community.de/bat/poard/thread/1436...) jetzt auch noch nicht so ganz geschmeidig durch:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
'-999999999999.999'........auf 2 Stelle(n): '-1000000000000'........... OK
'-999999999999.994'........auf 2 Stelle(n): '-999999999999.99'......... OK
'-2132343.565'.............auf 2 Stelle(n): '-2132343.57'.............. OK
'-12345.35'................auf 1 Stelle(n): '-12345.4'................. OK
'-12345.34'................auf 1 Stelle(n): '-12345.3'................. OK
'-456.5'...................auf 0 Stelle(n): '-457'..................... OK
'-456.4'...................auf 0 Stelle(n): '-456'..................... OK
'-57'......................auf 2 Stelle(n): '-57'...................... OK
'-00000034.999'............auf 2 Stelle(n): '-35'...................... OK
'-12.2345678905'...........auf 9 Stelle(n): '-12.234567891'............ OK
'-9.999'...................auf 3 Stelle(n): '-9.999'................... OK
'-9.999'...................auf 0 Stelle(n): '-10'...................... OK
'-9.999'...................auf 1 Stelle(n): '-10'...................... OK
'-9.999'...................auf 2 Stelle(n): '-10'...................... OK
'-8.9964'..................auf 2 Stelle(n): '-9'....................... OK
'-8.9964'..................auf 0 Stelle(n): '-9'....................... OK
'-8.9964'..................auf 1 Stelle(n): '-9'....................... OK
'-1.9'.....................auf 0 Stelle(n): '-2'....................... OK
'-1.455'...................auf 2 Stelle(n): '-1.46'.................... OK
'-1.295'...................auf 2 Stelle(n): '-1.3'..................... OK
'-1'.......................auf 2 Stelle(n): '-1'....................... OK
'-0.999999999'.............auf 0 Stelle(n): '-1'....................... OK
Use of uninitialized value in pattern match (m//) at rundentest.pl line 261.
Use of uninitialized value in transliteration (tr///) at rundentest.pl line 264.
Use of uninitialized value in concatenation (.) or string at rundentest.pl line 281.
Argument "e0" isn't numeric in addition (+) at rundentest.pl line 282.
'-.5678'...................auf 3 Stelle(n): '0'........................ FEHLER! Erwartet '-0.568'
Use of uninitialized value in pattern match (m//) at rundentest.pl line 261.
Use of uninitialized value in transliteration (tr///) at rundentest.pl line 264.
Use of uninitialized value in concatenation (.) or string at rundentest.pl line 281.
Argument "e0" isn't numeric in addition (+) at rundentest.pl line 282.
'-.5674'...................auf 3 Stelle(n): '0'........................ FEHLER! Erwartet '-0.567'
Use of uninitialized value in pattern match (m//) at rundentest.pl line 261.
Use of uninitialized value in transliteration (tr///) at rundentest.pl line 264.
Use of uninitialized value in concatenation (.) or string at rundentest.pl line 281.
Argument "e0" isn't numeric in addition (+) at rundentest.pl line 282.
'-.5670'...................auf 3 Stelle(n): '0'........................ FEHLER! Erwartet '-0.567'
'-0.5'.....................auf 0 Stelle(n): '-1'....................... OK
'-0.49999999'..............auf 0 Stelle(n): '0'........................ OK
'-0.2225000000'............auf 3 Stelle(n): '-0.223'................... OK
'-0.2224000000'............auf 3 Stelle(n): '-0.222'................... OK
'-0.105'...................auf 2 Stelle(n): '-0.11'.................... OK
'-0.1005'..................auf 3 Stelle(n): '-0.101'................... OK
'-0.05'....................auf 1 Stelle(n): '-0.1'..................... OK
'-0.04'....................auf 1 Stelle(n): '0'........................ OK
'-0.0105'..................auf 3 Stelle(n): '-0.011'................... OK
'-0.005'...................auf 2 Stelle(n): '-0.01'.................... OK
'-0.004'...................auf 2 Stelle(n): '0'........................ OK
'4.24306121591708e-007'....auf 2 Stelle(n): '0'........................ OK
'0.004'....................auf 2 Stelle(n): '0'........................ OK
'0.005'....................auf 2 Stelle(n): '0.01'..................... OK
'0.0105'...................auf 3 Stelle(n): '0.011'.................... OK
'0.04'.....................auf 1 Stelle(n): '0'........................ OK
'0.05'.....................auf 1 Stelle(n): '0.1'...................... OK
'0.1005'...................auf 3 Stelle(n): '0.101'.................... OK
'0.105'....................auf 2 Stelle(n): '0.11'..................... OK
'0.2224000000'.............auf 3 Stelle(n): '0.222'.................... OK
'0.2225000000'.............auf 3 Stelle(n): '0.223'.................... OK
'0.49999999'...............auf 0 Stelle(n): '0'........................ OK
'0.5'......................auf 0 Stelle(n): '1'........................ OK
Use of uninitialized value in pattern match (m//) at rundentest.pl line 261.
Use of uninitialized value in transliteration (tr///) at rundentest.pl line 264.
Use of uninitialized value in concatenation (.) or string at rundentest.pl line 281.
Argument "e0" isn't numeric in addition (+) at rundentest.pl line 282.
'.5670'....................auf 3 Stelle(n): '0'........................ FEHLER! Erwartet '0.567'
Use of uninitialized value in pattern match (m//) at rundentest.pl line 261.
Use of uninitialized value in transliteration (tr///) at rundentest.pl line 264.
Use of uninitialized value in concatenation (.) or string at rundentest.pl line 281.
Argument "e0" isn't numeric in addition (+) at rundentest.pl line 282.
'.5674'....................auf 3 Stelle(n): '0'........................ FEHLER! Erwartet '0.567'
Use of uninitialized value in pattern match (m//) at rundentest.pl line 261.
Use of uninitialized value in transliteration (tr///) at rundentest.pl line 264.
Use of uninitialized value in concatenation (.) or string at rundentest.pl line 281.
Argument "e0" isn't numeric in addition (+) at rundentest.pl line 282.
'.5678'....................auf 3 Stelle(n): '0'........................ FEHLER! Erwartet '0.568'
'0.999999999'..............auf 0 Stelle(n): '1'........................ OK
'1'........................auf 2 Stelle(n): '1'........................ OK
'1.295'....................auf 2 Stelle(n): '1.3'...................... OK
'1.455'....................auf 2 Stelle(n): '1.46'..................... OK
'1.9'......................auf 0 Stelle(n): '2'........................ OK
'8.9964'...................auf 1 Stelle(n): '9'........................ OK
'8.9964'...................auf 0 Stelle(n): '9'........................ OK
'8.9964'...................auf 2 Stelle(n): '9'........................ OK
'9.999'....................auf 3 Stelle(n): '9.999'.................... OK
'9.999'....................auf 2 Stelle(n): '10'....................... OK
'9.999'....................auf 1 Stelle(n): '10'....................... OK
'9.999'....................auf 0 Stelle(n): '10'....................... OK
'12.2345678905'............auf 9 Stelle(n): '12.234567891'............. OK
'00000034.999'.............auf 2 Stelle(n): '35'....................... OK
'57'.......................auf 2 Stelle(n): '57'....................... OK
'456.4'....................auf 0 Stelle(n): '456'...................... OK
'456.5'....................auf 0 Stelle(n): '457'...................... OK
'12345.34'.................auf 1 Stelle(n): '12345.3'.................. OK
'12345.35'.................auf 1 Stelle(n): '12345.4'.................. OK
'2132343.565'..............auf 2 Stelle(n): '2132343.57'............... OK
'999999999999.994'.........auf 2 Stelle(n): '999999999999.99'.......... OK
'999999999999.999'.........auf 2 Stelle(n): '1000000000000'............ OK
'1e+100'...................auf 3 Stelle(n): '1e+100'................... OK
(7.56*1.19)................auf 2 Stellen : '9'........................ OK
(-7.56*1.19)...............auf 2 Stellen : '-9'....................... OK
(.57*100)..................auf 0 Stellen : '57'....................... OK
(.57*100)..................auf 2 Stellen : '57'....................... OK


Die erste Zeile Deines Scripts (my $zahl=shift;) ist bei mir Zeile 250, Rest ist 1:1 rüber kopiert.
10 print "Hallo"
20 goto 10

View full thread Auf 2. Kommastelle runden?