您的位置:首页 > 编程语言 > Java开发

《JAVA编程技巧1001条》第337条:数学函数 SIN。

2017-12-17 10:00 881 查看


第9部分 Java 中的数学函数

337 Using the sin Method

337 sin方法的使用 (译著:以下一段中原文不确切,,已改)

In a triangle, the sine of an angle is the ratio of the angles opposite edge to the hypotenuse. The Math class sin method returns the sine of an angle expressed in radians. The declaration of the sin method is as follows:

在一个直角三角形中,一个角的正弦(sine)就是此角的对边与斜边的比。Math类中的sin方法返回用弧度表示的角的正弦值。方法sin的说明如下:
public static double sin(double a);

To return the sine of an angle, you can use the sin method, as shown:

要得到一个角的正弦,你可按如下所示来使用方法sin:

double num, angle = 0.785398D;   // angle in radians, 1/4

num = Math.sin(angle);           // return the sine of the angle

In this case, the statements will assign the variable num a value of 0.707107.

在本例子中,语句将把0.707107赋给变量num作为值。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: