# float

Casts an expression to a float.

```tql
float(x:any) -> float
```

## Description

The `float` function converts the given value `x` to a floating-point value.

## Examples

### Cast an integer to a float

```tql
from {x: float(42)}
```

```tql
{x: 42.0}
```

### Cast a string to a float

```tql
from {x: float("4.2")}
```

```tql
{x: 4.2}
```

## See Also

* [`int`](https://preview.docs.tenzir.com/375/375/reference/functions/int.md)
* [`ip`](https://preview.docs.tenzir.com/375/375/reference/functions/ip.md)
* [`string`](https://preview.docs.tenzir.com/375/375/reference/functions/string.md)
* [`subnet`](https://preview.docs.tenzir.com/375/375/reference/functions/subnet.md)
* [`time`](https://preview.docs.tenzir.com/375/375/reference/functions/time.md)
* [`uint`](https://preview.docs.tenzir.com/375/375/reference/functions/uint.md)
* [Transform values](https://preview.docs.tenzir.com/375/375/guides/transformation/transform-values.md)