Explorar o código

Added Math.sol docstrings. (#1423)

Nicolás Venturo %!s(int64=7) %!d(string=hai) anos
pai
achega
a3e312d133
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      contracts/math/Math.sol

+ 11 - 0
contracts/math/Math.sol

@@ -5,14 +5,25 @@ pragma solidity ^0.4.24;
  * @dev Assorted math operations
  */
 library Math {
+  /**
+  * @dev Returns the largest of two numbers.
+  */
   function max(uint256 a, uint256 b) internal pure returns (uint256) {
     return a >= b ? a : b;
   }
 
+  /**
+  * @dev Returns the smallest of two numbers.
+  */
   function min(uint256 a, uint256 b) internal pure returns (uint256) {
     return a < b ? a : b;
   }
 
+  /**
+  * @dev Calculates the average of two numbers. Since these are integers,
+  * averages of an even and odd number cannot be represented, and will be
+  * rounded down.
+  */
   function average(uint256 a, uint256 b) internal pure returns (uint256) {
     // (a + b) / 2 can overflow, so we distribute
     return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);