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

# LN

> Returns the natural logarithm of a number.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

DOUBLE returns NULL for NULL input or a non-finite logarithm result (including zero, negative input, NaN or positive infinity). FLOAT input preserves NULL but retains non-finite computed results.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
ln(value)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE or DECIMAL(p, s) | Yes | The number whose natural logarithm is returned. For DECIMAL(p, s), p is precision (total digits) and s is scale (digits after the decimal point). |

## Returns

* Type: DOUBLE; FLOAT when the input is evaluated as FLOAT
* Possible values: Finite real logarithms for positive finite DOUBLE input.
* NULL behavior: DOUBLE returns NULL for NULL input or a non-finite logarithm result (including zero, negative input, NaN or positive infinity). FLOAT input preserves NULL but retains non-finite computed results.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | No |

* Approximation bound: No fixed maximum error is guaranteed.

## Usage notes

* INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.
* Exact result: Floating-point computation can round the mathematical result.

## Examples

### Value and NULL input

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT ln(CAST(1 AS DOUBLE)) AS "value", ln(CAST(0 AS DOUBLE)) AS boundary, ln(CAST(NULL AS DOUBLE)) AS null_value;
```

| value | boundary | null\_value |
| - | - | - |
| 0 | NULL | NULL |

### Values below and above one

Results are rounded to six decimal places for display.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT round(ln(CAST(0.5 AS DOUBLE)), 6) AS below_one, round(ln(CAST(2 AS DOUBLE)), 6) AS above_one;
```

| below\_one | above\_one |
| - | - |
| -0.693147 | 0.693147 |

## Limitations

* DOUBLE results that are NaN or infinite become NULL. FLOAT calculations retain NaN and infinity.
* Query tools may report DOUBLE even when the result is FLOAT. The reported type does not increase the result’s precision.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.