Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fnumber%2Fsqrt.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fnumber%2Fsqrt.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `sqrt`

## Description

Returns the square root of a number.

Note

This is the inverse of `power(number, 2)`.

## Syntax

Like many functions in DataPrime, `sqrt` supports<!-- --> [two notations](https://coralogix.com/docs/docs/dataprime/language-reference/functions-reference/.md),<!-- --> **function** and **method**. These interchangeable forms allow flexibility in how you structure expressions.

* Function notation
* Method notation

```
sqrt(number: number): number
```

```
(number: number).sqrt(): number
```

## Arguments

| Name     | Type     | Required | Description                             |
| -------- | -------- | -------- | --------------------------------------- |
| `number` | `number` | **true** | The value to compute the square root of |

## Example

**Use case: Compute rate of return over 2 years**

Calculate the rate of return for an asset purchase and sale by taking the square root of the price ratio and subtracting 1.

### Example data

```
{

    "buyer": "Chris",

    "asset": "DataDog",

    "bought_at_price": 100,

    "sold_at_price": 10

}
```

### Example query

* Function notation
* Method notation

```
create ror from (sqrt(sold_at_price / bought_at_price) - 1)
```

```
create ror from ((sold_at_price / bought_at_price).sqrt() - 1)
```

### Example output

```
{

    "buyer": "Chris",

    "asset": "DataDog",

    "bought_at_price": 100,

    "sold_at_price": 10,

    "ror": -0.683772233983162

}
```
