回答編集履歴
2
あー四捨五入
test
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
int j = (int)( (i2 * tax)/tax);
|
36
36
|
|
37
|
-
int k = Math.round( (i2 * tax)/tax);
|
37
|
+
int k = Math.round( Math.round(i2 * tax)/tax);
|
38
38
|
|
39
39
|
if (i != j) {
|
40
40
|
|
1
そういえば cast は 切り捨てだったかしら
test
CHANGED
@@ -34,11 +34,17 @@
|
|
34
34
|
|
35
35
|
int j = (int)( (i2 * tax)/tax);
|
36
36
|
|
37
|
-
|
37
|
+
int k = Math.round( (i2 * tax)/tax);
|
38
38
|
|
39
39
|
if (i != j) {
|
40
40
|
|
41
|
-
System.out.printf("i=%d %n", i);
|
41
|
+
System.out.printf("[j] i=%d %n", i);
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
if (i != k) {
|
46
|
+
|
47
|
+
System.out.printf("[k] i=%d %n", i);
|
42
48
|
|
43
49
|
}
|
44
50
|
|