JavaScript acos() Method
JavaScript Math Object
Definition and Usage
The acos() method returns the arccosine of a number as a numeric value value between 0 and PI radians.
Syntax
| Parameter |
Description |
| x |
Required. Must be a numeric value in the range -1 to 1 |
Tips and Notes
Note: If the parameter x is outside the range -1 to 1, the browser will return NaN.
Note: -1 will return the value of PI.
Example
Example
Return the arccosine of different numbers:
<script type="text/javascript">
document.write(Math.acos(0.64) + "<br />");
document.write(Math.acos(0) + "<br />");
document.write(Math.acos(-1) + "<br />");
document.write(Math.acos(1) + "<br />");
document.write(Math.acos(2));
</script>
|
The output of the code above will be:
0.8762980611683406
1.5707963267948965
3.141592653589793
0
NaN
|
Try it yourself »
|
JavaScript Math Object

Need an easy way to get data into XML, or transform XML to another format?
MapForce lets you map XML data to/from any combination of XML, database, flat file, Excel 2007, XBRL, or Web services data.
Then it transforms data instantly or auto-generates royalty-free data integration code for recurrent conversions.
Download a free, fully functional 30-day trial to experience the following features:
- Easy-to-use, graphical data mapping interface
- Instant data transformation
- XSLT 1.0/2.0 and XQuery code generation
- Java, C#, and C++ code generation
- Advanced data processing functions
- Support for all major relational databases including SQL Server, IBM DB2, Oracle, and more
- Visual Studio & Eclipse integration
Download a fully-functional trial today!
|
|
|
|