ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_Calculation_Engineering Class Reference
+ Collaboration diagram for PHPExcel_Calculation_Engineering:

Static Public Member Functions

static _parseComplex ($complexNumber)
 _parseComplex More...
 
static BESSELI ($x, $ord)
 
static BESSELJ ($x, $ord)
 
static BESSELK ($x, $ord)
 
static BESSELY ($x, $ord)
 
static BINTODEC ($x)
 
static BINTOHEX ($x, $places=NULL)
 
static BINTOOCT ($x, $places=NULL)
 
static DECTOBIN ($x, $places=NULL)
 
static DECTOHEX ($x, $places=null)
 
static DECTOOCT ($x, $places=null)
 
static HEXTOBIN ($x, $places=null)
 
static HEXTODEC ($x)
 
static HEXTOOCT ($x, $places=null)
 
static OCTTOBIN ($x, $places=null)
 
static OCTTODEC ($x)
 
static OCTTOHEX ($x, $places=null)
 
static COMPLEX ($realNumber=0.0, $imaginary=0.0, $suffix='i')
 
static IMAGINARY ($complexNumber)
 
static IMREAL ($complexNumber)
 
static IMABS ($complexNumber)
 IMABS. More...
 
static IMARGUMENT ($complexNumber)
 IMARGUMENT. More...
 
static IMCONJUGATE ($complexNumber)
 IMCONJUGATE. More...
 
static IMCOS ($complexNumber)
 IMCOS. More...
 
static IMSIN ($complexNumber)
 IMSIN. More...
 
static IMSQRT ($complexNumber)
 IMSQRT. More...
 
static IMLN ($complexNumber)
 IMLN. More...
 
static IMLOG10 ($complexNumber)
 IMLOG10. More...
 
static IMLOG2 ($complexNumber)
 IMLOG2. More...
 
static IMEXP ($complexNumber)
 IMEXP. More...
 
static IMPOWER ($complexNumber, $realNumber)
 IMPOWER. More...
 
static IMDIV ($complexDividend, $complexDivisor)
 IMDIV. More...
 
static IMSUB ($complexNumber1, $complexNumber2)
 IMSUB. More...
 
static IMSUM ()
 IMSUM. More...
 
static IMPRODUCT ()
 IMPRODUCT. More...
 
static DELTA ($a, $b=0)
 DELTA. More...
 
static GESTEP ($number, $step=0)
 GESTEP. More...
 
static _erfVal ($x)
 
static ERF ($lower, $upper=NULL)
 ERF. More...
 
static ERFC ($x)
 ERFC. More...
 
static getConversionGroups ()
 getConversionGroups Returns a list of the different conversion groups for UOM conversions More...
 
static getConversionGroupUnits ($group=NULL)
 getConversionGroupUnits Returns an array of units of measure, for a specified conversion group, or for all groups More...
 
static getConversionGroupUnitDetails ($group=NULL)
 getConversionGroupUnitDetails More...
 
static getConversionMultipliers ()
 getConversionMultipliers Returns an array of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM() More...
 
static CONVERTUOM ($value, $fromUOM, $toUOM)
 CONVERTUOM. More...
 

Static Private Member Functions

static _cleanComplex ($complexNumber)
 Cleans the leading characters in a complex number string. More...
 
static _nbrConversionFormat ($xVal, $places)
 Formats a number base string value with leading zeroes. More...
 
static _Besselk0 ($fNum)
 
static _Besselk1 ($fNum)
 
static _Bessely0 ($fNum)
 
static _Bessely1 ($fNum)
 
static _erfcVal ($x)
 

Static Private Attributes

static $_conversionUnits
 
static $_conversionMultipliers
 
static $_unitConversions
 
static $_two_sqrtpi = 1.128379167095512574
 
static $_one_sqrtpi = 0.564189583547756287
 

Detailed Description

Definition at line 50 of file Engineering.php.

Member Function Documentation

◆ _Besselk0()

static PHPExcel_Calculation_Engineering::_Besselk0 (   $fNum)
staticprivate

Definition at line 884 of file Engineering.php.

884 {
885 if ($fNum <= 2) {
886 $fNum2 = $fNum * 0.5;
887 $y = ($fNum2 * $fNum2);
888 $fRet = -log($fNum2) * self::BESSELI($fNum, 0) +
889 (-0.57721566 + $y * (0.42278420 + $y * (0.23069756 + $y * (0.3488590e-1 + $y * (0.262698e-2 + $y *
890 (0.10750e-3 + $y * 0.74e-5))))));
891 } else {
892 $y = 2 / $fNum;
893 $fRet = exp(-$fNum) / sqrt($fNum) *
894 (1.25331414 + $y * (-0.7832358e-1 + $y * (0.2189568e-1 + $y * (-0.1062446e-1 + $y *
895 (0.587872e-2 + $y * (-0.251540e-2 + $y * 0.53208e-3))))));
896 }
897 return $fRet;
898 } // function _Besselk0()
$y
Definition: example_007.php:83

References $y, and BESSELI().

Referenced by BESSELK().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _Besselk1()

static PHPExcel_Calculation_Engineering::_Besselk1 (   $fNum)
staticprivate

Definition at line 901 of file Engineering.php.

901 {
902 if ($fNum <= 2) {
903 $fNum2 = $fNum * 0.5;
904 $y = ($fNum2 * $fNum2);
905 $fRet = log($fNum2) * self::BESSELI($fNum, 1) +
906 (1 + $y * (0.15443144 + $y * (-0.67278579 + $y * (-0.18156897 + $y * (-0.1919402e-1 + $y *
907 (-0.110404e-2 + $y * (-0.4686e-4))))))) / $fNum;
908 } else {
909 $y = 2 / $fNum;
910 $fRet = exp(-$fNum) / sqrt($fNum) *
911 (1.25331414 + $y * (0.23498619 + $y * (-0.3655620e-1 + $y * (0.1504268e-1 + $y * (-0.780353e-2 + $y *
912 (0.325614e-2 + $y * (-0.68245e-3)))))));
913 }
914 return $fRet;
915 } // function _Besselk1()

References $y, and BESSELI().

Referenced by BESSELK().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _Bessely0()

static PHPExcel_Calculation_Engineering::_Bessely0 (   $fNum)
staticprivate

Definition at line 966 of file Engineering.php.

966 {
967 if ($fNum < 8.0) {
968 $y = ($fNum * $fNum);
969 $f1 = -2957821389.0 + $y * (7062834065.0 + $y * (-512359803.6 + $y * (10879881.29 + $y * (-86327.92757 + $y * 228.4622733))));
970 $f2 = 40076544269.0 + $y * (745249964.8 + $y * (7189466.438 + $y * (47447.26470 + $y * (226.1030244 + $y))));
971 $fRet = $f1 / $f2 + 0.636619772 * self::BESSELJ($fNum, 0) * log($fNum);
972 } else {
973 $z = 8.0 / $fNum;
974 $y = ($z * $z);
975 $xx = $fNum - 0.785398164;
976 $f1 = 1 + $y * (-0.1098628627e-2 + $y * (0.2734510407e-4 + $y * (-0.2073370639e-5 + $y * 0.2093887211e-6)));
977 $f2 = -0.1562499995e-1 + $y * (0.1430488765e-3 + $y * (-0.6911147651e-5 + $y * (0.7621095161e-6 + $y * (-0.934945152e-7))));
978 $fRet = sqrt(0.636619772 / $fNum) * (sin($xx) * $f1 + $z * cos($xx) * $f2);
979 }
980 return $fRet;
981 } // function _Bessely0()

References $y, and BESSELJ().

Referenced by BESSELY().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _Bessely1()

static PHPExcel_Calculation_Engineering::_Bessely1 (   $fNum)
staticprivate

Definition at line 984 of file Engineering.php.

984 {
985 if ($fNum < 8.0) {
986 $y = ($fNum * $fNum);
987 $f1 = $fNum * (-0.4900604943e13 + $y * (0.1275274390e13 + $y * (-0.5153438139e11 + $y * (0.7349264551e9 + $y *
988 (-0.4237922726e7 + $y * 0.8511937935e4)))));
989 $f2 = 0.2499580570e14 + $y * (0.4244419664e12 + $y * (0.3733650367e10 + $y * (0.2245904002e8 + $y *
990 (0.1020426050e6 + $y * (0.3549632885e3 + $y)))));
991 $fRet = $f1 / $f2 + 0.636619772 * ( self::BESSELJ($fNum, 1) * log($fNum) - 1 / $fNum);
992 } else {
993 $fRet = sqrt(0.636619772 / $fNum) * sin($fNum - 2.356194491);
994 }
995 return $fRet;
996 } // function _Bessely1()

References $y, and BESSELJ().

Referenced by BESSELY().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _cleanComplex()

static PHPExcel_Calculation_Engineering::_cleanComplex (   $complexNumber)
staticprivate

Cleans the leading characters in a complex number string.

Parameters
string$complexNumberThe complex number to clean
Returns
string The "cleaned" complex number

Definition at line 749 of file Engineering.php.

749 {
750 if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1);
751 if ($complexNumber{0} == '0') $complexNumber = substr($complexNumber,1);
752 if ($complexNumber{0} == '.') $complexNumber = '0'.$complexNumber;
753 if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1);
754 return $complexNumber;
755 }

Referenced by IMCONJUGATE(), and IMDIV().

+ Here is the caller graph for this function:

◆ _erfcVal()

static PHPExcel_Calculation_Engineering::_erfcVal (   $x)
staticprivate

Definition at line 2289 of file Engineering.php.

2289 {
2290 if (abs($x) < 2.2) {
2291 return 1 - self::_erfVal($x);
2292 }
2293 if ($x < 0) {
2294 return 2 - self::ERFC(-$x);
2295 }
2296 $a = $n = 1;
2297 $b = $c = $x;
2298 $d = ($x * $x) + 0.5;
2299 $q1 = $q2 = $b / $d;
2300 $t = 0;
2301 do {
2302 $t = $a * $n + $b * $x;
2303 $a = $b;
2304 $b = $t;
2305 $t = $c * $n + $d * $x;
2306 $c = $d;
2307 $d = $t;
2308 $n += 0.5;
2309 $q1 = $q2;
2310 $q2 = $b / $d;
2311 } while ((abs($q1 - $q2) / $q2) > PRECISION);
2312 return self::$_one_sqrtpi * exp(-$x * $x) * $q2;
2313 } // function _erfcVal()
for($col=0; $col< 50; $col++) $d
const PRECISION
PRECISION.
Definition: Functions.php:49
$n
Definition: RandomTest.php:80
$x
Definition: example_009.php:98

References $d, $n, $t, $x, _erfVal(), ERFC(), and PRECISION.

Referenced by _erfVal(), and ERFC().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _erfVal()

static PHPExcel_Calculation_Engineering::_erfVal (   $x)
static

Definition at line 2228 of file Engineering.php.

2228 {
2229 if (abs($x) > 2.2) {
2230 return 1 - self::_erfcVal($x);
2231 }
2232 $sum = $term = $x;
2233 $xsqr = ($x * $x);
2234 $j = 1;
2235 do {
2236 $term *= $xsqr / $j;
2237 $sum -= $term / (2 * $j + 1);
2238 ++$j;
2239 $term *= $xsqr / $j;
2240 $sum += $term / (2 * $j + 1);
2241 ++$j;
2242 if ($sum == 0.0) {
2243 break;
2244 }
2245 } while (abs($term / $sum) > PRECISION);
2246 return self::$_two_sqrtpi * $sum;
2247 } // function _erfVal()

References $x, _erfcVal(), and PRECISION.

Referenced by _erfcVal(), ERF(), and PHPExcel_Calculation_Statistical\NORMDIST().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _nbrConversionFormat()

static PHPExcel_Calculation_Engineering::_nbrConversionFormat (   $xVal,
  $places 
)
staticprivate

Formats a number base string value with leading zeroes.

Parameters
string$xValThe "number" to pad
integer$placesThe length that we want to pad this value
Returns
string The padded "number"

Definition at line 764 of file Engineering.php.

764 {
765 if (!is_null($places)) {
766 if (strlen($xVal) <= $places) {
767 return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10);
768 } else {
770 }
771 }
772
773 return substr($xVal, -10);
774 } // function _nbrConversionFormat()

References PHPExcel_Calculation_Functions\NaN().

Referenced by BINTOHEX(), BINTOOCT(), DECTOBIN(), DECTOHEX(), DECTOOCT(), HEXTOOCT(), OCTTOBIN(), and OCTTOHEX().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _parseComplex()

static PHPExcel_Calculation_Engineering::_parseComplex (   $complexNumber)
static

_parseComplex

Parses a complex number into its real and imaginary parts, and an I or J suffix

Parameters
string$complexNumberThe complex number
Returns
string[] Indexed on "real", "imaginary" and "suffix"

Definition at line 696 of file Engineering.php.

696 {
697 $workString = (string) $complexNumber;
698
699 $realNumber = $imaginary = 0;
700 // Extract the suffix, if there is one
701 $suffix = substr($workString,-1);
702 if (!is_numeric($suffix)) {
703 $workString = substr($workString,0,-1);
704 } else {
705 $suffix = '';
706 }
707
708 // Split the input into its Real and Imaginary components
709 $leadingSign = 0;
710 if (strlen($workString) > 0) {
711 $leadingSign = (($workString{0} == '+') || ($workString{0} == '-')) ? 1 : 0;
712 }
713 $power = '';
714 $realNumber = strtok($workString, '+-');
715 if (strtoupper(substr($realNumber,-1)) == 'E') {
716 $power = strtok('+-');
717 ++$leadingSign;
718 }
719
720 $realNumber = substr($workString,0,strlen($realNumber)+strlen($power)+$leadingSign);
721
722 if ($suffix != '') {
723 $imaginary = substr($workString,strlen($realNumber));
724
725 if (($imaginary == '') && (($realNumber == '') || ($realNumber == '+') || ($realNumber == '-'))) {
726 $imaginary = $realNumber.'1';
727 $realNumber = '0';
728 } else if ($imaginary == '') {
729 $imaginary = $realNumber;
730 $realNumber = '0';
731 } elseif (($imaginary == '+') || ($imaginary == '-')) {
732 $imaginary .= '1';
733 }
734 }
735
736 return array( 'real' => $realNumber,
737 'imaginary' => $imaginary,
738 'suffix' => $suffix
739 );
740 } // function _parseComplex()

Referenced by IMABS(), IMAGINARY(), IMARGUMENT(), IMCONJUGATE(), IMCOS(), IMDIV(), IMEXP(), IMLN(), IMLOG10(), IMLOG2(), IMPOWER(), IMPRODUCT(), IMREAL(), IMSIN(), IMSQRT(), IMSUB(), and IMSUM().

+ Here is the caller graph for this function:

◆ BESSELI()

static PHPExcel_Calculation_Engineering::BESSELI (   $x,
  $ord 
)
static

Definition at line 796 of file Engineering.php.

796 {
798 $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
799
800 if ((is_numeric($x)) && (is_numeric($ord))) {
801 $ord = floor($ord);
802 if ($ord < 0) {
804 }
805
806 if (abs($x) <= 30) {
807 $fResult = $fTerm = pow($x / 2, $ord) / PHPExcel_Calculation_MathTrig::FACT($ord);
808 $ordK = 1;
809 $fSqrX = ($x * $x) / 4;
810 do {
811 $fTerm *= $fSqrX;
812 $fTerm /= ($ordK * ($ordK + $ord));
813 $fResult += $fTerm;
814 } while ((abs($fTerm) > 1e-12) && (++$ordK < 100));
815 } else {
816 $f_2_PI = 2 * M_PI;
817
818 $fXAbs = abs($x);
819 $fResult = exp($fXAbs) / sqrt($f_2_PI * $fXAbs);
820 if (($ord & 1) && ($x < 0)) {
821 $fResult = -$fResult;
822 }
823 }
824 return (is_nan($fResult)) ? PHPExcel_Calculation_Functions::NaN() : $fResult;
825 }
827 } // function BESSELI()
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
Definition: Functions.php:662
e($cmd)
Definition: flush.php:14

References $x, e(), PHPExcel_Calculation_MathTrig\FACT(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by _Besselk0(), and _Besselk1().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BESSELJ()

static PHPExcel_Calculation_Engineering::BESSELJ (   $x,
  $ord 
)
static

Definition at line 848 of file Engineering.php.

848 {
850 $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
851
852 if ((is_numeric($x)) && (is_numeric($ord))) {
853 $ord = floor($ord);
854 if ($ord < 0) {
856 }
857
858 $fResult = 0;
859 if (abs($x) <= 30) {
860 $fResult = $fTerm = pow($x / 2, $ord) / PHPExcel_Calculation_MathTrig::FACT($ord);
861 $ordK = 1;
862 $fSqrX = ($x * $x) / -4;
863 do {
864 $fTerm *= $fSqrX;
865 $fTerm /= ($ordK * ($ordK + $ord));
866 $fResult += $fTerm;
867 } while ((abs($fTerm) > 1e-12) && (++$ordK < 100));
868 } else {
869 $f_PI_DIV_2 = M_PI / 2;
870 $f_PI_DIV_4 = M_PI / 4;
871
872 $fXAbs = abs($x);
873 $fResult = sqrt(M_2DIVPI / $fXAbs) * cos($fXAbs - $ord * $f_PI_DIV_2 - $f_PI_DIV_4);
874 if (($ord & 1) && ($x < 0)) {
875 $fResult = -$fResult;
876 }
877 }
878 return (is_nan($fResult)) ? PHPExcel_Calculation_Functions::NaN() : $fResult;
879 }
881 } // function BESSELJ()
const M_2DIVPI
2 / PI
Definition: Functions.php:43

References $x, e(), PHPExcel_Calculation_MathTrig\FACT(), PHPExcel_Calculation_Functions\flattenSingleValue(), M_2DIVPI, PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by _Bessely0(), and _Bessely1().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BESSELK()

static PHPExcel_Calculation_Engineering::BESSELK (   $x,
  $ord 
)
static

Definition at line 937 of file Engineering.php.

937 {
939 $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
940
941 if ((is_numeric($x)) && (is_numeric($ord))) {
942 if (($ord < 0) || ($x == 0.0)) {
944 }
945
946 switch(floor($ord)) {
947 case 0 : return self::_Besselk0($x);
948 break;
949 case 1 : return self::_Besselk1($x);
950 break;
951 default : $fTox = 2 / $x;
952 $fBkm = self::_Besselk0($x);
953 $fBk = self::_Besselk1($x);
954 for ($n = 1; $n < $ord; ++$n) {
955 $fBkp = $fBkm + $n * $fTox * $fBk;
956 $fBkm = $fBk;
957 $fBk = $fBkp;
958 }
959 }
960 return (is_nan($fBk)) ? PHPExcel_Calculation_Functions::NaN() : $fBk;
961 }
963 } // function BESSELK()

References $n, $x, _Besselk0(), _Besselk1(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ BESSELY()

static PHPExcel_Calculation_Engineering::BESSELY (   $x,
  $ord 
)
static

Definition at line 1017 of file Engineering.php.

1017 {
1019 $ord = (is_null($ord)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($ord);
1020
1021 if ((is_numeric($x)) && (is_numeric($ord))) {
1022 if (($ord < 0) || ($x == 0.0)) {
1024 }
1025
1026 switch(floor($ord)) {
1027 case 0 : return self::_Bessely0($x);
1028 break;
1029 case 1 : return self::_Bessely1($x);
1030 break;
1031 default: $fTox = 2 / $x;
1032 $fBym = self::_Bessely0($x);
1033 $fBy = self::_Bessely1($x);
1034 for ($n = 1; $n < $ord; ++$n) {
1035 $fByp = $n * $fTox * $fBy - $fBym;
1036 $fBym = $fBy;
1037 $fBy = $fByp;
1038 }
1039 }
1040 return (is_nan($fBy)) ? PHPExcel_Calculation_Functions::NaN() : $fBy;
1041 }
1043 } // function BESSELY()

References $n, $x, _Bessely0(), _Bessely1(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ BINTODEC()

static PHPExcel_Calculation_Engineering::BINTODEC (   $x)
static

Definition at line 1064 of file Engineering.php.

1064 {
1066
1067 if (is_bool($x)) {
1069 $x = (int) $x;
1070 } else {
1072 }
1073 }
1075 $x = floor($x);
1076 }
1077 $x = (string) $x;
1078 if (strlen($x) > preg_match_all('/[01]/',$x,$out)) {
1080 }
1081 if (strlen($x) > 10) {
1083 } elseif (strlen($x) == 10) {
1084 // Two's Complement
1085 $x = substr($x,-9);
1086 return '-'.(512-bindec($x));
1087 }
1088 return bindec($x);
1089 } // function BINTODEC()

References $out, $x, PHPExcel_Calculation_Functions\COMPATIBILITY_GNUMERIC, PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ BINTOHEX()

static PHPExcel_Calculation_Engineering::BINTOHEX (   $x,
  $places = NULL 
)
static

Definition at line 1116 of file Engineering.php.

1116 {
1119
1120 if (is_bool($x)) {
1122 $x = (int) $x;
1123 } else {
1125 }
1126 }
1128 $x = floor($x);
1129 }
1130 $x = (string) $x;
1131 if (strlen($x) > preg_match_all('/[01]/',$x,$out)) {
1133 }
1134 if (strlen($x) > 10) {
1136 } elseif (strlen($x) == 10) {
1137 // Two's Complement
1138 return str_repeat('F',8).substr(strtoupper(dechex(bindec(substr($x,-9)))),-2);
1139 }
1140 $hexVal = (string) strtoupper(dechex(bindec($x)));
1141
1142 return self::_nbrConversionFormat($hexVal,$places);
1143 } // function BINTOHEX()
static _nbrConversionFormat($xVal, $places)
Formats a number base string value with leading zeroes.

References $out, $x, _nbrConversionFormat(), PHPExcel_Calculation_Functions\COMPATIBILITY_GNUMERIC, PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ BINTOOCT()

static PHPExcel_Calculation_Engineering::BINTOOCT (   $x,
  $places = NULL 
)
static

Definition at line 1170 of file Engineering.php.

1170 {
1173
1174 if (is_bool($x)) {
1176 $x = (int) $x;
1177 } else {
1179 }
1180 }
1182 $x = floor($x);
1183 }
1184 $x = (string) $x;
1185 if (strlen($x) > preg_match_all('/[01]/',$x,$out)) {
1187 }
1188 if (strlen($x) > 10) {
1190 } elseif (strlen($x) == 10) {
1191 // Two's Complement
1192 return str_repeat('7',7).substr(strtoupper(decoct(bindec(substr($x,-9)))),-3);
1193 }
1194 $octVal = (string) decoct(bindec($x));
1195
1196 return self::_nbrConversionFormat($octVal,$places);
1197 } // function BINTOOCT()

References $out, $x, _nbrConversionFormat(), PHPExcel_Calculation_Functions\COMPATIBILITY_GNUMERIC, PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ COMPLEX()

static PHPExcel_Calculation_Engineering::COMPLEX (   $realNumber = 0.0,
  $imaginary = 0.0,
  $suffix = 'i' 
)
static

Definition at line 1640 of file Engineering.php.

1640 {
1641 $realNumber = (is_null($realNumber)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
1642 $imaginary = (is_null($imaginary)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($imaginary);
1643 $suffix = (is_null($suffix)) ? 'i' : PHPExcel_Calculation_Functions::flattenSingleValue($suffix);
1644
1645 if (((is_numeric($realNumber)) && (is_numeric($imaginary))) &&
1646 (($suffix == 'i') || ($suffix == 'j') || ($suffix == ''))) {
1647 $realNumber = (float) $realNumber;
1648 $imaginary = (float) $imaginary;
1649
1650 if ($suffix == '') $suffix = 'i';
1651 if ($realNumber == 0.0) {
1652 if ($imaginary == 0.0) {
1653 return (string) '0';
1654 } elseif ($imaginary == 1.0) {
1655 return (string) $suffix;
1656 } elseif ($imaginary == -1.0) {
1657 return (string) '-'.$suffix;
1658 }
1659 return (string) $imaginary.$suffix;
1660 } elseif ($imaginary == 0.0) {
1661 return (string) $realNumber;
1662 } elseif ($imaginary == 1.0) {
1663 return (string) $realNumber.'+'.$suffix;
1664 } elseif ($imaginary == -1.0) {
1665 return (string) $realNumber.'-'.$suffix;
1666 }
1667 if ($imaginary > 0) { $imaginary = (string) '+'.$imaginary; }
1668 return (string) $realNumber.$imaginary.$suffix;
1669 }
1670
1672 } // function COMPLEX()

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by IMEXP(), IMLN(), IMPOWER(), IMPRODUCT(), IMSIN(), IMSQRT(), IMSUB(), and IMSUM().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CONVERTUOM()

static PHPExcel_Calculation_Engineering::CONVERTUOM (   $value,
  $fromUOM,
  $toUOM 
)
static

CONVERTUOM.

Converts a number from one measurement system to another. For example, CONVERT can translate a table of distances in miles to a table of distances in kilometers.

Excel Function: CONVERT(value,fromUOM,toUOM)

Parameters
float$valueThe value in fromUOM to convert.
string$fromUOMThe units for value.
string$toUOMThe units for the result.
Returns
float

Definition at line 2421 of file Engineering.php.

2421 {
2425
2426 if (!is_numeric($value)) {
2428 }
2429 $fromMultiplier = 1.0;
2430 if (isset(self::$_conversionUnits[$fromUOM])) {
2431 $unitGroup1 = self::$_conversionUnits[$fromUOM]['Group'];
2432 } else {
2433 $fromMultiplier = substr($fromUOM,0,1);
2434 $fromUOM = substr($fromUOM,1);
2435 if (isset(self::$_conversionMultipliers[$fromMultiplier])) {
2436 $fromMultiplier = self::$_conversionMultipliers[$fromMultiplier]['multiplier'];
2437 } else {
2439 }
2440 if ((isset(self::$_conversionUnits[$fromUOM])) && (self::$_conversionUnits[$fromUOM]['AllowPrefix'])) {
2441 $unitGroup1 = self::$_conversionUnits[$fromUOM]['Group'];
2442 } else {
2444 }
2445 }
2446 $value *= $fromMultiplier;
2447
2448 $toMultiplier = 1.0;
2449 if (isset(self::$_conversionUnits[$toUOM])) {
2450 $unitGroup2 = self::$_conversionUnits[$toUOM]['Group'];
2451 } else {
2452 $toMultiplier = substr($toUOM,0,1);
2453 $toUOM = substr($toUOM,1);
2454 if (isset(self::$_conversionMultipliers[$toMultiplier])) {
2455 $toMultiplier = self::$_conversionMultipliers[$toMultiplier]['multiplier'];
2456 } else {
2458 }
2459 if ((isset(self::$_conversionUnits[$toUOM])) && (self::$_conversionUnits[$toUOM]['AllowPrefix'])) {
2460 $unitGroup2 = self::$_conversionUnits[$toUOM]['Group'];
2461 } else {
2463 }
2464 }
2465 if ($unitGroup1 != $unitGroup2) {
2467 }
2468
2469 if (($fromUOM == $toUOM) && ($fromMultiplier == $toMultiplier)) {
2470 // We've already factored $fromMultiplier into the value, so we need
2471 // to reverse it again
2472 return $value / $fromMultiplier;
2473 } elseif ($unitGroup1 == 'Temperature') {
2474 if (($fromUOM == 'F') || ($fromUOM == 'fah')) {
2475 if (($toUOM == 'F') || ($toUOM == 'fah')) {
2476 return $value;
2477 } else {
2478 $value = (($value - 32) / 1.8);
2479 if (($toUOM == 'K') || ($toUOM == 'kel')) {
2480 $value += 273.15;
2481 }
2482 return $value;
2483 }
2484 } elseif ((($fromUOM == 'K') || ($fromUOM == 'kel')) &&
2485 (($toUOM == 'K') || ($toUOM == 'kel'))) {
2486 return $value;
2487 } elseif ((($fromUOM == 'C') || ($fromUOM == 'cel')) &&
2488 (($toUOM == 'C') || ($toUOM == 'cel'))) {
2489 return $value;
2490 }
2491 if (($toUOM == 'F') || ($toUOM == 'fah')) {
2492 if (($fromUOM == 'K') || ($fromUOM == 'kel')) {
2493 $value -= 273.15;
2494 }
2495 return ($value * 1.8) + 32;
2496 }
2497 if (($toUOM == 'C') || ($toUOM == 'cel')) {
2498 return $value - 273.15;
2499 }
2500 return $value + 273.15;
2501 }
2502 return ($value * self::$_unitConversions[$unitGroup1][$fromUOM][$toUOM]) / $toMultiplier;
2503 } // function CONVERTUOM()

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NA(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ DECTOBIN()

static PHPExcel_Calculation_Engineering::DECTOBIN (   $x,
  $places = NULL 
)
static

Definition at line 1228 of file Engineering.php.

1228 {
1231
1232 if (is_bool($x)) {
1234 $x = (int) $x;
1235 } else {
1237 }
1238 }
1239 $x = (string) $x;
1240 if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) {
1242 }
1243 $x = (string) floor($x);
1244 $r = decbin($x);
1245 if (strlen($r) == 32) {
1246 // Two's Complement
1247 $r = substr($r,-10);
1248 } elseif (strlen($r) > 11) {
1250 }
1251
1252 return self::_nbrConversionFormat($r,$places);
1253 } // function DECTOBIN()
$r
Definition: example_031.php:79

References $out, $r, $x, _nbrConversionFormat(), PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ DECTOHEX()

static PHPExcel_Calculation_Engineering::DECTOHEX (   $x,
  $places = null 
)
static

Definition at line 1284 of file Engineering.php.

1284 {
1287
1288 if (is_bool($x)) {
1290 $x = (int) $x;
1291 } else {
1293 }
1294 }
1295 $x = (string) $x;
1296 if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) {
1298 }
1299 $x = (string) floor($x);
1300 $r = strtoupper(dechex($x));
1301 if (strlen($r) == 8) {
1302 // Two's Complement
1303 $r = 'FF'.$r;
1304 }
1305
1306 return self::_nbrConversionFormat($r,$places);
1307 } // function DECTOHEX()

References $out, $r, $x, _nbrConversionFormat(), PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ DECTOOCT()

static PHPExcel_Calculation_Engineering::DECTOOCT (   $x,
  $places = null 
)
static

Definition at line 1338 of file Engineering.php.

1338 {
1341
1342 if (is_bool($x)) {
1344 $x = (int) $x;
1345 } else {
1347 }
1348 }
1349 $x = (string) $x;
1350 if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) {
1352 }
1353 $x = (string) floor($x);
1354 $r = decoct($x);
1355 if (strlen($r) == 11) {
1356 // Two's Complement
1357 $r = substr($r,-10);
1358 }
1359
1360 return self::_nbrConversionFormat($r,$places);
1361 } // function DECTOOCT()

References $out, $r, $x, _nbrConversionFormat(), PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ DELTA()

static PHPExcel_Calculation_Engineering::DELTA (   $a,
  $b = 0 
)
static

DELTA.

Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise. Use this function to filter a set of values. For example, by summing several DELTA functions you calculate the count of equal pairs. This function is also known as the Kronecker Delta function.

Excel Function: DELTA(a[,b])

Parameters
float$aThe first number.
float$bThe second number. If omitted, b is assumed to be zero.
Returns
int

Definition at line 2192 of file Engineering.php.

2192 {
2195
2196 return (int) ($a == $b);
2197 } // function DELTA()

References PHPExcel_Calculation_Functions\flattenSingleValue().

+ Here is the call graph for this function:

◆ ERF()

static PHPExcel_Calculation_Engineering::ERF (   $lower,
  $upper = NULL 
)
static

ERF.

Returns the error function integrated between the lower and upper bound arguments.

Note: In Excel 2007 or earlier, if you input a negative value for the upper or lower bound arguments, the function would return a #NUM! error. However, in Excel 2010, the function algorithm was improved, so that it can now calculate the function for both positive and negative ranges. PHPExcel follows Excel 2010 behaviour, and accepts nagative arguments.

Excel Function: ERF(lower[,upper])

Parameters
float$lowerlower bound for integrating ERF
float$upperupper bound for integrating ERF. If omitted, ERF integrates between zero and lower_limit
Returns
float

Definition at line 2268 of file Engineering.php.

2268 {
2271
2272 if (is_numeric($lower)) {
2273 if (is_null($upper)) {
2274 return self::_erfVal($lower);
2275 }
2276 if (is_numeric($upper)) {
2277 return self::_erfVal($upper) - self::_erfVal($lower);
2278 }
2279 }
2281 } // function ERF()

References _erfVal(), PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ ERFC()

static PHPExcel_Calculation_Engineering::ERFC (   $x)
static

ERFC.

Returns the complementary ERF function integrated between x and infinity

Note: In Excel 2007 or earlier, if you input a negative value for the lower bound argument, the function would return a #NUM! error. However, in Excel 2010, the function algorithm was improved, so that it can now calculate the function for both positive and negative x values. PHPExcel follows Excel 2010 behaviour, and accepts nagative arguments.

Excel Function: ERFC(x)

Parameters
float$xThe lower bound for integrating ERFC
Returns
float

Definition at line 2332 of file Engineering.php.

2332 {
2334
2335 if (is_numeric($x)) {
2336 return self::_erfcVal($x);
2337 }
2339 } // function ERFC()

References $x, _erfcVal(), PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by _erfcVal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GESTEP()

static PHPExcel_Calculation_Engineering::GESTEP (   $number,
  $step = 0 
)
static

GESTEP.

Excel Function: GESTEP(number[,step])

Returns 1 if number >= step; returns 0 (zero) otherwise Use this function to filter a set of values. For example, by summing several GESTEP functions you calculate the count of values that exceed a threshold.

Parameters
float$numberThe value to test against step.
float$stepThe threshold value. If you omit a value for step, GESTEP uses zero.
Returns
int

Definition at line 2215 of file Engineering.php.

2215 {
2218
2219 return (int) ($number >= $step);
2220 } // function GESTEP()
foreach($_REQUEST as $var) foreach(array('_POST'=> 'HTTP_POST_VARS', '_GET'=> 'HTTP_GET_VARS', '_COOKIE'=> 'HTTP_COOKIE_VARS', '_SERVER'=> 'HTTP_SERVER_VARS', '_ENV'=> 'HTTP_ENV_VARS', '_FILES'=> 'HTTP_POST_FILES') as $array=> $other) $step
Definition: cssgen.php:155

References $step, and PHPExcel_Calculation_Functions\flattenSingleValue().

+ Here is the call graph for this function:

◆ getConversionGroups()

static PHPExcel_Calculation_Engineering::getConversionGroups ( )
static

getConversionGroups Returns a list of the different conversion groups for UOM conversions

Returns
array

Definition at line 2348 of file Engineering.php.

2348 {
2349 $conversionGroups = array();
2350 foreach(self::$_conversionUnits as $conversionUnit) {
2351 $conversionGroups[] = $conversionUnit['Group'];
2352 }
2353 return array_merge(array_unique($conversionGroups));
2354 } // function getConversionGroups()

Referenced by EngineeringTest\testGetConversionGroups().

+ Here is the caller graph for this function:

◆ getConversionGroupUnitDetails()

static PHPExcel_Calculation_Engineering::getConversionGroupUnitDetails (   $group = NULL)
static

getConversionGroupUnitDetails

Parameters
string$groupThe group whose units of measure you want to retrieve
Returns
array

Definition at line 2381 of file Engineering.php.

2381 {
2382 $conversionGroups = array();
2383 foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) {
2384 if ((is_null($group)) || ($conversionGroup['Group'] == $group)) {
2385 $conversionGroups[$conversionGroup['Group']][] = array( 'unit' => $conversionUnit,
2386 'description' => $conversionGroup['Unit Name']
2387 );
2388 }
2389 }
2390 return $conversionGroups;
2391 } // function getConversionGroupUnitDetails()

Referenced by EngineeringTest\testGetConversionGroupUnitDetails().

+ Here is the caller graph for this function:

◆ getConversionGroupUnits()

static PHPExcel_Calculation_Engineering::getConversionGroupUnits (   $group = NULL)
static

getConversionGroupUnits Returns an array of units of measure, for a specified conversion group, or for all groups

Parameters
string$groupThe group whose units of measure you want to retrieve
Returns
array

Definition at line 2364 of file Engineering.php.

2364 {
2365 $conversionGroups = array();
2366 foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) {
2367 if ((is_null($group)) || ($conversionGroup['Group'] == $group)) {
2368 $conversionGroups[$conversionGroup['Group']][] = $conversionUnit;
2369 }
2370 }
2371 return $conversionGroups;
2372 } // function getConversionGroupUnits()

Referenced by EngineeringTest\testGetConversionGroupUnits().

+ Here is the caller graph for this function:

◆ getConversionMultipliers()

static PHPExcel_Calculation_Engineering::getConversionMultipliers ( )
static

getConversionMultipliers Returns an array of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM()

Returns
array of mixed

Definition at line 2400 of file Engineering.php.

2400 {
2402 } // function getConversionGroups()

References $_conversionMultipliers.

Referenced by EngineeringTest\testGetConversionMultipliers().

+ Here is the caller graph for this function:

◆ HEXTOBIN()

static PHPExcel_Calculation_Engineering::HEXTOBIN (   $x,
  $places = null 
)
static

Definition at line 1395 of file Engineering.php.

1395 {
1398
1399 if (is_bool($x)) {
1401 }
1402 $x = (string) $x;
1403 if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) {
1405 }
1406 $binVal = decbin(hexdec($x));
1407
1408 return substr(self::_nbrConversionFormat($binVal,$places),-10);
1409 } // function HEXTOBIN()

References $out, $x, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ HEXTODEC()

static PHPExcel_Calculation_Engineering::HEXTODEC (   $x)
static

Definition at line 1431 of file Engineering.php.

1431 {
1433
1434 if (is_bool($x)) {
1436 }
1437 $x = (string) $x;
1438 if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) {
1440 }
1441 return hexdec($x);
1442 } // function HEXTODEC()

References $out, $x, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ HEXTOOCT()

static PHPExcel_Calculation_Engineering::HEXTOOCT (   $x,
  $places = null 
)
static

Definition at line 1477 of file Engineering.php.

1477 {
1480
1481 if (is_bool($x)) {
1483 }
1484 $x = (string) $x;
1485 if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) {
1487 }
1488 $octVal = decoct(hexdec($x));
1489
1490 return self::_nbrConversionFormat($octVal,$places);
1491 } // function HEXTOOCT()

References $out, $x, _nbrConversionFormat(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ IMABS()

static PHPExcel_Calculation_Engineering::IMABS (   $complexNumber)
static

IMABS.

Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format.

Excel Function: IMABS(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the absolute value.
Returns
float

Definition at line 1729 of file Engineering.php.

1729 {
1730 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1731
1732 $parsedComplex = self::_parseComplex($complexNumber);
1733
1734 return sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']));
1735 } // function IMABS()
static _parseComplex($complexNumber)
_parseComplex

References _parseComplex(), and PHPExcel_Calculation_Functions\flattenSingleValue().

+ Here is the call graph for this function:

◆ IMAGINARY()

static PHPExcel_Calculation_Engineering::IMAGINARY (   $complexNumber)
static

Definition at line 1689 of file Engineering.php.

1689 {
1690 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1691
1692 $parsedComplex = self::_parseComplex($complexNumber);
1693 return $parsedComplex['imaginary'];
1694 } // function IMAGINARY()

References _parseComplex(), and PHPExcel_Calculation_Functions\flattenSingleValue().

+ Here is the call graph for this function:

◆ IMARGUMENT()

static PHPExcel_Calculation_Engineering::IMARGUMENT (   $complexNumber)
static

IMARGUMENT.

Returns the argument theta of a complex number, i.e. the angle in radians from the real axis to the representation of the number in polar coordinates.

Excel Function: IMARGUMENT(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the argument theta.
Returns
float

Definition at line 1750 of file Engineering.php.

1750 {
1751 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1752
1753 $parsedComplex = self::_parseComplex($complexNumber);
1754
1755 if ($parsedComplex['real'] == 0.0) {
1756 if ($parsedComplex['imaginary'] == 0.0) {
1757 return 0.0;
1758 } elseif($parsedComplex['imaginary'] < 0.0) {
1759 return M_PI / -2;
1760 } else {
1761 return M_PI / 2;
1762 }
1763 } elseif ($parsedComplex['real'] > 0.0) {
1764 return atan($parsedComplex['imaginary'] / $parsedComplex['real']);
1765 } elseif ($parsedComplex['imaginary'] < 0.0) {
1766 return 0 - (M_PI - atan(abs($parsedComplex['imaginary']) / abs($parsedComplex['real'])));
1767 } else {
1768 return M_PI - atan($parsedComplex['imaginary'] / abs($parsedComplex['real']));
1769 }
1770 } // function IMARGUMENT()

References _parseComplex(), and PHPExcel_Calculation_Functions\flattenSingleValue().

Referenced by IMLN(), IMPOWER(), and IMSQRT().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IMCONJUGATE()

static PHPExcel_Calculation_Engineering::IMCONJUGATE (   $complexNumber)
static

IMCONJUGATE.

Returns the complex conjugate of a complex number in x + yi or x + yj text format.

Excel Function: IMCONJUGATE(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the conjugate.
Returns
string

Definition at line 1784 of file Engineering.php.

1784 {
1785 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1786
1787 $parsedComplex = self::_parseComplex($complexNumber);
1788
1789 if ($parsedComplex['imaginary'] == 0.0) {
1790 return $parsedComplex['real'];
1791 } else {
1792 return self::_cleanComplex( self::COMPLEX( $parsedComplex['real'],
1793 0 - $parsedComplex['imaginary'],
1794 $parsedComplex['suffix']
1795 )
1796 );
1797 }
1798 } // function IMCONJUGATE()
static _cleanComplex($complexNumber)
Cleans the leading characters in a complex number string.

References _cleanComplex(), _parseComplex(), and PHPExcel_Calculation_Functions\flattenSingleValue().

Referenced by IMCOS().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IMCOS()

static PHPExcel_Calculation_Engineering::IMCOS (   $complexNumber)
static

IMCOS.

Returns the cosine of a complex number in x + yi or x + yj text format.

Excel Function: IMCOS(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the cosine.
Returns
string|float

Definition at line 1812 of file Engineering.php.

1812 {
1813 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1814
1815 $parsedComplex = self::_parseComplex($complexNumber);
1816
1817 if ($parsedComplex['imaginary'] == 0.0) {
1818 return cos($parsedComplex['real']);
1819 } else {
1820 return self::IMCONJUGATE(self::COMPLEX(cos($parsedComplex['real']) * cosh($parsedComplex['imaginary']),sin($parsedComplex['real']) * sinh($parsedComplex['imaginary']),$parsedComplex['suffix']));
1821 }
1822 } // function IMCOS()
static IMCONJUGATE($complexNumber)
IMCONJUGATE.

References _parseComplex(), PHPExcel_Calculation_Functions\flattenSingleValue(), and IMCONJUGATE().

+ Here is the call graph for this function:

◆ IMDIV()

static PHPExcel_Calculation_Engineering::IMDIV (   $complexDividend,
  $complexDivisor 
)
static

IMDIV.

Returns the quotient of two complex numbers in x + yi or x + yj text format.

Excel Function: IMDIV(complexDividend,complexDivisor)

Parameters
string$complexDividendThe complex numerator or dividend.
string$complexDivisorThe complex denominator or divisor.
Returns
string

Definition at line 2040 of file Engineering.php.

2040 {
2041 $complexDividend = PHPExcel_Calculation_Functions::flattenSingleValue($complexDividend);
2042 $complexDivisor = PHPExcel_Calculation_Functions::flattenSingleValue($complexDivisor);
2043
2044 $parsedComplexDividend = self::_parseComplex($complexDividend);
2045 $parsedComplexDivisor = self::_parseComplex($complexDivisor);
2046
2047 if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] != '') &&
2048 ($parsedComplexDividend['suffix'] != $parsedComplexDivisor['suffix'])) {
2050 }
2051 if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] == '')) {
2052 $parsedComplexDivisor['suffix'] = $parsedComplexDividend['suffix'];
2053 }
2054
2055 $d1 = ($parsedComplexDividend['real'] * $parsedComplexDivisor['real']) + ($parsedComplexDividend['imaginary'] * $parsedComplexDivisor['imaginary']);
2056 $d2 = ($parsedComplexDividend['imaginary'] * $parsedComplexDivisor['real']) - ($parsedComplexDividend['real'] * $parsedComplexDivisor['imaginary']);
2057 $d3 = ($parsedComplexDivisor['real'] * $parsedComplexDivisor['real']) + ($parsedComplexDivisor['imaginary'] * $parsedComplexDivisor['imaginary']);
2058
2059 $r = $d1/$d3;
2060 $i = $d2/$d3;
2061
2062 if ($i > 0.0) {
2063 return self::_cleanComplex($r.'+'.$i.$parsedComplexDivisor['suffix']);
2064 } elseif ($i < 0.0) {
2065 return self::_cleanComplex($r.$i.$parsedComplexDivisor['suffix']);
2066 } else {
2067 return $r;
2068 }
2069 } // function IMDIV()

References $r, _cleanComplex(), _parseComplex(), PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

+ Here is the call graph for this function:

◆ IMEXP()

static PHPExcel_Calculation_Engineering::IMEXP (   $complexNumber)
static

IMEXP.

Returns the exponential of a complex number in x + yi or x + yj text format.

Excel Function: IMEXP(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the exponential.
Returns
string

Definition at line 1972 of file Engineering.php.

1972 {
1973 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1974
1975 $parsedComplex = self::_parseComplex($complexNumber);
1976
1977 if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
1978 return '1';
1979 }
1980
1981 $e = exp($parsedComplex['real']);
1982 $eX = $e * cos($parsedComplex['imaginary']);
1983 $eY = $e * sin($parsedComplex['imaginary']);
1984
1985 if ($parsedComplex['suffix'] == '') {
1986 return self::COMPLEX($eX,$eY);
1987 } else {
1988 return self::COMPLEX($eX,$eY,$parsedComplex['suffix']);
1989 }
1990 } // function IMEXP()
static COMPLEX($realNumber=0.0, $imaginary=0.0, $suffix='i')

References _parseComplex(), COMPLEX(), and PHPExcel_Calculation_Functions\flattenSingleValue().

+ Here is the call graph for this function:

◆ IMLN()

static PHPExcel_Calculation_Engineering::IMLN (   $complexNumber)
static

IMLN.

Returns the natural logarithm of a complex number in x + yi or x + yj text format.

Excel Function: IMLN(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the natural logarithm.
Returns
string

Definition at line 1889 of file Engineering.php.

1889 {
1890 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1891
1892 $parsedComplex = self::_parseComplex($complexNumber);
1893
1894 if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
1896 }
1897
1898 $logR = log(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));
1899 $t = self::IMARGUMENT($complexNumber);
1900
1901 if ($parsedComplex['suffix'] == '') {
1902 return self::COMPLEX($logR,$t);
1903 } else {
1904 return self::COMPLEX($logR,$t,$parsedComplex['suffix']);
1905 }
1906 } // function IMLN()
static IMARGUMENT($complexNumber)
IMARGUMENT.

References $t, _parseComplex(), COMPLEX(), PHPExcel_Calculation_Functions\flattenSingleValue(), IMARGUMENT(), and PHPExcel_Calculation_Functions\NaN().

+ Here is the call graph for this function:

◆ IMLOG10()

static PHPExcel_Calculation_Engineering::IMLOG10 (   $complexNumber)
static

IMLOG10.

Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format.

Excel Function: IMLOG10(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the common logarithm.
Returns
string

Definition at line 1920 of file Engineering.php.

1920 {
1921 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1922
1923 $parsedComplex = self::_parseComplex($complexNumber);
1924
1925 if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
1927 } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
1928 return log10($parsedComplex['real']);
1929 }
1930
1931 return self::IMPRODUCT(log10(EULER),self::IMLN($complexNumber));
1932 } // function IMLOG10()
const EULER(!defined('PHPEXCEL_ROOT'))
PHPExcel root directory.
Definition: Engineering.php:40

References _parseComplex(), EULER, PHPExcel_Calculation_Functions\flattenSingleValue(), IMPRODUCT(), and PHPExcel_Calculation_Functions\NaN().

+ Here is the call graph for this function:

◆ IMLOG2()

static PHPExcel_Calculation_Engineering::IMLOG2 (   $complexNumber)
static

IMLOG2.

Returns the base-2 logarithm of a complex number in x + yi or x + yj text format.

Excel Function: IMLOG2(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the base-2 logarithm.
Returns
string

Definition at line 1946 of file Engineering.php.

1946 {
1947 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1948
1949 $parsedComplex = self::_parseComplex($complexNumber);
1950
1951 if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
1953 } elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
1954 return log($parsedComplex['real'],2);
1955 }
1956
1957 return self::IMPRODUCT(log(EULER,2),self::IMLN($complexNumber));
1958 } // function IMLOG2()

References _parseComplex(), EULER, PHPExcel_Calculation_Functions\flattenSingleValue(), IMPRODUCT(), and PHPExcel_Calculation_Functions\NaN().

+ Here is the call graph for this function:

◆ IMPOWER()

static PHPExcel_Calculation_Engineering::IMPOWER (   $complexNumber,
  $realNumber 
)
static

IMPOWER.

Returns a complex number in x + yi or x + yj text format raised to a power.

Excel Function: IMPOWER(complexNumber,realNumber)

Parameters
string$complexNumberThe complex number you want to raise to a power.
float$realNumberThe power to which you want to raise the complex number.
Returns
string

Definition at line 2005 of file Engineering.php.

2005 {
2006 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
2007 $realNumber = PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
2008
2009 if (!is_numeric($realNumber)) {
2011 }
2012
2013 $parsedComplex = self::_parseComplex($complexNumber);
2014
2015 $r = sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']));
2016 $rPower = pow($r,$realNumber);
2017 $theta = self::IMARGUMENT($complexNumber) * $realNumber;
2018 if ($theta == 0) {
2019 return 1;
2020 } elseif ($parsedComplex['imaginary'] == 0.0) {
2021 return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex['suffix']);
2022 } else {
2023 return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex['suffix']);
2024 }
2025 } // function IMPOWER()

References $r, _parseComplex(), COMPLEX(), PHPExcel_Calculation_Functions\flattenSingleValue(), IMARGUMENT(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ IMPRODUCT()

static PHPExcel_Calculation_Engineering::IMPRODUCT ( )
static

IMPRODUCT.

Returns the product of two or more complex numbers in x + yi or x + yj text format.

Excel Function: IMPRODUCT(complexNumber[,complexNumber[,...]])

Parameters
string$complexNumber,...Series of complex numbers to multiply
Returns
string

Definition at line 2152 of file Engineering.php.

2152 {
2153 // Return value
2154 $returnValue = self::_parseComplex('1');
2155 $activeSuffix = '';
2156
2157 // Loop through the arguments
2158 $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
2159 foreach ($aArgs as $arg) {
2160 $parsedComplex = self::_parseComplex($arg);
2161
2162 $workValue = $returnValue;
2163 if (($parsedComplex['suffix'] != '') && ($activeSuffix == '')) {
2164 $activeSuffix = $parsedComplex['suffix'];
2165 } elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) {
2167 }
2168 $returnValue['real'] = ($workValue['real'] * $parsedComplex['real']) - ($workValue['imaginary'] * $parsedComplex['imaginary']);
2169 $returnValue['imaginary'] = ($workValue['real'] * $parsedComplex['imaginary']) + ($workValue['imaginary'] * $parsedComplex['real']);
2170 }
2171
2172 if ($returnValue['imaginary'] == 0.0) { $activeSuffix = ''; }
2173 return self::COMPLEX($returnValue['real'],$returnValue['imaginary'],$activeSuffix);
2174 } // function IMPRODUCT()
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
Definition: Functions.php:598

References _parseComplex(), COMPLEX(), PHPExcel_Calculation_Functions\flattenArray(), and PHPExcel_Calculation_Functions\NaN().

Referenced by IMLOG10(), and IMLOG2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IMREAL()

static PHPExcel_Calculation_Engineering::IMREAL (   $complexNumber)
static

Definition at line 1710 of file Engineering.php.

1710 {
1711 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1712
1713 $parsedComplex = self::_parseComplex($complexNumber);
1714 return $parsedComplex['real'];
1715 } // function IMREAL()

References _parseComplex(), and PHPExcel_Calculation_Functions\flattenSingleValue().

+ Here is the call graph for this function:

◆ IMSIN()

static PHPExcel_Calculation_Engineering::IMSIN (   $complexNumber)
static

IMSIN.

Returns the sine of a complex number in x + yi or x + yj text format.

Excel Function: IMSIN(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the sine.
Returns
string|float

Definition at line 1836 of file Engineering.php.

1836 {
1837 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1838
1839 $parsedComplex = self::_parseComplex($complexNumber);
1840
1841 if ($parsedComplex['imaginary'] == 0.0) {
1842 return sin($parsedComplex['real']);
1843 } else {
1844 return self::COMPLEX(sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']),cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']),$parsedComplex['suffix']);
1845 }
1846 } // function IMSIN()

References _parseComplex(), COMPLEX(), and PHPExcel_Calculation_Functions\flattenSingleValue().

+ Here is the call graph for this function:

◆ IMSQRT()

static PHPExcel_Calculation_Engineering::IMSQRT (   $complexNumber)
static

IMSQRT.

Returns the square root of a complex number in x + yi or x + yj text format.

Excel Function: IMSQRT(complexNumber)

Parameters
string$complexNumberThe complex number for which you want the square root.
Returns
string

Definition at line 1860 of file Engineering.php.

1860 {
1861 $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
1862
1863 $parsedComplex = self::_parseComplex($complexNumber);
1864
1865 $theta = self::IMARGUMENT($complexNumber);
1866 $d1 = cos($theta / 2);
1867 $d2 = sin($theta / 2);
1868 $r = sqrt(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));
1869
1870 if ($parsedComplex['suffix'] == '') {
1871 return self::COMPLEX($d1 * $r,$d2 * $r);
1872 } else {
1873 return self::COMPLEX($d1 * $r,$d2 * $r,$parsedComplex['suffix']);
1874 }
1875 } // function IMSQRT()

References $r, _parseComplex(), COMPLEX(), PHPExcel_Calculation_Functions\flattenSingleValue(), and IMARGUMENT().

+ Here is the call graph for this function:

◆ IMSUB()

static PHPExcel_Calculation_Engineering::IMSUB (   $complexNumber1,
  $complexNumber2 
)
static

IMSUB.

Returns the difference of two complex numbers in x + yi or x + yj text format.

Excel Function: IMSUB(complexNumber1,complexNumber2)

Parameters
string$complexNumber1The complex number from which to subtract complexNumber2.
string$complexNumber2The complex number to subtract from complexNumber1.
Returns
string

Definition at line 2084 of file Engineering.php.

2084 {
2085 $complexNumber1 = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber1);
2086 $complexNumber2 = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber2);
2087
2088 $parsedComplex1 = self::_parseComplex($complexNumber1);
2089 $parsedComplex2 = self::_parseComplex($complexNumber2);
2090
2091 if ((($parsedComplex1['suffix'] != '') && ($parsedComplex2['suffix'] != '')) &&
2092 ($parsedComplex1['suffix'] != $parsedComplex2['suffix'])) {
2094 } elseif (($parsedComplex1['suffix'] == '') && ($parsedComplex2['suffix'] != '')) {
2095 $parsedComplex1['suffix'] = $parsedComplex2['suffix'];
2096 }
2097
2098 $d1 = $parsedComplex1['real'] - $parsedComplex2['real'];
2099 $d2 = $parsedComplex1['imaginary'] - $parsedComplex2['imaginary'];
2100
2101 return self::COMPLEX($d1,$d2,$parsedComplex1['suffix']);
2102 } // function IMSUB()

References _parseComplex(), COMPLEX(), PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

+ Here is the call graph for this function:

◆ IMSUM()

static PHPExcel_Calculation_Engineering::IMSUM ( )
static

IMSUM.

Returns the sum of two or more complex numbers in x + yi or x + yj text format.

Excel Function: IMSUM(complexNumber[,complexNumber[,...]])

Parameters
string$complexNumber,...Series of complex numbers to add
Returns
string

Definition at line 2116 of file Engineering.php.

2116 {
2117 // Return value
2118 $returnValue = self::_parseComplex('0');
2119 $activeSuffix = '';
2120
2121 // Loop through the arguments
2122 $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
2123 foreach ($aArgs as $arg) {
2124 $parsedComplex = self::_parseComplex($arg);
2125
2126 if ($activeSuffix == '') {
2127 $activeSuffix = $parsedComplex['suffix'];
2128 } elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) {
2130 }
2131
2132 $returnValue['real'] += $parsedComplex['real'];
2133 $returnValue['imaginary'] += $parsedComplex['imaginary'];
2134 }
2135
2136 if ($returnValue['imaginary'] == 0.0) { $activeSuffix = ''; }
2137 return self::COMPLEX($returnValue['real'],$returnValue['imaginary'],$activeSuffix);
2138 } // function IMSUM()

References _parseComplex(), COMPLEX(), PHPExcel_Calculation_Functions\flattenArray(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ OCTTOBIN()

static PHPExcel_Calculation_Engineering::OCTTOBIN (   $x,
  $places = null 
)
static

Definition at line 1528 of file Engineering.php.

1528 {
1531
1532 if (is_bool($x)) {
1534 }
1535 $x = (string) $x;
1536 if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) {
1538 }
1539 $r = decbin(octdec($x));
1540
1541 return self::_nbrConversionFormat($r,$places);
1542 } // function OCTTOBIN()

References $out, $r, $x, _nbrConversionFormat(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ OCTTODEC()

static PHPExcel_Calculation_Engineering::OCTTODEC (   $x)
static

Definition at line 1564 of file Engineering.php.

1564 {
1566
1567 if (is_bool($x)) {
1569 }
1570 $x = (string) $x;
1571 if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) {
1573 }
1574 return octdec($x);
1575 } // function OCTTODEC()

References $out, $x, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

◆ OCTTOHEX()

static PHPExcel_Calculation_Engineering::OCTTOHEX (   $x,
  $places = null 
)
static

Definition at line 1607 of file Engineering.php.

1607 {
1610
1611 if (is_bool($x)) {
1613 }
1614 $x = (string) $x;
1615 if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) {
1617 }
1618 $hexVal = strtoupper(dechex(octdec($x)));
1619
1620 return self::_nbrConversionFormat($hexVal,$places);
1621 } // function OCTTOHEX()

References $out, $x, _nbrConversionFormat(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

+ Here is the call graph for this function:

Field Documentation

◆ $_conversionMultipliers

PHPExcel_Calculation_Engineering::$_conversionMultipliers
staticprivate
Initial value:
= array( 'Y' => array( 'multiplier' => 1E24, 'name' => 'yotta' ),
'Z' => array( 'multiplier' => 1E21, 'name' => 'zetta' ),
'E' => array( 'multiplier' => 1E18, 'name' => 'exa' ),
'P' => array( 'multiplier' => 1E15, 'name' => 'peta' ),
'T' => array( 'multiplier' => 1E12, 'name' => 'tera' ),
'G' => array( 'multiplier' => 1E9, 'name' => 'giga' ),
'M' => array( 'multiplier' => 1E6, 'name' => 'mega' ),
'k' => array( 'multiplier' => 1E3, 'name' => 'kilo' ),
'h' => array( 'multiplier' => 1E2, 'name' => 'hecto' ),
'e' => array( 'multiplier' => 1E1, 'name' => 'deka' ),
'd' => array( 'multiplier' => 1E-1, 'name' => 'deci' ),
'c' => array( 'multiplier' => 1E-2, 'name' => 'centi' ),
'm' => array( 'multiplier' => 1E-3, 'name' => 'milli' ),
'u' => array( 'multiplier' => 1E-6, 'name' => 'micro' ),
'n' => array( 'multiplier' => 1E-9, 'name' => 'nano' ),
'p' => array( 'multiplier' => 1E-12, 'name' => 'pico' ),
'f' => array( 'multiplier' => 1E-15, 'name' => 'femto' ),
'a' => array( 'multiplier' => 1E-18, 'name' => 'atto' ),
'z' => array( 'multiplier' => 1E-21, 'name' => 'zepto' ),
'y' => array( 'multiplier' => 1E-24, 'name' => 'yocto' )
)

Definition at line 127 of file Engineering.php.

Referenced by getConversionMultipliers().

◆ $_conversionUnits

PHPExcel_Calculation_Engineering::$_conversionUnits
staticprivate

Definition at line 57 of file Engineering.php.

◆ $_one_sqrtpi

PHPExcel_Calculation_Engineering::$_one_sqrtpi = 0.564189583547756287
staticprivate

Definition at line 2287 of file Engineering.php.

◆ $_two_sqrtpi

PHPExcel_Calculation_Engineering::$_two_sqrtpi = 1.128379167095512574
staticprivate

Definition at line 2226 of file Engineering.php.

◆ $_unitConversions

PHPExcel_Calculation_Engineering::$_unitConversions
staticprivate

Definition at line 154 of file Engineering.php.


The documentation for this class was generated from the following file: