> For the complete documentation index, see [llms.txt](https://augustus-pash.gitbook.io/wasm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://augustus-pash.gitbook.io/wasm/maths-algorithms/map.md).

# Map

Takes x and scales it from one range to another range.

```javascript
(module
  (func (export "map") (param $v f32) (param $min1 f32) (param $max1 f32) (param $min2 f32) (param $max2 f32) (result f32)

    (f32.add 
      (get_local $min2)
      (f32.div 
        (f32.mul 
          (f32.sub (get_local $v) (get_local $min1))
          (f32.sub (get_local $max2) (get_local $min1))
        )
         (f32.sub (get_local $max1) (get_local $min1))
      )
    )
  )
)
```
