Questions tagged [math]

93 questions
2
votes
2 answers

Why DS-Math add WAD/2 or RAY/2 in WAD,RAY multiply function

//rounds to zero if x*y < WAD / 2 function wmul(uint x, uint y) internal pure returns (uint z) { z = add(mul(x, y), WAD / 2) / WAD; } //rounds to zero if x*y < WAD / 2 function rmul(uint x, uint y) internal pure returns (uint z) { z =…
0
votes
0 answers

How do I implement RSA in solidity for large numbers?

I want to implement RSA in solidity, but for large values, it gives back an overflow error and it does not work correctly. How do I fix it?