public class wo { /** * Returns the trigonometric sine of an angle. Special cases: * <ul><li>If the argument is NaN or an infinity, then the * result is NaN. * <li>If the argument is zero, then the result is a zero with the * same sign as the argument.</ul> * * <p>The computed result must be within 1 ulp of the exact result. * Results must be semi-monotonic. * * @param a an angle, in radians. * @return the sine of the argument. */ public static void main(String args[]) { System.out.println(Math.sin(30*Math.PI/180)); } } 传入的是弧度 那些英文注释是api中队sin方法的描述
public class wo {
/**
* Returns the trigonometric sine of an angle. Special cases:
* <ul><li>If the argument is NaN or an infinity, then the
* result is NaN.
* <li>If the argument is zero, then the result is a zero with the
* same sign as the argument.</ul>
*
* <p>The computed result must be within 1 ulp of the exact result.
* Results must be semi-monotonic.
*
* @param a an angle, in radians.
* @return the sine of the argument.
*/
public static void main(String args[]) {
System.out.println(Math.sin(30*Math.PI/180));
}
} 传入的是弧度 那些英文注释是api中队sin方法的描述
Math.sin()的参数的单位是弧度,不是角度
要使用角度还要先转换 角度= 弧度*(Math.PI/180);System.out.println(Math.sin(30*Math.PI/180));