# Why no math.pow()

**URL:** <https://forum.modular.com/t/why-no-math-pow/615>\
**Category:** Mojo\
**Tags:** discussion, feature-request, 24\_6\
**Created:** [February 22, 2025, 10:52pm UTC](https://forum.modular.com/t/why-no-math-pow/615 "2025-02-22T22:52:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![notnot](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@notnot](https://forum.modular.com/u/notnot)\
**Post date:** [February 22, 2025, 10:52pm UTC](https://forum.modular.com/t/why-no-math-pow/615/1 "2025-02-22T22:52:55Z")

</div>

Why is there no `math.pow()` function?

---

<div class="post-metadata">

**Author:** ![TilliFe](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/tillife/32/419_2.png) [@TilliFe](https://forum.modular.com/u/TilliFe)\
**Post date:** [February 23, 2025, 1:12pm UTC](https://forum.modular.com/t/why-no-math-pow/615/2 "2025-02-23T13:12:10Z")

</div>

The pow function should be uses as an overloaded method of the SIMD struct. However, if you really need a dedicated function for that, here is an unrecommended way to do so:

```mojo
from builtin import simd

fn main() raises:
    var base = SIMD[DType.float32, 4](-3.0, -2.0, 2.0, 3.0)
    var exp = SIMD[DType.float32, 4](3.0, 3.0, 3.0, 3.0)
    var res = simd._powf(base, exp)
    print(res) # SIMD[DType.float32, 4](-27.0, -8.0, 8.0, 27.0)

```

---

<div class="post-metadata">

**Author:** ![notnot](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@notnot](https://forum.modular.com/u/notnot)\
**Post date:** [February 23, 2025, 11:10pm UTC](https://forum.modular.com/t/why-no-math-pow/615/3 "2025-02-23T23:10:51Z")

</div>

Where is the `simd._powf()` function documented?

Ah, now i see there is a `builtin`/`math.pow()` function. For the sake of completeness, what about adding a similar function to the `math` package as well?

---

<div class="post-metadata">

**Author:** ![sora](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@sora](https://forum.modular.com/u/sora)\
**Post date:** [March 15, 2025, 1:04pm UTC](https://forum.modular.com/t/why-no-math-pow/615/4 "2025-03-15T13:04:09Z")

</div>

We do have a free function `pow` though.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/2751e0fbdc595a99718b216730957e9db4448cfd.jpeg) [@system](https://forum.modular.com/u/system)\
**Post date:** [September 11, 2025, 1:04pm UTC](https://forum.modular.com/t/why-no-math-pow/615/5 "2025-09-11T13:04:53Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
