0
這是主要方法。試圖計算雙x數學公式,它給我運行代碼的問題。有人可以幫忙嗎?我得到java.lang.ArithmeticException錯誤
final int P = Integer.parseInt(args[0]);
final int Q = Integer.parseInt(args[1]);
final double H = Double.parseDouble(args[2]);
final int N = Spiro.numberOfRevolutions(P, Q);
IPoint2D point = new IPoint2D(0., 0.);
SimpleDrawing.drawPoint(point);
for (int i = 1; i <= 360*N; i++) {
final int r = P/Q;
double radianI = Math.toRadians(i);
double x = ((1 - r) * Math.cos(radianI)) + (H * Math.cos(((1- r)/r) * radianI));
double y = ((1 - r) * Math.sin(radianI)) + (H * Math.sin(((1- r)/r) * radianI));
IPoint2D point1 = new IPoint2D(x,y);
SimpleDrawing.drawPoint(point1);
}
某處有'0'嗎? –
你能把你得到的確切例外嗎? –
請發佈堆棧跟蹤。 – Math