# DataType:math

This DataType performs various mathematical calculations. In the following members, *n* is any formula that consists of valid [Operators](/macroquest/documentation/operators.md).

## Members

| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Abs\[***n***]**                                      | The absolute value of the result of *n*                                                                                                                                     |
| -------------------------------------------------------------------------------------- | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Acos\[***n***]**                                     | Arccosine of *n* (in degrees)                                                                                                                                               |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Asin\[***n***]**                                     | Arcsine of *n* (in degrees)                                                                                                                                                 |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Atan\[***n***]**                                     | Arctangent of *n* (in degrees)                                                                                                                                              |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Calc\[***n***]**                                     | Performs a mathematical calculation *n*                                                                                                                                     |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)       | **Clamp\[***n, min, max***]**                          | Clamps the value *n* such that *min* <= *n* <= *max*                                                                                                                        |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Cos\[***n***]**                                      | Cosine of *n* (in degrees)                                                                                                                                                  |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)       | **Dec\[***hex***]**                                    | Decimal value of a hexidecimal string                                                                                                                                       |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Distance\[**&#x79;,x,&#x7A;**:**&#x79;,x,&#x7A;**]** | <ul><li>Calculates the distance between two points on the map</li><li>1, 2, or 3 dimensions may be provided</li><li>Defaults to your character's current location</li></ul> |
| [*string*](/macroquest/data-types-and-top-level-objects/data-types/datatype-string.md) | **Hex\[***n***]**                                      | Returns hexidecimal value of [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md) *n*                                                           |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)       | **Not\[***n***]**                                      | Bitwise complement of *n*                                                                                                                                                   |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)       | **Rand\[***n***]**                                     | Random integer. Rand\[5] range 0 to 4. Rand\[100,200] range 100 to 199                                                                                                      |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Sin\[***n***]**                                      | Sine of *n* (in degrees)                                                                                                                                                    |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Sqrt\[***n***]**                                     | Square root of *n*                                                                                                                                                          |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)   | **Tan\[***n***]**                                      | Tangent of *n* (in degrees)                                                                                                                                                 |
| [*string*](/macroquest/data-types-and-top-level-objects/data-types/datatype-string.md) | **To String**                                          | NULL                                                                                                                                                                        |


---

# 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://macroquest.gitbook.io/macroquest/data-types-and-top-level-objects/data-types/datatype-math.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.
