Skip to content

Commit cbb7dac

Browse files
committed
v3.2.5
* Minor bugfixes
1 parent 7b83299 commit cbb7dac

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,8 @@ The easiest and fastest way is via our live chat on our [website](https://crypta
167167
#### 3.2.4
168168
* Minor fixes and improvements
169169

170+
#### 3.2.5
171+
* Minor fixes
172+
170173
### Upgrade Notice
171174
* No breaking changes

system/library/cryptapi.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ public static function process_callback($_get)
220220
}
221221

222222
foreach ($params as &$val) {
223-
if(is_string($val)) {
224-
$val = trim($val);
225-
}
223+
$val = is_string($val) ? trim($val) : null;
226224
}
227225

228226
return $params;
@@ -271,17 +269,16 @@ public static function get_estimate($coin)
271269

272270
public static function sig_fig($value, $digits)
273271
{
274-
if ($value == 0) {
275-
$decimalPlaces = $digits - 1;
276-
} elseif ($value < 0) {
277-
$decimalPlaces = $digits - floor(log10($value * -1)) - 1;
278-
} else {
279-
$decimalPlaces = $digits - floor(log10($value)) - 1;
272+
$value = (string) $value;
273+
if (strpos($value, '.') !== false) {
274+
if ($value[0] != '-') {
275+
return bcadd($value, '0.' . str_repeat('0', $digits) . '5', $digits);
276+
}
277+
278+
return bcsub($value, '0.' . str_repeat('0', $digits) . '5', $digits);
280279
}
281280

282-
$answer = ($decimalPlaces > 0) ?
283-
number_format($value, $decimalPlaces, '.', '') : round($value, $decimalPlaces);
284-
return $answer;
281+
return $value;
285282
}
286283

287284
public static function calc_order($history, $total, $total_fiat): array

0 commit comments

Comments
 (0)