# Math

The `Math` Class provides a comprehensive set of mathematical functions and constants for a wide range of mathematical operations. It includes well-known mathematical constants such as 'e' (the base of natural logarithms) and 'pi' (the ratio of a circle's circumference to its diameter). The Math Class also offers methods for tasks like rounding numbers, generating random values, and converting angles between degrees and radians.

### Constants

**`Math.E`**

The constant representing the mathematical constant 'e,' the base of natural logarithms.

**`Math.PI`**

The constant representing the mathematical constant 'pi,' the ratio of the circumference of a circle to its diameter.

**`Math.DEGREES_TO_RADIANS`**

A constant for converting angles from degrees to radians.

**`Math.RADIANS_TO_DEGREES`**

A constant for converting angles from radians to degrees.

### Methods

**`Math.round(a: number): number`**

Returns the closest `long` to the argument `a`, with ties rounding to positive infinity.

```typescript
var number = 3.7;
var roundedNumber = Math.round(number); // roundedNumber is now 4
```

**`Math.random(): Double`**

Returns a random `double` value with a positive sign, greater than or equal to 0.0 and less than 1.0.

```typescript
var randomNumber = Math.random();
// Generates a random number between 0.0 (inclusive) and 1.0 (exclusive)
```

**`Math.nextUp(num: number): number`**

Returns the floating-point value adjacent to the argument `num` in the direction of positive infinity.

```typescript
Math.nextUp(1); // returns 1.0000001 
```

**`Math.nextDown(num: number): number`**

Returns the floating-point value adjacent to the argument `num` in the direction of negative infinity.

```typescript
Math.nextDown(1); // returns 0.9999999
```

**`Math.sqrt(num: number): double`**

Returns the square root of a number in a double.

```typescript
var number = 16;
var squareRoot = Math.sqrt(number); // squareRoot is now 4.0
```


---

# 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://docs.b2winsuite.com/5.6/scripting/utilities/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.
