---
title: "log2"
excerpt: "Computes the base 2 logarithm of the number."
layout: manual
---

Computes the base 2 logarithm of the number.



```js
log2(num: number) -> number
```

### Tags

* `math`

### Examples

```js
const exampleSketch = startSketchOn("XZ")
  |> startProfileAt([0, 0], %)
  |> line([log2(100), 0], %)
  |> line([5, 8], %)
  |> line([-10, 0], %)
  |> close(%)

const example = extrude(5, exampleSketch)
```

![Rendered example of log2 0](data:image/png;base64,[encoded data, 135608 characters])

### Arguments

* `num`: `number` (REQUIRED)

### Returns

`number`



