---
title: "acos(): typeshade/core/ir의 IR 빌더 함수, TypeShade 컴파일러 API"
description: "acos, typeshade/core/ir의 IR 빌더 함수입니다. acos(x): 역코사인을 성분별로 구합니다. 결과는 [0, π] 범위의 라디안입니다."
url: https://typeshade.dev/ko/api/acos/
language: ko
---

# `acos()`

함수, 내장 함수 분류

`acos(x)`: 역코사인을 성분별로 구합니다. 결과는 \[0, π\] 범위의 라디안입니다.

`import { acos } from 'typeshade/core/ir'`

이 export는 IR 노드를 반환합니다. `"use typeshade"` 파일에서는 내장 함수 자체를 부릅니다: [`acos()`](https://typeshade.dev/ko/reference/functions/acos/)

설명은 커밋 af54ddad5의 검토된 컴파일러 문서를 번역한 것입니다. 시그니처와 예제 코드는 원문을 따르며, 필요한 경우 설명에 편집상 수정이 반영됩니다.

## 구문

```ts
const acos: <K extends FloatKey>(x: ReadonlyNode<K>) => Node<K>
```

## 매개변수

**`x` `ReadonlyNode<K>`**

## 반환값

`Node<K>`

## 설명

[`asin`](https://typeshade.dev/ko/api/asin/)과 마찬가지로 `x ∈ [-1, 1]` 밖에서는 정의되지 않습니다. 부동소수점 연산이 여러 번 이어지면 오차 때문에 값이 ±1을 살짝 넘을 수 있습니다. 그럴 때는 먼저 [`clamp`](https://typeshade.dev/ko/api/clamp/)로 인자를 제한해야 합니다.

## 예제

### 예제

```ts
import { fn, acos, clamp, f32T } from 'typeshade/core/ir'

const angle = fn('angle', { cosTheta: f32T }, ({ cosTheta }) => acos(clamp(cosTheta, -1, 1)))
```

## 대상별 지원

| 대상 | 지원 | 비고 |
| --- | --- | --- |
| WGSL (WebGPU) | 지원 | `acos(x)`. |
| GLSL ES 3.00 (WebGL2) | 지원 | `acos(x)`. |
| CPU 오라클 | 지원 | 오라클이 `f64`로 계산합니다. |

## 함께 보기

- [`acos()`](https://typeshade.dev/ko/reference/functions/acos/)
- [`asin`](https://typeshade.dev/ko/api/asin/)
- [`clamp`](https://typeshade.dev/ko/api/clamp/)

## 소스

[`src/core/ir/node.ts`, 1148행](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L1148), 커밋 af54ddad5 기준
