1 | <?php |
||
14 | final class GmpMath |
||
15 | { |
||
16 | /** |
||
17 | * @param \GMP $first |
||
18 | * @param \GMP $other |
||
19 | * |
||
20 | * @return int |
||
21 | */ |
||
22 | public static function cmp(\GMP $first, \GMP $other): int |
||
26 | |||
27 | /** |
||
28 | * @param \GMP $first |
||
29 | * @param \GMP $other |
||
30 | * |
||
31 | * @return bool |
||
32 | */ |
||
33 | public static function equals(\GMP $first, \GMP $other): bool |
||
37 | |||
38 | /** |
||
39 | * @param \GMP $number |
||
40 | * @param \GMP $modulus |
||
41 | * |
||
42 | * @return \GMP |
||
43 | */ |
||
44 | public static function mod(\GMP $number, \GMP $modulus): \GMP |
||
48 | |||
49 | /** |
||
50 | * @param \GMP $augend |
||
51 | * @param \GMP $addend |
||
52 | * |
||
53 | * @return \GMP |
||
54 | */ |
||
55 | public static function add(\GMP $augend, \GMP $addend): \GMP |
||
59 | |||
60 | /** |
||
61 | * @param \GMP $minuend |
||
62 | * @param \GMP $subtrahend |
||
63 | * |
||
64 | * @return \GMP |
||
65 | */ |
||
66 | public static function sub(\GMP $minuend, \GMP $subtrahend): \GMP |
||
70 | |||
71 | /** |
||
72 | * @param \GMP $multiplier |
||
73 | * @param \GMP $multiplicand |
||
74 | * |
||
75 | * @return \GMP |
||
76 | */ |
||
77 | public static function mul(\GMP $multiplier, \GMP $multiplicand): \GMP |
||
81 | |||
82 | /** |
||
83 | * @param \GMP $base |
||
84 | * @param int $exponent |
||
85 | * |
||
86 | * @return \GMP |
||
87 | */ |
||
88 | public static function pow(\GMP $base, int $exponent): \GMP |
||
92 | |||
93 | /** |
||
94 | * @param \GMP $first |
||
95 | * @param \GMP $other |
||
96 | * |
||
97 | * @return \GMP |
||
98 | */ |
||
99 | public static function bitwiseAnd(\GMP $first, \GMP $other): \GMP |
||
103 | |||
104 | /** |
||
105 | * @param \GMP $first |
||
106 | * @param \GMP $other |
||
107 | * |
||
108 | * @return \GMP |
||
109 | */ |
||
110 | public static function bitwiseXor(\GMP $first, \GMP $other): \GMP |
||
114 | |||
115 | /** |
||
116 | * @param \GMP $value |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | public static function toString(\GMP $value): string |
||
124 | |||
125 | /** |
||
126 | * @param \GMP $a |
||
127 | * @param \GMP $m |
||
128 | * |
||
129 | * @return \GMP |
||
130 | */ |
||
131 | public static function inverseMod(\GMP $a, \GMP $m): \GMP |
||
135 | |||
136 | /** |
||
137 | * @param string $number |
||
138 | * @param int $from |
||
139 | * @param int $to |
||
140 | * |
||
141 | * @return string |
||
142 | */ |
||
143 | public static function baseConvert(string $number, int $from, int $to): string |
||
147 | } |
||
148 |