説明
ある小数の値より大きくて一番近い整数値を取得する。
桁上げの処理
public static int roundUp(double x){
x = x + 0.9;
return (int)x;
}
説明
四捨五入する。
四捨五入の処理
public static int roundOff(double x){
x = x + 0.5;
return (int)x;
}
説明
ある小数の値より小さくて一番近い整数値を取得する。
切捨ての処理
public static int roundDown(double x){
return (int)x;
}
« 前ページへ — 次ページへ »