@@ 1931-1943 (lines=13) @@ | ||
1928 | * @param string $complexNumber The complex number for which you want the common logarithm. |
|
1929 | * @return string |
|
1930 | */ |
|
1931 | public static function IMLOG10($complexNumber) { |
|
1932 | $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); |
|
1933 | ||
1934 | $parsedComplex = self::_parseComplex($complexNumber); |
|
1935 | ||
1936 | if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { |
|
1937 | return PHPExcel_Calculation_Functions::NaN(); |
|
1938 | } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) { |
|
1939 | return log10($parsedComplex['real']); |
|
1940 | } |
|
1941 | ||
1942 | return self::IMPRODUCT(log10(EULER),self::IMLN($complexNumber)); |
|
1943 | } // function IMLOG10() |
|
1944 | ||
1945 | ||
1946 | /** |
|
@@ 1957-1969 (lines=13) @@ | ||
1954 | * @param string $complexNumber The complex number for which you want the base-2 logarithm. |
|
1955 | * @return string |
|
1956 | */ |
|
1957 | public static function IMLOG2($complexNumber) { |
|
1958 | $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber); |
|
1959 | ||
1960 | $parsedComplex = self::_parseComplex($complexNumber); |
|
1961 | ||
1962 | if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) { |
|
1963 | return PHPExcel_Calculation_Functions::NaN(); |
|
1964 | } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) { |
|
1965 | return log($parsedComplex['real'],2); |
|
1966 | } |
|
1967 | ||
1968 | return self::IMPRODUCT(log(EULER,2),self::IMLN($complexNumber)); |
|
1969 | } // function IMLOG2() |
|
1970 | ||
1971 | ||
1972 | /** |