> ## Documentation Index
> Fetch the complete documentation index at: https://docs.honeycomb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Type Conversion in Calculated Fields

> Type conversion functions available for calculated field formulas in Honeycomb, including INT, FLOAT, STR, and BOOL casts.

Type cast functions convert one data type into another.

## `INT`

The expression T(v) converts the value v to the type T.

The `INT(arg)`

Casts the argument to an integer, truncating the value if necessary.
The argument is first coerced to a float if possible. Non-numeric values return 0.

```ruby theme={}
# Usage: INT(arg1)
# Examples
INT($price_dollars)
INT(DIV($seconds, 3600))
```

## `FLOAT`

Casts the argument to a float.
Non-numeric values return 0.0.

```ruby theme={}
# Usage: FLOAT(arg1)
# Examples
FLOAT($price_dollars) # For example, 300.5
FLOAT("3.1415926535") # 3.1415926535
```

## `BOOL`

Casts the argument to a bool.
Evaluates to `true` if the argument is truthy:

| source type | `value`             | `BOOL($value)` |
| ----------- | ------------------- | -------------- |
| int         | `0`                 | `false`        |
| int         | **(anything else)** | `true`         |
| float       | `0.0`               | `false`        |
| float       | **(anything else)** | `true`         |
| string      | `"true"`            | `true`         |
| string      | **(anything else)** | `false`        |
| bool        | `true`              | `true`         |
| bool        | `false`             | `false`        |
|             | `nil`               | `false`        |

```ruby theme={}
# Usage: BOOL(arg1)
# Examples
BOOL($price_dollars) # For example, true
BOOL("")             # false
BOOL(true)           # true
```

## `STRING`

Casts the argument to a string.
Empty arguments are converted to `""`.

```ruby theme={}
# Usage: STRING(arg1)
# Examples
STRING($price_dollars) # "300.5", for example
STRING(true)           # "true"
STRING($empty_column)  # ""
```
