English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Java Math Mathematical Methods
O método asin() da Java Math retorna a arco-senôntica do valor especificado.
A arco-senôntica é a função inversa da função seno.
A sintaxe do método asin() é:
Math.asin(double num)
num - o número que se deseja retornar a arco-senôntica
Note:O valor absoluto de num deve sempre ser menor que1。
retorna a arco-senôntica do número especificado
se o valor especificado for zero, então retorna 0
se o número especificado for NaN ou maior que1,retorna NaN
Note:O valor retornado é -pi / 2 até pi / 2 entre os ângulos.
import java.lang.Math; class Main { public static void main(String[] args) { //Create variables double a = 0.99; double b = 0.71; double c = 0.0; //Print the inverse sine 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 } }
No exemplo acima, já importamos o pacote java.lang.Math. Isso é importante se quisermos usar os métodos da classe Math. Observe a expressão
Math.asin(a)
Here, we used 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 variables double a = 2; //Square root of a negative number. //The result is not a number (NaN) double b = Math.sqrt(-5); //Print the inverse sine value System.out.println(Math.asin(a)); // NaN System.out.println(Math.asin(b); // NaN } }
Here, we 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 number is negative (-5) square root is not a number
Note:We have usedMath sqrt()Method to calculate the square root of a number.