English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Java Math mathematical methods
La méthode asin() de Math dans Java retourne l'arc sinus de la valeur spécifiée.
L'arc sinus est la fonction réciproque de la fonction sinus.
La syntaxe de la méthode asin() est :
Math.asin(double num)
num - au nombre à retourner son arc sinus
Note:La valeur absolue de num doit toujours être inférieure1。
retourne l'arc sinus du nombre spécifié
si la valeur spécifiée est zéro, alors retourne 0
si le nombre spécifié est NaN ou supérieur1,retourne NaN
Note:La valeur de retour est -pi / 2 à pi / 2 entre les angles.
import java.lang.Math; class Main { public static void main(String[] args) { //Create a variable double a = 0.99; double b = 0.71; double c = 0.0; //Print the arcsine value System.out.println(Math.asin(a)); // 1.4292568534704693 System.out.println(Math.asin(b)); // 0.7812981174487247 System.out.println(Math.asin(c)); // 0.0 } }
Dans l'exemple précédent, nous avons importé le paquet java.lang.Math. Si nous devons utiliser les méthodes de la classe Math, c'est très important. Notez l'expression
Math.asin(a)
Here, we use the class name directly to call the method. This is because asin() is a static method.
import java.lang.Math; class Main { public static void main(String[] args) { // Create a variable double a = 2; //The square root of a negative number. //The result is not a number (NaN) double b = Math.sqrt(-5); //Print the arcsine value System.out.println(Math.asin(a)); // NaN System.out.println(Math.asin(b); // NaN } }
In this example, we have created two variables named a and b.
Math.asin(a) - Returns NaN because the value of a is greater than1
Math.asin(b) - Returns NaN because the negative number (-5) is not a number
Note:We have usedMath sqrt()method to calculate the square root of a number.