> For the complete documentation index, see [llms.txt](https://docs.csml.dev/language/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.csml.dev/language/standard-library/number-methods.md).

# Number methods

Although CSML differentiates between *Float* and *Integer*, all methods are available on all Number types. Hence, the *Number* type does not really exist but represents indifferently *Float* and *Integer*.

Given the automatic type inference, CSML will automatically try to map integers and floats to whichever type makes more sense in the context.

### .pow(Number)

Raise the target integer to the power of the given integer.

```cpp
number.pow(Number) => Number

// example
do val = 3
do val.pow(2) // 9
```

### .abs()

Return the absolute value of the target number.

```cpp
integer.abs() => Number

// example
do val = -42
do val.abs() // 42
```

### .cos(), .sin(), .tan()

Return the cosine, sine or tangent of the target number.

```cpp
float.cos() => Float
float.sin() => Float

// example
do val = 12.34
do val.cos() // 0,9744873988
do val.sin() // -0,224442219
do val.tan() // -0,2303182363
```

### .floor(), .ceil(), .round()

Round the number respectively down, up or using mathematical rounding.

```cpp
float.floor() => Integer
float.ceil() => Integer
float.round() => Integer

// example
do val = 10.5
do val.floor() // 10
do val.ceil() // 11
do val.round() // 11
```

### .precision(n)

```cpp
do val = 1.234567.precision(2) // 1.23
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.csml.dev/language/standard-library/number-methods.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
