1 | <?php |
||
19 | class Decimal extends Real |
||
20 | { |
||
21 | /** |
||
22 | * @var int |
||
23 | */ |
||
24 | protected static $defaultScale = 12; |
||
25 | |||
26 | /** |
||
27 | * @param int $scale |
||
28 | * |
||
29 | * @throws \InvalidArgumentException |
||
30 | */ |
||
31 | public static function setDefaultScale($scale) |
||
40 | |||
41 | /** |
||
42 | * @return int |
||
43 | */ |
||
44 | public static function defaultScale() |
||
48 | |||
49 | /** |
||
50 | * @param float|int|string $value |
||
51 | * |
||
52 | * @return Decimal |
||
53 | */ |
||
54 | public static function fromNative($value) |
||
62 | |||
63 | /** |
||
64 | * @param int $scale |
||
65 | * |
||
66 | * @return int |
||
67 | */ |
||
68 | protected function scale($scale) |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | protected function invertedAdd(Number $x) |
||
84 | |||
85 | /** |
||
86 | * {@inheritdoc} |
||
87 | */ |
||
88 | public function addInteger(Integer $x) |
||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | public function addReal(Real $x) |
||
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | public function addDecimal(Decimal $x, $scale = null) |
||
112 | |||
113 | /** |
||
114 | * {@inheritdoc} |
||
115 | */ |
||
116 | protected function invertedSub(Number $x) |
||
120 | |||
121 | /** |
||
122 | * {@inheritdoc} |
||
123 | */ |
||
124 | public function subInteger(Integer $x) |
||
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | public function subReal(Real $x) |
||
136 | |||
137 | /** |
||
138 | * {@inheritdoc} |
||
139 | */ |
||
140 | public function subDecimal(Decimal $x, $scale = null) |
||
148 | |||
149 | /** |
||
150 | * {@inheritdoc} |
||
151 | */ |
||
152 | protected function invertedMult(Number $x) |
||
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | public function multInteger(Integer $x) |
||
164 | |||
165 | /** |
||
166 | * {@inheritdoc} |
||
167 | */ |
||
168 | public function multReal(Real $x) |
||
172 | |||
173 | /** |
||
174 | * {@inheritdoc} |
||
175 | */ |
||
176 | public function multDecimal(Decimal $x, $scale = null) |
||
184 | |||
185 | /** |
||
186 | * {@inheritdoc} |
||
187 | */ |
||
188 | protected function invertedDiv(Number $x) |
||
192 | |||
193 | /** |
||
194 | * {@inheritdoc} |
||
195 | */ |
||
196 | public function divInteger(Integer $x) |
||
200 | |||
201 | /** |
||
202 | * {@inheritdoc} |
||
203 | */ |
||
204 | public function divReal(Real $x) |
||
208 | |||
209 | /** |
||
210 | * {@inheritdoc} |
||
211 | */ |
||
212 | public function divDecimal(Decimal $x, $scale = null) |
||
221 | |||
222 | /** |
||
223 | * {@inheritdoc} |
||
224 | */ |
||
225 | protected function invertedPow(Number $x) |
||
229 | |||
230 | /** |
||
231 | * {@inheritdoc} |
||
232 | */ |
||
233 | public function powInteger(Integer $x) |
||
237 | |||
238 | /** |
||
239 | * {@inheritdoc} |
||
240 | */ |
||
241 | public function sqrt($scale = null) |
||
245 | } |
||
246 |