I have written this below simple solidity code to calculate some numbers. But, ethereum blockchain gives different outputs on each function. Is there anything wrong on my code or it's ethereum blockchain issue?
My solidity code:
pragma solidity ^0.4.24;
contract Calculate {
uint balance = 50000000000000000000;
function done() public pure returns (uint) {
return (50000000000000000000 / 3000) * 3000;
}
function fail() public view returns (uint) {
return (balance / 3000) * 3000;
}
}
Output:
done() function returns 50000000000000000000
fail() function returns 49999999999999998000
Please checkout live example here: https://ropsten.etherscan.io/address/0xf45a2a66be9835fdc9e1065875808616cb8e752e#readContract