@@ 2071-2084 (lines=14) @@ | ||
2068 | * @param string $complexNumber The complex number for which you want the common logarithm. |
|
2069 | * @return string |
|
2070 | */ |
|
2071 | public static function IMLOG10($complexNumber) |
|
2072 | { |
|
2073 | $complexNumber = Functions::flattenSingleValue($complexNumber); |
|
2074 | ||
2075 | $parsedComplex = self::parseComplex($complexNumber); |
|
2076 | ||
2077 | if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { |
|
2078 | return Functions::NAN(); |
|
2079 | } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) { |
|
2080 | return log10($parsedComplex['real']); |
|
2081 | } |
|
2082 | ||
2083 | return self::IMPRODUCT(log10(EULER), self::IMLN($complexNumber)); |
|
2084 | } |
|
2085 | ||
2086 | ||
2087 | /** |
|
@@ 2098-2111 (lines=14) @@ | ||
2095 | * @param string $complexNumber The complex number for which you want the base-2 logarithm. |
|
2096 | * @return string |
|
2097 | */ |
|
2098 | public static function IMLOG2($complexNumber) |
|
2099 | { |
|
2100 | $complexNumber = Functions::flattenSingleValue($complexNumber); |
|
2101 | ||
2102 | $parsedComplex = self::parseComplex($complexNumber); |
|
2103 | ||
2104 | if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { |
|
2105 | return Functions::NAN(); |
|
2106 | } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) { |
|
2107 | return log($parsedComplex['real'], 2); |
|
2108 | } |
|
2109 | ||
2110 | return self::IMPRODUCT(log(EULER, 2), self::IMLN($complexNumber)); |
|
2111 | } |
|
2112 | ||
2113 | ||
2114 | /** |