1 | <?php |
||
19 | final class Math |
||
20 | { |
||
21 | /** |
||
22 | * @param \GMP $first |
||
23 | * @param \GMP $other |
||
24 | * |
||
25 | * @return int |
||
26 | */ |
||
27 | public static function cmp(\GMP $first, \GMP $other): int |
||
31 | |||
32 | /** |
||
33 | * @param \GMP $first |
||
34 | * @param \GMP $other |
||
35 | * |
||
36 | * @return bool |
||
37 | */ |
||
38 | public static function equals(\GMP $first, \GMP $other): bool |
||
42 | |||
43 | /** |
||
44 | * @param \GMP $number |
||
45 | * @param \GMP $modulus |
||
46 | * |
||
47 | * @return \GMP |
||
48 | */ |
||
49 | public static function mod(\GMP $number, \GMP $modulus): \GMP |
||
53 | |||
54 | /** |
||
55 | * @param \GMP $augend |
||
56 | * @param \GMP $addend |
||
57 | * |
||
58 | * @return \GMP |
||
59 | */ |
||
60 | public static function add(\GMP $augend, \GMP $addend): \GMP |
||
64 | |||
65 | /** |
||
66 | * @param \GMP $minuend |
||
67 | * @param \GMP $subtrahend |
||
68 | * |
||
69 | * @return \GMP |
||
70 | */ |
||
71 | public static function sub(\GMP $minuend, \GMP $subtrahend): \GMP |
||
75 | |||
76 | /** |
||
77 | * @param \GMP $multiplier |
||
78 | * @param \GMP $multiplicand |
||
79 | * |
||
80 | * @return \GMP |
||
81 | */ |
||
82 | public static function mul(\GMP $multiplier, \GMP $multiplicand): \GMP |
||
86 | |||
87 | /** |
||
88 | * @param \GMP $base |
||
89 | * @param int $exponent |
||
90 | * |
||
91 | * @return \GMP |
||
92 | */ |
||
93 | public static function pow(\GMP $base, int $exponent): \GMP |
||
97 | |||
98 | /** |
||
99 | * @param \GMP $first |
||
100 | * @param \GMP $other |
||
101 | * |
||
102 | * @return \GMP |
||
103 | */ |
||
104 | public static function bitwiseAnd(\GMP $first, \GMP $other): \GMP |
||
108 | |||
109 | /** |
||
110 | * @param \GMP $first |
||
111 | * @param \GMP $other |
||
112 | * |
||
113 | * @return \GMP |
||
114 | */ |
||
115 | public static function bitwiseXor(\GMP $first, \GMP $other): \GMP |
||
119 | |||
120 | /** |
||
121 | * @param \GMP $value |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | public static function toString(\GMP $value): string |
||
129 | |||
130 | /** |
||
131 | * @param \GMP $a |
||
132 | * @param \GMP $m |
||
133 | * |
||
134 | * @return \GMP |
||
135 | */ |
||
136 | public static function inverseMod(\GMP $a, \GMP $m): \GMP |
||
140 | |||
141 | /** |
||
142 | * @param string $number |
||
143 | * @param int $from |
||
144 | * @param int $to |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | public static function baseConvert(string $number, int $from, int $to): string |
||
152 | |||
153 | /** |
||
154 | * @param \GMP $number |
||
155 | * @param int $positions |
||
156 | * |
||
157 | * @return \GMP |
||
158 | */ |
||
159 | public static function rightShift(\GMP $number, int $positions): \GMP |
||
163 | |||
164 | /** |
||
165 | * @param string $s |
||
166 | * |
||
167 | * @return \GMP |
||
168 | */ |
||
169 | public static function stringToInt(string $s): \GMP |
||
180 | } |
||
181 |