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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.firebolt.io/feedback

```json
{
  "path": "/reference-sql/functions-reference/numeric/ln",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

> Reference material for LN function

# LN

export const QueryWindow = ({content}) => {
  const {sql, result} = content;
  const [inited, setInited] = useState(false);
  const buttonRef = useRef(null);
  useEffect(() => {
    if (!inited && buttonRef.current) {
      runQuery(buttonRef.current, true);
      setInited(true);
    }
  }, []);
  return <div className="query-window">
      <div className="query-toolbar">
        <button className="run-button" onClick={ev => runQuery(ev.target)} ref={buttonRef}>Run Query</button>
        <span className="window-title">Interactive SQL Playground 🔥</span>
      </div>
      <div className="query-content">
        <pre><code className="firebolt-sql language-sql" contentEditable="true" spellCheck="false" data-original-query={sql}>{sql}</code></pre>
        <script type="application/json" className="fallback-result" style={{
    display: "none"
  }}>{JSON.stringify(result)}</script>
        <div className="server-unavailable-banner query-window-hidden">
          The Firebolt playground server is currently unavailable. Using precomputed query results.
        </div>
        <div className="query-results"></div>
      </div>
    </div>;
};

Returns natural (base e) logarithm of a numerical expression.
The value for which `ln` is computed needs to be larger than 0, otherwise an error is returned.
You can use the function [LOG](/reference-sql/functions-reference/numeric/log) if you want to provide a different base.

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
LN(<value>);
```

## Parameters

| Parameter | Description                                           | Supported input types |
| :-------- | :---------------------------------------------------- | :-------------------- |
| `<value>` | The value for which to compute the natural logarithm. | `DOUBLE PRECISION`    |

## Return Type

`DOUBLE PRECISION`

## Examples

The following example computes the natural logarithm of 1.0:

<QueryWindow
  content={{
"sql": "SELECT LN(1.0);",
"result": {
"data": [
  [
    0
  ]
],
"meta": [
  {
    "name": "?column?",
    "type": "double"
  }
],
"query": {
  "query_id": "b045916c-e807-4750-b3fe-beca9fb59051",
  "query_label": null,
  "request_id": "5c7de074-9997-4870-b908-187d9b1c663a"
},
"rows": 1,
"statistics": {
  "bytes_read": 1,
  "elapsed": 0.006621,
  "rows_read": 1,
  "scanned_bytes_cache": 0,
  "scanned_bytes_storage": 0,
  "time_before_execution": 0.000299106,
  "time_to_execute": 8.5165e-05
}
}
}}
/>

The following example returns the natural logarithm close to e:

<QueryWindow
  content={{
"sql": "SELECT LN(2.7182818284590452353);",
"result": {
"data": [
  [
    1
  ]
],
"meta": [
  {
    "name": "?column?",
    "type": "double"
  }
],
"query": {
  "query_id": "1a80df75-a500-4395-9fb4-28b2a9921add",
  "query_label": null,
  "request_id": "e863b67b-a702-4357-a3e0-b08fa3864f48"
},
"rows": 1,
"statistics": {
  "bytes_read": 1,
  "elapsed": 0.007145,
  "rows_read": 1,
  "scanned_bytes_cache": 0,
  "scanned_bytes_storage": 0,
  "time_before_execution": 0.000252791,
  "time_to_execute": 8.6742e-05
}
}
}}
/>

The natural logarithm can only be computed for values that are larger than 0. All the following functions return an error:

<QueryWindow
  content={{
"sql": "SELECT LN(0.0);\n-- SELECT LN(-1.0);\n-- SELECT LN('-Inf');",
"result": {
"errors": [
  {
    "description": "Line 1, Column 8: Cannot take the logarithm of 0. The argument needs to be larger than 0.\nSELECT LN(0.0);\n       ^",
    "location": {
      "failing_line": 1,
      "start_offset": 8
    }
  }
],
"query": {
  "query_id": "438ae5d4-4cf2-4933-b5d4-bfd4d73de705",
  "query_label": null,
  "request_id": "fd1ea90a-0ee4-4f86-8853-8a7f63d312d9"
},
"statistics": {
  "elapsed": 0.000656987
}
}
}}
/>
