I'm trying to convert the sine of an angle from radians to degrees and I keep getting inaccurate numbers. My code looks like this:
public class PhysicsSolverAttempt2 {
public static void main(String[] args) {
double[] numbers = {60, 30, 0};
double launchAngle = Double.parseDouble(numbers[0]);
double iV = Double.parseDouble(numbers[1]);
System.out.println(launchAngle);
double iVV = iV * Math.toDegrees(Math.sin(launchAngle));
System.out.println(Math.toDegrees(Math.sin(launchAngle)));
}
}
When I use Math.sin(launchAngle), it gives me a perfect output in radians. However, when I convert the radians to degrees using the Math.toDegrees() function at the end, it gives me -17.464362139918286, though performing the same calculation with a calculator yields the number 0.86602540378. Am I using Math.toDegrees() incorrectly, or do I need to perform extra steps to get an accurate result?
No comments:
Post a Comment