---
title: float() function
description: float() converts a value to a float type.
url: https://docs.influxdata.com/flux/v0/stdlib/universe/float/
estimated_tokens: 982
product: Flux
version: v0
publisher: InfluxData
canonical: https://docs.influxdata.com/flux/v0/stdlib/universe/float/
date: '2024-04-08T16:01:02-06:00'
lastmod: '2024-04-08T16:01:02-06:00'
---

* Flux 0.7.0+

InfluxDB support

`float()` converts a value to a float type.

##### Function type signature

```js
(v: A) => float
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### v

(Required)
Value to convert.

## Examples

* [Convert a string to a float](#convert-a-string-to-a-float)
* [Convert a scientific notation string to a float](#convert-a-scientific-notation-string-to-a-float)
* [Convert an integer to a float](#convert-an-integer-to-a-float)
* [Convert all values in a column to floats](#convert-all-values-in-a-column-to-floats)

### Convert a string to a float

```
float(v: "3.14")// Returns 3.14

```

### Convert a scientific notation string to a float

```
float(v: "1.23e+20")// Returns 1.23e+20 (float)

```

### Convert an integer to a float

```
float(v: "10")// Returns 10.0

```

### Convert all values in a column to floats

If converting the `_value` column to float types, use `toFloat()`.
If converting columns other than `_value`, use `map()` to iterate over each
row and `float()` to convert a column value to a float type.

```js
data
    |> map(fn: (r) => ({r with exampleCol: float(v: r.exampleCol)}))
```

[](#view-example-input-and-output)

View example input and output

#### Input data

|       \_time       |exampleCol|\*tag|
|--------------------|----------|-----|
|2021-01-01T00:00:00Z|   \-2    | t1  |
|2021-01-01T00:00:10Z|    10    | t1  |
|2021-01-01T00:00:20Z|    7     | t1  |
|2021-01-01T00:00:30Z|    17    | t1  |
|2021-01-01T00:00:40Z|    15    | t1  |
|2021-01-01T00:00:50Z|    4     | t1  |

|       \_time       |exampleCol|\*tag|
|--------------------|----------|-----|
|2021-01-01T00:00:00Z|    19    | t2  |
|2021-01-01T00:00:10Z|    4     | t2  |
|2021-01-01T00:00:20Z|   \-3    | t2  |
|2021-01-01T00:00:30Z|    19    | t2  |
|2021-01-01T00:00:40Z|    13    | t2  |
|2021-01-01T00:00:50Z|    1     | t2  |

#### Output data

|       \_time       |exampleCol|\*tag|
|--------------------|----------|-----|
|2021-01-01T00:00:00Z|   \-2    | t1  |
|2021-01-01T00:00:10Z|    10    | t1  |
|2021-01-01T00:00:20Z|    7     | t1  |
|2021-01-01T00:00:30Z|    17    | t1  |
|2021-01-01T00:00:40Z|    15    | t1  |
|2021-01-01T00:00:50Z|    4     | t1  |

|       \_time       |exampleCol|\*tag|
|--------------------|----------|-----|
|2021-01-01T00:00:00Z|    19    | t2  |
|2021-01-01T00:00:10Z|    4     | t2  |
|2021-01-01T00:00:20Z|   \-3    | t2  |
|2021-01-01T00:00:30Z|    19    | t2  |
|2021-01-01T00:00:40Z|    13    | t2  |
|2021-01-01T00:00:50Z|    1     | t2  |

#### Related

* [Work with floats](/flux/v0/data-types/basic/float/)
* [toFloat() function](/flux/v0/stdlib/universe/tofloat/)

[type-conversions](/flux/v0/tags/type-conversions/)
| _time | exampleCol | *tag |
| --- | --- | --- |
| _time | exampleCol | *tag |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | 10 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 17 | t1 |
| 2021-01-01T00:00:40Z | 15 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |

| _time | exampleCol | *tag |
| --- | --- | --- |
| _time | exampleCol | *tag |
| 2021-01-01T00:00:00Z | 19 | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |

| _time | exampleCol | *tag |
| --- | --- | --- |
| _time | exampleCol | *tag |
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | 10 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 17 | t1 |
| 2021-01-01T00:00:40Z | 15 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |

| _time | exampleCol | *tag |
| --- | --- | --- |
| _time | exampleCol | *tag |
| 2021-01-01T00:00:00Z | 19 | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 13 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
