# No method named "pow" found for type "u256"

**URL:** <https://forum.fuel.network/t/no-method-named-pow-found-for-type-u256/5154>\
**Category:** Sway\
**Created:** [April 22, 2024, 1:06pm UTC](https://forum.fuel.network/t/no-method-named-pow-found-for-type-u256/5154 "2024-04-22T13:06:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cctdaniel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/cctdaniel/32/2762_2.png) [@cctdaniel](https://forum.fuel.network/u/cctdaniel)\
**Post date:** [April 22, 2024, 1:06pm UTC](https://forum.fuel.network/t/no-method-named-pow-found-for-type-u256/5154/1 "2024-04-22T13:06:24Z")

</div>

Trying to do this: `new_fee: val.as_u256() * 10.as_u256() ** expo.as_u256()` but getting an error: `No method named "pow" found for type "u256"`, is `pow` not supported for `u256`? or am I using the wrong syntax?

---

<div class="post-metadata">

**Author:** ![cctdaniel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/cctdaniel/32/2762_2.png) [@cctdaniel](https://forum.fuel.network/u/cctdaniel)\
**Post date:** [April 22, 2024, 1:13pm UTC](https://forum.fuel.network/t/no-method-named-pow-found-for-type-u256/5154/2 "2024-04-22T13:13:50Z")

</div>

I’ve also tried variants like:

- `val.as_u256() * 10.as_u256().pow(expo.as_u256())`
- `val.as_u256() * u256::from(10).pow(expo.as_u256())`  
and they all don’t work

---

<div class="post-metadata">

**Author:** ![calldelegation](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/calldelegation/32/1484_2.png) [@calldelegation](https://forum.fuel.network/u/calldelegation)\
**Post date:** [April 22, 2024, 2:57pm UTC](https://forum.fuel.network/t/no-method-named-pow-found-for-type-u256/5154/3 "2024-04-22T14:57:17Z")

</div>

Since `u256` is special in the sense that they cannot fit into the primative 64 bit registers they are treated slightly differently.

Read more here:  
[https://fuellabs.github.io/sway/v0.54.0/book/reference/solidity\_differences.html?highlight=word%20siz#word-size](https://fuellabs.github.io/sway/v0.54.0/book/reference/solidity_differences.html?highlight=word%20siz#word-size)

However using the power function, logarithm, square roots they all depend on the math library inside the standard library like so:

> <https://github.com/FuelLabs/sway/blob/master/sway-lib-std/src/math.sw#L72-%23L99>

---

<div class="post-metadata">

**Author:** ![cctdaniel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/cctdaniel/32/2762_2.png) [@cctdaniel](https://forum.fuel.network/u/cctdaniel)\
**Post date:** [April 22, 2024, 3:19pm UTC](https://forum.fuel.network/t/no-method-named-pow-found-for-type-u256/5154/4 "2024-04-22T15:19:31Z")

</div>

thanks for the context! managed to get it working by importing  
`use std::math::*;`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/5/57d5a345cc15a64b636e0d56e042857f8a0e80b1.png) [@system](https://forum.fuel.network/u/system)\
**Post date:** [May 13, 2024, 11:19am UTC](https://forum.fuel.network/t/no-method-named-pow-found-for-type-u256/5154/5 "2024-05-13T11:19:51Z")

</div>

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