← All changes
|
includes/sdk/google/ramsey/uuid/src/Math/RoundingMode.php
+36
-55
1.2.10
→
1.4.2
View file →
| @@ -25,110 +25,91 @@ | ||
| 25 | 25 | * |
| 26 | 26 | * @link https://github.com/brick/math brick/math at GitHub |
| 27 | 27 | */ |
| 28 | 28 | declare (strict_types=1); |
| 29 | -namespace Dudlewebs\WPMCS\Ramsey\Uuid\Math; | |
| 29 | +namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Math; | |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Specifies a rounding behavior for numerical operations capable of discarding | |
| 33 | - * precision. | |
| 32 | + * Specifies a rounding behavior for numerical operations capable of discarding precision. | |
| 34 | 33 | * |
| 35 | - * Each rounding mode indicates how the least significant returned digit of a | |
| 36 | - * rounded result is to be calculated. If fewer digits are returned than the | |
| 37 | - * digits needed to represent the exact numerical result, the discarded digits | |
| 38 | - * will be referred to as the discarded fraction regardless the digits' | |
| 39 | - * contribution to the value of the number. In other words, considered as a | |
| 40 | - * numerical value, the discarded fraction could have an absolute value greater | |
| 41 | - * than one. | |
| 34 | + * Each rounding mode indicates how the least significant returned digit of a rounded result is to be calculated. If | |
| 35 | + * fewer digits are returned than the digits needed to represent the exact numerical result, the discarded digits will | |
| 36 | + * be referred to as the discarded fraction regardless of the digits' contribution to the value of the number. In other | |
| 37 | + * words, considered as a numerical value, the discarded fraction could have an absolute value greater than one. | |
| 42 | 38 | */ |
| 43 | 39 | final class RoundingMode |
| 44 | 40 | { |
| 45 | 41 | /** |
| 46 | - * Private constructor. This class is not instantiable. | |
| 47 | - * | |
| 48 | - * @codeCoverageIgnore | |
| 42 | + * Asserts that the requested operation has an exact result; hence no rounding is necessary. | |
| 49 | 43 | */ |
| 50 | - private function __construct() | |
| 51 | - { | |
| 52 | - } | |
| 53 | - /** | |
| 54 | - * Asserts that the requested operation has an exact result, hence no | |
| 55 | - * rounding is necessary. | |
| 56 | - */ | |
| 57 | 44 | public const UNNECESSARY = 0; |
| 58 | 45 | /** |
| 59 | 46 | * Rounds away from zero. |
| 60 | 47 | * |
| 61 | - * Always increments the digit prior to a nonzero discarded fraction. | |
| 62 | - * Note that this rounding mode never decreases the magnitude of the | |
| 63 | - * calculated value. | |
| 48 | + * Always increments the digit prior to a nonzero discarded fraction. Note that this rounding mode never decreases | |
| 49 | + * the magnitude of the calculated value. | |
| 64 | 50 | */ |
| 65 | 51 | public const UP = 1; |
| 66 | 52 | /** |
| 67 | 53 | * Rounds towards zero. |
| 68 | 54 | * |
| 69 | - * Never increments the digit prior to a discarded fraction (i.e., | |
| 70 | - * truncates). Note that this rounding mode never increases the magnitude of | |
| 71 | - * the calculated value. | |
| 55 | + * Never increments the digit prior to a discarded fraction (i.e., truncates). Note that this rounding mode never | |
| 56 | + * increases the magnitude of the calculated value. | |
| 72 | 57 | */ |
| 73 | 58 | public const DOWN = 2; |
| 74 | 59 | /** |
| 75 | 60 | * Rounds towards positive infinity. |
| 76 | 61 | * |
| 77 | - * If the result is positive, behaves as for UP; if negative, behaves as for | |
| 78 | - * DOWN. Note that this rounding mode never decreases the calculated value. | |
| 62 | + * If the result is positive, behaves as for UP; if negative, behaves as for DOWN. Note that this rounding mode | |
| 63 | + * never decreases the calculated value. | |
| 79 | 64 | */ |
| 80 | 65 | public const CEILING = 3; |
| 81 | 66 | /** |
| 82 | 67 | * Rounds towards negative infinity. |
| 83 | 68 | * |
| 84 | - * If the result is positive, behave as for DOWN; if negative, behave as for | |
| 85 | - * UP. Note that this rounding mode never increases the calculated value. | |
| 69 | + * If the result is positive, behave as for DOWN; if negative, behave as for UP. Note that this rounding mode never | |
| 70 | + * increases the calculated value. | |
| 86 | 71 | */ |
| 87 | 72 | public const FLOOR = 4; |
| 88 | 73 | /** |
| 89 | - * Rounds towards "nearest neighbor" unless both neighbors are equidistant, | |
| 90 | - * in which case round up. | |
| 74 | + * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round up. | |
| 91 | 75 | * |
| 92 | - * Behaves as for UP if the discarded fraction is >= 0.5; otherwise, behaves | |
| 93 | - * as for DOWN. Note that this is the rounding mode commonly taught at | |
| 94 | - * school. | |
| 76 | + * Behaves as for UP if the discarded fraction is >= 0.5; otherwise, behaves as for DOWN. Note that this is the | |
| 77 | + * rounding mode commonly taught at school. | |
| 95 | 78 | */ |
| 96 | 79 | public const HALF_UP = 5; |
| 97 | 80 | /** |
| 98 | - * Rounds towards "nearest neighbor" unless both neighbors are equidistant, | |
| 99 | - * in which case round down. | |
| 81 | + * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round down. | |
| 100 | 82 | * |
| 101 | - * Behaves as for UP if the discarded fraction is > 0.5; otherwise, behaves | |
| 102 | - * as for DOWN. | |
| 83 | + * Behaves as for UP if the discarded fraction is > 0.5; otherwise, behaves as for DOWN. | |
| 103 | 84 | */ |
| 104 | 85 | public const HALF_DOWN = 6; |
| 105 | 86 | /** |
| 106 | - * Rounds towards "nearest neighbor" unless both neighbors are equidistant, | |
| 107 | - * in which case round towards positive infinity. | |
| 87 | + * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards positive infinity. | |
| 108 | 88 | * |
| 109 | - * If the result is positive, behaves as for HALF_UP; if negative, behaves | |
| 110 | - * as for HALF_DOWN. | |
| 89 | + * If the result is positive, behaves as for HALF_UP; if negative, behaves as for HALF_DOWN. | |
| 111 | 90 | */ |
| 112 | 91 | public const HALF_CEILING = 7; |
| 113 | 92 | /** |
| 114 | - * Rounds towards "nearest neighbor" unless both neighbors are equidistant, | |
| 115 | - * in which case round towards negative infinity. | |
| 93 | + * Rounds towards "nearest neighbor" unless both neighbors are equidistant, in which case round towards negative infinity. | |
| 116 | 94 | * |
| 117 | - * If the result is positive, behaves as for HALF_DOWN; if negative, behaves | |
| 118 | - * as for HALF_UP. | |
| 95 | + * If the result is positive, behaves as for HALF_DOWN; if negative, behaves as for HALF_UP. | |
| 119 | 96 | */ |
| 120 | 97 | public const HALF_FLOOR = 8; |
| 121 | 98 | /** |
| 122 | - * Rounds towards the "nearest neighbor" unless both neighbors are | |
| 123 | - * equidistant, in which case rounds towards the even neighbor. | |
| 99 | + * Rounds towards the "nearest neighbor" unless both neighbors are equidistant, in which case rounds towards the even neighbor. | |
| 124 | 100 | * |
| 125 | - * Behaves as for HALF_UP if the digit to the left of the discarded fraction | |
| 126 | - * is odd; behaves as for HALF_DOWN if it's even. | |
| 101 | + * Behaves as for HALF_UP if the digit to the left of the discarded fraction is odd; behaves as for HALF_DOWN if it's even. | |
| 127 | 102 | * |
| 128 | - * Note that this is the rounding mode that statistically minimizes | |
| 129 | - * cumulative error when applied repeatedly over a sequence of calculations. | |
| 130 | - * It is sometimes known as "Banker's rounding", and is chiefly used in the | |
| 131 | - * USA. | |
| 103 | + * Note that this is the rounding mode that statistically minimizes cumulative error when applied repeatedly over a | |
| 104 | + * sequence of calculations. It is sometimes known as "Banker's rounding", and is chiefly used in the USA. | |
| 132 | 105 | */ |
| 133 | 106 | public const HALF_EVEN = 9; |
| 107 | + /** | |
| 108 | + * Private constructor. This class is not instantiable. | |
| 109 | + * | |
| 110 | + * @codeCoverageIgnore | |
| 111 | + */ | |
| 112 | + private function __construct() | |
| 113 | + { | |
| 114 | + } | |
| 134 | 115 | } |