---
title: Std.Float
---

Floating-point conversion and arithmetic operations.

## Functions

### trunc

```saga
fun trunc : (x: Float) -> Int
```

Truncates a float towards zero, returning an integer.

### round

```saga
fun round : (x: Float) -> Int
```

Rounds a float to the nearest integer.

### floor

```saga
fun floor : (x: Float) -> Int
```

Rounds a float down to the nearest integer.

### ceil

```saga
fun ceil : (x: Float) -> Int
```

Rounds a float up to the nearest integer.

### parse

```saga
fun parse : (s: String) -> Maybe Float
```

Parses a string as a float. Returns Nothing if the string is not a valid float.

### add

```saga
fun add : Float -> Float -> Float
```

Adds two floats.

### sub

```saga
fun sub : Float -> Float -> Float
```

Subtracts the second float from the first.

### mul

```saga
fun mul : Float -> Float -> Float
```

Multiplies two floats.

### div

```saga
fun div : Float -> Float -> Float
```

Divides the first float by the second.

### mod

```saga
fun mod : Float -> Float -> Float
```

Returns the remainder of dividing the first float by the second.

