Changeset 34 for trunk/www/global.php
- Timestamp:
- Jun 15, 2009, 9:09:30 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/global.php
r32 r34 73 73 'Time' => array 74 74 ( 75 'BaseIndex' => 0,75 'BaseIndex' => 8, 76 76 'Definition' => array 77 77 ( … … 167 167 global $PrefixMultipliers; 168 168 169 if(($Unit == '') and ($PrefixType != 'Time')) return($this->TruncateDigits($Value, $Digits)); 169 $Negative = ($Value < 0); 170 $Value = abs($Value); 171 if(($Unit == '') and ($PrefixType != 'Time')) 172 return($this->TruncateDigits($Value, $Digits)); 173 170 174 $I = $PrefixMultipliers[$PrefixType]['BaseIndex']; 171 if($Value > 0) $II = 1; 172 else if($Value < 0) $II = -1; 173 else $II = 0; 174 while((($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + $II][2]) > $II) and (($I + $II) >= 0) and (($I + $II) <= count($PrefixMultipliers[$PrefixType]['Definition']))) $I = $I + $II; 175 if($Value == 0) return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 176 177 if($Value > 1) 178 { 179 while((($I + 1) <= count($PrefixMultipliers[$PrefixType]['Definition'])) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I + 1][2]) > 1)) 180 $I = $I + 1; 181 } else 182 if($Value < 1) 183 { 184 while((($I - 1) >= 0) and (($Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]) < 1)) 185 $I = $I - 1; 186 } 175 187 $Value = $Value / $PrefixMultipliers[$PrefixType]['Definition'][$I][2]; 176 188 177 189 // Truncate digits count 178 190 $Value = $this->TruncateDigits($Value, $Digits); 179 191 if($Negative) $Value = -$Value; 180 192 return($Value.' '.$PrefixMultipliers[$PrefixType]['Definition'][$I][0].$Unit); 181 193 }
Note:
See TracChangeset
for help on using the changeset viewer.