# \[수학] 절댓값

### 코드

{% code title="값에 대한 절댓값을 구할 때" %}

```
@수학 (값)의 절댓값/절대값
```

{% endcode %}

### 설명

값에 대한 절댓값을 반환합니다.

$$
|x| = \begin{cases} x, & \quad x \ge 0 \ -x, & \quad x < 0 \end{cases}
$$

***

### 주의사항

* 수학 코드를 쓸 때는 앞에 `@수학`을 써야 해요.
* 절댓값은 항상 0 이상의 값이 나와요.

***

### 파이썬 대응 코드

```
abs(x)
```

***

### 예시

{% code title="예시 코드" %}

```
@수학 -5의 절댓값 보여주기
@수학 (-10)의 절대값 보여주기
```

{% endcode %}

{% code title="예시 코드의 결과" %}

```
5   # -5의 절댓값
10  # -10의 절댓값
```

{% endcode %}

***

### 검색 키워드

수학, 절댓값, 절대값


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codebook.horang.it/math/undefined-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
