@@ 1472-1486 (lines=15) @@ | ||
1469 | * If places is negative, HEX2BIN returns the #NUM! error value. |
|
1470 | * @return string |
|
1471 | */ |
|
1472 | public static function HEXTOBIN($x, $places = null) |
|
1473 | { |
|
1474 | $x = Functions::flattenSingleValue($x); |
|
1475 | $places = Functions::flattenSingleValue($places); |
|
1476 | ||
1477 | if (is_bool($x)) { |
|
1478 | return Functions::VALUE(); |
|
1479 | } |
|
1480 | $x = (string) $x; |
|
1481 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
|
1482 | return Functions::NAN(); |
|
1483 | } |
|
1484 | ||
1485 | return self::DECTOBIN(self::HEXTODEC($x), $places); |
|
1486 | } |
|
1487 | ||
1488 | /** |
|
1489 | * HEXTODEC |
|
@@ 1622-1636 (lines=15) @@ | ||
1619 | * value. |
|
1620 | * @return string |
|
1621 | */ |
|
1622 | public static function OCTTOBIN($x, $places = null) |
|
1623 | { |
|
1624 | $x = Functions::flattenSingleValue($x); |
|
1625 | $places = Functions::flattenSingleValue($places); |
|
1626 | ||
1627 | if (is_bool($x)) { |
|
1628 | return Functions::VALUE(); |
|
1629 | } |
|
1630 | $x = (string) $x; |
|
1631 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
|
1632 | return Functions::NAN(); |
|
1633 | } |
|
1634 | ||
1635 | return self::DECTOBIN(self::OCTTODEC($x), $places); |
|
1636 | } |
|
1637 | ||
1638 | /** |
|
1639 | * OCTTODEC |
|
@@ 1710-1725 (lines=16) @@ | ||
1707 | * If places is negative, OCT2HEX returns the #NUM! error value. |
|
1708 | * @return string |
|
1709 | */ |
|
1710 | public static function OCTTOHEX($x, $places = null) |
|
1711 | { |
|
1712 | $x = Functions::flattenSingleValue($x); |
|
1713 | $places = Functions::flattenSingleValue($places); |
|
1714 | ||
1715 | if (is_bool($x)) { |
|
1716 | return Functions::VALUE(); |
|
1717 | } |
|
1718 | $x = (string) $x; |
|
1719 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
|
1720 | return Functions::NAN(); |
|
1721 | } |
|
1722 | $hexVal = strtoupper(dechex(self::OCTTODEC($x))); |
|
1723 | ||
1724 | return self::nbrConversionFormat($hexVal, $places); |
|
1725 | } |
|
1726 | ||
1727 | /** |
|
1728 | * COMPLEX |