Skip to content

Commit cc3fa58

Browse files
committed
v3.2.5
* Minor bugfixes
1 parent 0929c09 commit cc3fa58

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

README.md

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

171-
== Upgrade Notice ==
171+
#### 3.2.5
172+
* Minor fixes
173+
174+
### Upgrade Notice
172175
* No breaking changes

system/library/cryptapi.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public static function process_callback($_get)
218218
}
219219

220220
foreach ($params as &$val) {
221-
$val = trim($val);
221+
$val = is_string($val) ? trim($val) : null;
222222
}
223223

224224
return $params;
@@ -267,17 +267,16 @@ public static function get_estimate($coin)
267267

268268
public static function sig_fig($value, $digits)
269269
{
270-
if ($value == 0) {
271-
$decimalPlaces = $digits - 1;
272-
} elseif ($value < 0) {
273-
$decimalPlaces = $digits - floor(log10($value * -1)) - 1;
274-
} else {
275-
$decimalPlaces = $digits - floor(log10($value)) - 1;
270+
$value = (string) $value;
271+
if (strpos($value, '.') !== false) {
272+
if ($value[0] != '-') {
273+
return bcadd($value, '0.' . str_repeat('0', $digits) . '5', $digits);
274+
}
275+
276+
return bcsub($value, '0.' . str_repeat('0', $digits) . '5', $digits);
276277
}
277278

278-
$answer = ($decimalPlaces > 0) ?
279-
number_format($value, $decimalPlaces, '.', '') : round($value, $decimalPlaces);
280-
return $answer;
279+
return $value;
281280
}
282281

283282
public static function calc_order($history, $total, $total_fiat)

0 commit comments

Comments
 (0)