Compute Arccosine

Examples Filter
// Calculates angle of a right-angle triangle in radians
function calcAngle(adjacent, hypotenuse) {
  return Math.acos(adjacent / hypotenuse);
}

console.log(calcAngle(8, 10));
// expected output: 0.6435011087932843

console.log(calcAngle(5, 3));
// expected output: NaN

Math.acos(-2);  // NaN
Math.acos(-1);  // 3.141592653589793
Math.acos(0);   // 1.5707963267948966
Math.acos(0.5); // 1.0471975511965979
Math.acos(1);   // 0
Math.acos(2);   // NaN
package main

import (
	"fmt"
	"math"
)

func main() {
	fmt.Printf("%.2f", math.Acos(1))
}