Changeset 655 for trunk/Common/PrefixMultiplier.php
- Timestamp:
- May 11, 2014, 4:28:01 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/PrefixMultiplier.php
r548 r655 78 78 if($Value >= pow(10, $II)) 79 79 { 80 if($Digits < ($II + 1)) $RealDigits = $II + 1; 80 if($Digits < ($II + 1)) $RealDigits = $II + 1; 81 81 else $RealDigits = $Digits; 82 82 $Value = round($Value / pow(10, $II - $RealDigits + 1)) * pow(10, $II - $RealDigits + 1); … … 87 87 } 88 88 89 function Add PrefixMultipliers($Value, $Unit, $Digits = 4, $PrefixType = 'Decimal')89 function Add($Value, $Unit, $Digits = 4, $PrefixType = 'Decimal') 90 90 { 91 91 global $PrefixMultipliers; … … 98 98 $I = $PrefixMultipliers[$PrefixType]['BaseIndex']; 99 99 if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 100 101 if($Value > 1) 100 101 if($Value > 1) 102 102 { 103 103 while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1)) 104 104 $I = $I + 1; 105 } else 105 } else 106 106 if($Value < 1) 107 107 { … … 110 110 } 111 111 $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]; 112 112 113 113 // Truncate digits count 114 114 $Value = $this->TruncateDigits($Value, $Digits); 115 115 if($Negative) $Value = -$Value; 116 116 return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 117 } 117 } 118 118 }
Note:
See TracChangeset
for help on using the changeset viewer.