Math.cos, sin and tan returning inaccurate values in Java
问题 I am working on a calculator with a GUI in Java. The project is done, however the trigonometric functions do not work properly. This is the method for the cos function: public void actionPerformed(ActionEvent evt) { input = Double.valueOf(Display.getText()); ans = Math.cos(Math.toRadians(input)); Display.setText(String.valueOf(ans)); } Where "Display" is the text area. The problem is that the functions return inaccurate values. For example, when I enter 90 and click the cos button, the number