---
warning: This file is auto generated by `yarn web:inject`, do not edit by hand
examples:
- acos(1)
- acos(0)
- acos(-1)
returns:
- '0'
- '1.5707963267948966'
- '3.141592653589793'
dependencies: []
authors:
original by:
- Kevin van Zonneveld (https://kvz.io)
notes:
- Returns the arc cosine of x, in radians
parityVerified:
- Python 3.12
isTypescript: true
type: function
layout: function
title: Python's math.acos in TypeScript
description: >-
Here's what our current TypeScript equivalent to Python's
math.acos looks like.
function: acos
category: math
language: python
permalink: python/math/acos/
alias:
- /functions/python/acos/
- /functions/math/acos/
- /python/acos/
---
{% codeblock lang:typescript %}export function acos(x: number): number {
// discuss at: https://locutus.io/python/acos/
// parity verified: Python 3.12
// original by: Kevin van Zonneveld (https://kvz.io)
// note 1: Returns the arc cosine of x, in radians
// example 1: acos(1)
// returns 1: 0
// example 2: acos(0)
// returns 2: 1.5707963267948966
// example 3: acos(-1)
// returns 3: 3.141592653589793
return Math.acos(x)
}
{% endcodeblock %}
{% codeblock lang:javascript %}export function acos(x) {
// discuss at: https://locutus.io/python/acos/
// parity verified: Python 3.12
// original by: Kevin van Zonneveld (https://kvz.io)
// note 1: Returns the arc cosine of x, in radians
// example 1: acos(1)
// returns 1: 0
// example 2: acos(0)
// returns 2: 1.5707963267948966
// example 3: acos(-1)
// returns 3: 3.141592653589793
return Math.acos(x)
}{% endcodeblock %}