Close

Java - Math.asin() Examples

Java Java API 


Class:

java.lang.Math

java.lang.Objectjava.lang.Objectjava.lang.Mathjava.lang.MathLogicBig

Method:

public static double asin(double a)

Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2.

Parameters:
a - the value whose arc sine is to be returned.
Returns:
the arc sine of the argument.


Examples


package com.logicbig.example.math;

public class AsinExample {

public static void main(String... args) {
findArcSine(-1);
findArcSine(0);
findArcSine(0.5);
findArcSine(0.7071);
findArcSine(0.866);
findArcSine(1);
}

private static void findArcSine(double value) {
double sinValue = Math.asin(value);
double degree = Math.toDegrees(sinValue);
System.out.printf("ArcSine of %s = %.2f degrees%n", value, degree);
}
}

Output

ArcSine of -1.0 = -90.00 degrees
ArcSine of 0.0 = 0.00 degrees
ArcSine of 0.5 = 30.00 degrees
ArcSine of 0.7071 = 45.00 degrees
ArcSine of 0.866 = 60.00 degrees
ArcSine of 1.0 = 90.00 degrees




See Also