---
title: Std.Math
---

Mathematical constants and functions for floating-point arithmetic.

## Functions

### pi

```saga
fun pi : Float
```

The ratio of a circle's circumference to its diameter.

### e

```saga
fun e : Float
```

Euler's number, the base of the natural logarithm.

### tau

```saga
fun tau : Float
```

Two times pi. The ratio of a circle's circumference to its radius.

### sqrt

```saga
fun sqrt : Float -> Float
```

Square root. Panics on negative input.

### pow

```saga
fun pow : Float -> Float -> Float
```

Raises the first argument to the power of the second.

### log

```saga
fun log : Float -> Float
```

Natural logarithm (base e). Panics on non-positive input.

### log2

```saga
fun log2 : Float -> Float
```

Base-2 logarithm. Panics on non-positive input.

### log10

```saga
fun log10 : Float -> Float
```

Base-10 logarithm. Panics on non-positive input.

### asin

```saga
fun asin : Float -> Float
```

Arcsine in radians. Input must be in [-1, 1].

### acos

```saga
fun acos : Float -> Float
```

Arccosine in radians. Input must be in [-1, 1].

### atan2

```saga
fun atan2 : Float -> Float -> Float
```

Two-argument arctangent in radians.

### exp

```saga
fun exp : Float -> Float
```

Exponential function (e raised to the given power).

### sin

```saga
fun sin : Float -> Float
```

Sine in radians.

### cos

```saga
fun cos : Float -> Float
```

Cosine in radians.

### tan

```saga
fun tan : Float -> Float
```

Tangent in radians.

### atan

```saga
fun atan : Float -> Float
```

Arctangent in radians.

### abs

```saga
fun abs : Float -> Float
```

Returns the absolute value.

### min

```saga
fun min : Float -> Float -> Float
```

Returns the smaller of two floats.

### max

```saga
fun max : Float -> Float -> Float
```

Returns the larger of two floats.

### clamp

```saga
fun clamp : Float -> Float -> Float -> Float
```

Clamps a value to the range [low, high].

### sign

```saga
fun sign : Float -> Float
```

Returns -1.0 for negative, 0.0 for zero, 1.0 for positive.

### deg_to_rad

```saga
fun deg_to_rad : Float -> Float
```

Converts degrees to radians.

### rad_to_deg

```saga
fun rad_to_deg : Float -> Float
```

Converts radians to degrees.

