# bignumber in solidity - returned values

Let's say that Ethereum solidity returns a number from one of its functions and I get that into Javascript.

Now ,because I write tests in my js application, I have to check if the returned value is equal to some number multiplied by some number.

Basically, let's look at the scenario.

In javascript,

Way 1)

`web3.utils.toBN('100000000000000') * 30`

Way 2)

`web3.utils.toBN('100000000000000') * web3.utils.toBN('30')`

Depending on the above 2 ones, can I use Way 1 ) ? reason is that if I use Way 2, my code just becomes bloated with `toBN` functions all the way.

Neither. You cannot use `*` to multiply two BNs together. For that you should use the `mul` function (https://github.com/indutny/bn.js/#arithmetics)
If what you are actually wanting to do is convert from/to wei/ether you can use `web3.utils.toWei` and `web3.utils.toEther` in combination with `web3.utils.toBN`, e.g., `web3.utils.toBN(web3.utils.toWei("30", "ether"))`.
Note that you can use JavaScript's native `BigInt` for many calculations and comparisons. `BigInt("0x100000000000000") * 30n` is valid JavaScript and will produce a valid BigInt. You'll just need to ensure your target platforms support it (https://caniuse.com/?search=bigint).
• It may return a number, but the maximum value a JavaScript number supports (`Number.MAX_SAFE_INTEGER`) is smaller than what BN supports, so you shouldn't "cast" it to a number (via `* 30`, in this case). You'll end up with precision errors. Example: `(web3.utils.toBN('1000000000000000') * 30 + 1) === web3.utils.toBN('1000000000000000') * 30 // true` See developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… for details Dec 8 '20 at 22:18