1 vote

How multiplication and division works in solidity?

When it comes to the order of precedence of operators, according to the Solidity documentation, multiplication, division and modulo are evaluated before addition and substraction. On the other hand, ...
Gabriel Stoica's user avatar
1 vote
Accepted

How to determine whether code is running in a JS VM such as Remix, as opposed to ETH mainnet?

One way is to check block.number. In the Remix VM environment, it will increment rapidly with each transaction or block mined. However, on the ETH mainnet or testnet, it will progress much more slowly,...
SYED ASAD KAZMI's user avatar
1 vote

How to prevent division before multiplication precision loss?

If you want to keep the last 6 decimals, then it's not actually downscaling from 24-decimal format to 18-decimal format, instead it's keeping it the same. And that, you can simply achieve by getting ...
SYED ASAD KAZMI's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible