Solidity根据精度来表示浮点数
https://stackoverflow.com/questions/42738640/division-in-ethereum-solidity/42739843
pragma solidity ^0.4.6; contract Divide { function percent(uint numerator, uint denominator, uint precision) public constant returns(uint quotient) { // caution, check safe-to-multiply here uint _numerator = numerator * 10 ** (precision+1); // with rounding of last digit uint _quotient = ((_numerator / denominator) + 5) / 10; return ( _quotient); } }
1.001^365=1.44......life is a project
原创文章,转载请注明出处!