Trusted answers to developer questions

Tarun Telang

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Java has a built-in `Math`

class, defined in the `java.lang`

package, which contains important functions to perform basic mathematical operations. The class has the ** asin() method**, which is used to compute an $\arcsin$ or the $sin^{-1}$ (pronounced

If $sin(\theta)$ is x then $sin^{-1}$(x) or $\arcsin(x)$ is $\theta$.

```
public static double asin(double value);
```

This function has one parameter, ** value**, which represents the double value for which we have to find the $\arcsin$.

The function returns the double value corresponding to the $\arcsin$ of the `value`

. The returned value will lie within the range $\pi/2$ to $-\pi/2$.

Note:

`Math.PI`

is a constant equivalent to $\pi$ in mathematics.

If the value of `value`

is infinity or `NaN`

.

Note: To convert an angle measured in radians to an equivalent angle measured in degrees and vice versa, we can use the built-in

`Math.toDegrees(double angle_in_randians)`

and`Math.toRadians(double angle_in_degrees)`

methods.

class HelloWorld {public static void main( String args[] ) {double result = Math.asin(1);System.out.println("asin(1) = " + result);result = Math.asin(0);System.out.println("asin(0) = " + result);result = Math.asin(0.48);System.out.println("asin(0.48) = " + result);result = Math.asin(0.66);System.out.println("asin(O.66) = " + result);result = Math.asin(0.8);System.out.println("asin(0.8) = " + result);result = Math.asin(1);System.out.println("asin(1) = " + result);result = Math.asin(Double.NaN);System.out.println("asin(NaN) = " + result);result = Math.asin(Double.POSITIVE_INFINITY);System.out.println("asin(∞) = " + result);}}

Example code for Math.asin() in Java

RELATED TAGS

math

math.asin()

asin

communitycreator

java

CONTRIBUTOR

Tarun Telang

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring

Related Courses