###前提・実現したいこと
int型浮動小数点を使った軌道計算プログラムにおいてint型をdouble型に変えることなく、計算の時間分解能をもっと上げるためにm単位をcmに変換する方法がわかりません。教えていただけたら嬉しいです。
###該当のソースコード
import java.io.*;
class FallInt5 {
public static void main(String args[]) {
int x, y, x_speed, y_speed;
int g;
String buf;
g = -10; x = 0; y = 100000; x_speed = 800; y_speed = 0; try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.err.print("x_speed = "); buf = br.readLine(); x_speed = Integer.parseInt(buf); } catch(Exception e) { System.err.print("Error:" + e); } while( y >= 0 ) { y_speed = y_speed + g/10000; x = x + x_speed/10000; y = y + y_speed/10000; } System.out.print("estimated distance = " + x + "\n"); return; }
}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/10/12 18:34