|
@@ 1295-1318 (lines=24) @@
|
| 1292 |
|
* If places is zero or negative, DEC2HEX returns the #NUM! error value. |
| 1293 |
|
* @return string |
| 1294 |
|
*/ |
| 1295 |
|
public static function DECTOHEX($x, $places=null) { |
| 1296 |
|
$x = PHPExcel_Calculation_Functions::flattenSingleValue($x); |
| 1297 |
|
$places = PHPExcel_Calculation_Functions::flattenSingleValue($places); |
| 1298 |
|
|
| 1299 |
|
if (is_bool($x)) { |
| 1300 |
|
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { |
| 1301 |
|
$x = (int) $x; |
| 1302 |
|
} else { |
| 1303 |
|
return PHPExcel_Calculation_Functions::VALUE(); |
| 1304 |
|
} |
| 1305 |
|
} |
| 1306 |
|
$x = (string) $x; |
| 1307 |
|
if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) { |
| 1308 |
|
return PHPExcel_Calculation_Functions::VALUE(); |
| 1309 |
|
} |
| 1310 |
|
$x = (string) floor($x); |
| 1311 |
|
$r = strtoupper(dechex($x)); |
| 1312 |
|
if (strlen($r) == 8) { |
| 1313 |
|
// Two's Complement |
| 1314 |
|
$r = 'FF'.$r; |
| 1315 |
|
} |
| 1316 |
|
|
| 1317 |
|
return self::_nbrConversionFormat($r,$places); |
| 1318 |
|
} // function DECTOHEX() |
| 1319 |
|
|
| 1320 |
|
|
| 1321 |
|
/** |
|
@@ 1349-1372 (lines=24) @@
|
| 1346 |
|
* If places is zero or negative, DEC2OCT returns the #NUM! error value. |
| 1347 |
|
* @return string |
| 1348 |
|
*/ |
| 1349 |
|
public static function DECTOOCT($x, $places=null) { |
| 1350 |
|
$x = PHPExcel_Calculation_Functions::flattenSingleValue($x); |
| 1351 |
|
$places = PHPExcel_Calculation_Functions::flattenSingleValue($places); |
| 1352 |
|
|
| 1353 |
|
if (is_bool($x)) { |
| 1354 |
|
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { |
| 1355 |
|
$x = (int) $x; |
| 1356 |
|
} else { |
| 1357 |
|
return PHPExcel_Calculation_Functions::VALUE(); |
| 1358 |
|
} |
| 1359 |
|
} |
| 1360 |
|
$x = (string) $x; |
| 1361 |
|
if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) { |
| 1362 |
|
return PHPExcel_Calculation_Functions::VALUE(); |
| 1363 |
|
} |
| 1364 |
|
$x = (string) floor($x); |
| 1365 |
|
$r = decoct($x); |
| 1366 |
|
if (strlen($r) == 11) { |
| 1367 |
|
// Two's Complement |
| 1368 |
|
$r = substr($r,-10); |
| 1369 |
|
} |
| 1370 |
|
|
| 1371 |
|
return self::_nbrConversionFormat($r,$places); |
| 1372 |
|
} // function DECTOOCT() |
| 1373 |
|
|
| 1374 |
|
|
| 1375 |
|
/** |