Skip to content

Commit df51922

Browse files
committed
fix format
1 parent 521d4be commit df51922

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

types/Decimal.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,29 @@ class Decimal extends AbstractMultiBaseType
3838
public function renderValue($value, \Doku_Renderer $R, $mode)
3939
{
4040

41-
if ($this->config['engineering']) {
42-
$unitsh = array('', 'k', 'M', 'G', 'T');
43-
$unitsl = array('', 'm', 'µ', 'n', 'p', 'f', 'a');
44-
45-
$exp = floor(log10($value)/3);
46-
47-
if ($exp < 0) {
48-
$units = $unitsl;
49-
$pfkey = -1 * $exp;
50-
} else {
51-
$units = $unitsh;
52-
$pfkey = $exp;
53-
}
54-
55-
if (count($units) <= ($pfkey+1)) {
56-
$pfkey = sizeof($units)-1;
57-
$exp = $pfkey * $exp/abs($exp);
41+
if ($this->config['engineering']) {
42+
$unitsh = array('', 'k', 'M', 'G', 'T');
43+
$unitsl = array('', 'm', 'µ', 'n', 'p', 'f', 'a');
44+
45+
$exp = floor(log10($value)/3);
46+
47+
if ($exp < 0) {
48+
$units = $unitsl;
49+
$pfkey = -1 * $exp;
50+
} else {
51+
$units = $unitsh;
52+
$pfkey = $exp;
53+
}
54+
55+
if (count($units) <= ($pfkey+1)) { //check if number is within prefixes
56+
$pfkey = sizeof($units)-1;
57+
$exp = $pfkey * $exp/abs($exp);
58+
}
59+
60+
$R->cdata($this->config['prefix'] . $value / 10**($exp*3) . "\xE2\x80\xAF" . $units[$pfkey] . $this->config['postfix'] );
61+
return true;
5862
}
5963

60-
$R->cdata($this->config['prefix'] . $value / 10**($exp*3) . "\xE2\x80\xAF" . $units[$pfkey] . $this->config['postfix'] );
61-
return true;
62-
}
63-
6464

6565
if ($this->config['roundto'] == -1) {
6666
$value = $this->formatWithoutRounding(

0 commit comments

Comments
 (0)