30 if (!
defined(
'PHPEXCEL_ROOT')) {
34 define(
'PHPEXCEL_ROOT', dirname(__FILE__) .
'/../../');
35 require(PHPEXCEL_ROOT .
'PHPExcel/Autoloader.php');
40 define(
'EULER', 2.71828182845904523536);
58 'sg' =>
array(
'Group' =>
'Mass',
'Unit Name' =>
'Slug',
'AllowPrefix' => False ),
59 'lbm' =>
array(
'Group' =>
'Mass',
'Unit Name' =>
'Pound mass (avoirdupois)',
'AllowPrefix' => False ),
60 'u' =>
array(
'Group' =>
'Mass',
'Unit Name' =>
'U (atomic mass unit)',
'AllowPrefix' => True ),
61 'ozm' =>
array(
'Group' =>
'Mass',
'Unit Name' =>
'Ounce mass (avoirdupois)',
'AllowPrefix' => False ),
62 'm' =>
array(
'Group' =>
'Distance',
'Unit Name' =>
'Meter',
'AllowPrefix' => True ),
63 'mi' =>
array(
'Group' =>
'Distance',
'Unit Name' =>
'Statute mile',
'AllowPrefix' => False ),
64 'Nmi' =>
array(
'Group' =>
'Distance',
'Unit Name' =>
'Nautical mile',
'AllowPrefix' => False ),
65 'in' =>
array(
'Group' =>
'Distance',
'Unit Name' =>
'Inch',
'AllowPrefix' => False ),
66 'ft' =>
array(
'Group' =>
'Distance',
'Unit Name' =>
'Foot',
'AllowPrefix' => False ),
67 'yd' =>
array(
'Group' =>
'Distance',
'Unit Name' =>
'Yard',
'AllowPrefix' => False ),
68 'ang' =>
array(
'Group' =>
'Distance',
'Unit Name' =>
'Angstrom',
'AllowPrefix' => True ),
69 'Pica' =>
array(
'Group' =>
'Distance',
'Unit Name' =>
'Pica (1/72 in)',
'AllowPrefix' => False ),
70 'yr' =>
array(
'Group' =>
'Time',
'Unit Name' =>
'Year',
'AllowPrefix' => False ),
71 'day' =>
array(
'Group' =>
'Time',
'Unit Name' =>
'Day',
'AllowPrefix' => False ),
72 'hr' =>
array(
'Group' =>
'Time',
'Unit Name' =>
'Hour',
'AllowPrefix' => False ),
73 'mn' =>
array(
'Group' =>
'Time',
'Unit Name' =>
'Minute',
'AllowPrefix' => False ),
74 'sec' =>
array(
'Group' =>
'Time',
'Unit Name' =>
'Second',
'AllowPrefix' => True ),
75 'Pa' =>
array(
'Group' =>
'Pressure',
'Unit Name' =>
'Pascal',
'AllowPrefix' => True ),
76 'p' =>
array(
'Group' =>
'Pressure',
'Unit Name' =>
'Pascal',
'AllowPrefix' => True ),
77 'atm' =>
array(
'Group' =>
'Pressure',
'Unit Name' =>
'Atmosphere',
'AllowPrefix' => True ),
78 'at' =>
array(
'Group' =>
'Pressure',
'Unit Name' =>
'Atmosphere',
'AllowPrefix' => True ),
79 'mmHg' =>
array(
'Group' =>
'Pressure',
'Unit Name' =>
'mm of Mercury',
'AllowPrefix' => True ),
80 'N' =>
array(
'Group' =>
'Force',
'Unit Name' =>
'Newton',
'AllowPrefix' => True ),
81 'dyn' =>
array(
'Group' =>
'Force',
'Unit Name' =>
'Dyne',
'AllowPrefix' => True ),
82 'dy' =>
array(
'Group' =>
'Force',
'Unit Name' =>
'Dyne',
'AllowPrefix' => True ),
83 'lbf' =>
array(
'Group' =>
'Force',
'Unit Name' =>
'Pound force',
'AllowPrefix' => False ),
84 'J' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Joule',
'AllowPrefix' => True ),
85 'e' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Erg',
'AllowPrefix' => True ),
86 'c' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Thermodynamic calorie',
'AllowPrefix' => True ),
87 'cal' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'IT calorie',
'AllowPrefix' => True ),
88 'eV' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Electron volt',
'AllowPrefix' => True ),
89 'ev' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Electron volt',
'AllowPrefix' => True ),
90 'HPh' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Horsepower-hour',
'AllowPrefix' => False ),
91 'hh' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Horsepower-hour',
'AllowPrefix' => False ),
92 'Wh' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Watt-hour',
'AllowPrefix' => True ),
93 'wh' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Watt-hour',
'AllowPrefix' => True ),
94 'flb' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'Foot-pound',
'AllowPrefix' => False ),
95 'BTU' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'BTU',
'AllowPrefix' => False ),
96 'btu' =>
array(
'Group' =>
'Energy',
'Unit Name' =>
'BTU',
'AllowPrefix' => False ),
97 'HP' =>
array(
'Group' =>
'Power',
'Unit Name' =>
'Horsepower',
'AllowPrefix' => False ),
98 'h' =>
array(
'Group' =>
'Power',
'Unit Name' =>
'Horsepower',
'AllowPrefix' => False ),
99 'W' =>
array(
'Group' =>
'Power',
'Unit Name' =>
'Watt',
'AllowPrefix' => True ),
100 'w' =>
array(
'Group' =>
'Power',
'Unit Name' =>
'Watt',
'AllowPrefix' => True ),
101 'T' =>
array(
'Group' =>
'Magnetism',
'Unit Name' =>
'Tesla',
'AllowPrefix' => True ),
102 'ga' =>
array(
'Group' =>
'Magnetism',
'Unit Name' =>
'Gauss',
'AllowPrefix' => True ),
103 'C' =>
array(
'Group' =>
'Temperature',
'Unit Name' =>
'Celsius',
'AllowPrefix' => False ),
104 'cel' =>
array(
'Group' =>
'Temperature',
'Unit Name' =>
'Celsius',
'AllowPrefix' => False ),
105 'F' =>
array(
'Group' =>
'Temperature',
'Unit Name' =>
'Fahrenheit',
'AllowPrefix' => False ),
106 'fah' =>
array(
'Group' =>
'Temperature',
'Unit Name' =>
'Fahrenheit',
'AllowPrefix' => False ),
107 'K' =>
array(
'Group' =>
'Temperature',
'Unit Name' =>
'Kelvin',
'AllowPrefix' => False ),
108 'kel' =>
array(
'Group' =>
'Temperature',
'Unit Name' =>
'Kelvin',
'AllowPrefix' => False ),
109 'tsp' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'Teaspoon',
'AllowPrefix' => False ),
110 'tbs' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'Tablespoon',
'AllowPrefix' => False ),
111 'oz' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'Fluid Ounce',
'AllowPrefix' => False ),
112 'cup' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'Cup',
'AllowPrefix' => False ),
113 'pt' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'U.S. Pint',
'AllowPrefix' => False ),
114 'us_pt' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'U.S. Pint',
'AllowPrefix' => False ),
115 'uk_pt' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'U.K. Pint',
'AllowPrefix' => False ),
116 'qt' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'Quart',
'AllowPrefix' => False ),
117 'gal' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'Gallon',
'AllowPrefix' => False ),
118 'l' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'Litre',
'AllowPrefix' => True ),
119 'lt' =>
array(
'Group' =>
'Liquid',
'Unit Name' =>
'Litre',
'AllowPrefix' => True )
128 'Z' =>
array(
'multiplier' => 1E21,
'name' =>
'zetta' ),
129 'E' =>
array(
'multiplier' => 1E18,
'name' =>
'exa' ),
130 'P' =>
array(
'multiplier' => 1E15,
'name' =>
'peta' ),
131 'T' =>
array(
'multiplier' => 1E12,
'name' =>
'tera' ),
132 'G' =>
array(
'multiplier' => 1E9,
'name' =>
'giga' ),
133 'M' =>
array(
'multiplier' => 1E6,
'name' =>
'mega' ),
134 'k' =>
array(
'multiplier' => 1E3,
'name' =>
'kilo' ),
135 'h' =>
array(
'multiplier' => 1E2,
'name' =>
'hecto' ),
136 'e' =>
array(
'multiplier' => 1E1,
'name' =>
'deka' ),
137 'd' =>
array(
'multiplier' => 1E-1,
'name' =>
'deci' ),
138 'c' =>
array(
'multiplier' => 1E-2,
'name' =>
'centi' ),
139 'm' =>
array(
'multiplier' => 1E-3,
'name' =>
'milli' ),
140 'u' =>
array(
'multiplier' => 1E-6,
'name' =>
'micro' ),
141 'n' =>
array(
'multiplier' => 1E-9,
'name' =>
'nano' ),
142 'p' =>
array(
'multiplier' => 1E-12,
'name' =>
'pico' ),
143 'f' =>
array(
'multiplier' => 1E-15,
'name' =>
'femto' ),
144 'a' =>
array(
'multiplier' => 1E-18,
'name' =>
'atto' ),
145 'z' =>
array(
'multiplier' => 1E-21,
'name' =>
'zepto' ),
146 'y' =>
array(
'multiplier' => 1E-24,
'name' =>
'yocto' )
155 'sg' => 6.85220500053478E-05,
156 'lbm' => 2.20462291469134E-03,
157 'u' => 6.02217000000000E+23,
158 'ozm' => 3.52739718003627E-02
160 'sg' =>
array(
'g' => 1.45938424189287E+04,
162 'lbm' => 3.21739194101647E+01,
163 'u' => 8.78866000000000E+27,
164 'ozm' => 5.14782785944229E+02
166 'lbm' =>
array(
'g' => 4.5359230974881148E+02,
167 'sg' => 3.10810749306493E-02,
169 'u' => 2.73161000000000E+26,
170 'ozm' => 1.60000023429410E+01
172 'u' =>
array(
'g' => 1.66053100460465E-24,
173 'sg' => 1.13782988532950E-28,
174 'lbm' => 3.66084470330684E-27,
176 'ozm' => 5.85735238300524E-26
178 'ozm' =>
array(
'g' => 2.83495152079732E+01,
179 'sg' => 1.94256689870811E-03,
180 'lbm' => 6.24999908478882E-02,
181 'u' => 1.70725600000000E+25,
185 'Distance' =>
array(
'm' =>
array(
'm' => 1.0,
186 'mi' => 6.21371192237334E-04,
187 'Nmi' => 5.39956803455724E-04,
188 'in' => 3.93700787401575E+01,
189 'ft' => 3.28083989501312E+00,
190 'yd' => 1.09361329797891E+00,
191 'ang' => 1.00000000000000E+10,
192 'Pica' => 2.83464566929116E+03
194 'mi' =>
array(
'm' => 1.60934400000000E+03,
196 'Nmi' => 8.68976241900648E-01,
197 'in' => 6.33600000000000E+04,
198 'ft' => 5.28000000000000E+03,
199 'yd' => 1.76000000000000E+03,
200 'ang' => 1.60934400000000E+13,
201 'Pica' => 4.56191999999971E+06
203 'Nmi' =>
array(
'm' => 1.85200000000000E+03,
204 'mi' => 1.15077944802354E+00,
206 'in' => 7.29133858267717E+04,
207 'ft' => 6.07611548556430E+03,
208 'yd' => 2.02537182785694E+03,
209 'ang' => 1.85200000000000E+13,
210 'Pica' => 5.24976377952723E+06
212 'in' =>
array(
'm' => 2.54000000000000E-02,
213 'mi' => 1.57828282828283E-05,
214 'Nmi' => 1.37149028077754E-05,
216 'ft' => 8.33333333333333E-02,
217 'yd' => 2.77777777686643E-02,
218 'ang' => 2.54000000000000E+08,
219 'Pica' => 7.19999999999955E+01
221 'ft' =>
array(
'm' => 3.04800000000000E-01,
222 'mi' => 1.89393939393939E-04,
223 'Nmi' => 1.64578833693305E-04,
224 'in' => 1.20000000000000E+01,
226 'yd' => 3.33333333223972E-01,
227 'ang' => 3.04800000000000E+09,
228 'Pica' => 8.63999999999946E+02
230 'yd' =>
array(
'm' => 9.14400000300000E-01,
231 'mi' => 5.68181818368230E-04,
232 'Nmi' => 4.93736501241901E-04,
233 'in' => 3.60000000118110E+01,
234 'ft' => 3.00000000000000E+00,
236 'ang' => 9.14400000300000E+09,
237 'Pica' => 2.59200000085023E+03
239 'ang' =>
array(
'm' => 1.00000000000000E-10,
240 'mi' => 6.21371192237334E-14,
241 'Nmi' => 5.39956803455724E-14,
242 'in' => 3.93700787401575E-09,
243 'ft' => 3.28083989501312E-10,
244 'yd' => 1.09361329797891E-10,
246 'Pica' => 2.83464566929116E-07
248 'Pica' =>
array(
'm' => 3.52777777777800E-04,
249 'mi' => 2.19205948372629E-07,
250 'Nmi' => 1.90484761219114E-07,
251 'in' => 1.38888888888898E-02,
252 'ft' => 1.15740740740748E-03,
253 'yd' => 3.85802469009251E-04,
254 'ang' => 3.52777777777800E+06,
264 'day' =>
array(
'yr' => 2.73785078713210E-03,
270 'hr' =>
array(
'yr' => 1.14077116130504E-04,
271 'day' => 4.16666666666667E-02,
276 'mn' =>
array(
'yr' => 1.90128526884174E-06,
277 'day' => 6.94444444444444E-04,
278 'hr' => 1.66666666666667E-02,
282 'sec' =>
array(
'yr' => 3.16880878140289E-08,
283 'day' => 1.15740740740741E-05,
284 'hr' => 2.77777777777778E-04,
285 'mn' => 1.66666666666667E-02,
289 'Pressure' =>
array(
'Pa' =>
array(
'Pa' => 1.0,
291 'atm' => 9.86923299998193E-06,
292 'at' => 9.86923299998193E-06,
293 'mmHg' => 7.50061707998627E-03
295 'p' =>
array(
'Pa' => 1.0,
297 'atm' => 9.86923299998193E-06,
298 'at' => 9.86923299998193E-06,
299 'mmHg' => 7.50061707998627E-03
301 'atm' =>
array(
'Pa' => 1.01324996583000E+05,
302 'p' => 1.01324996583000E+05,
307 'at' =>
array(
'Pa' => 1.01324996583000E+05,
308 'p' => 1.01324996583000E+05,
313 'mmHg' =>
array(
'Pa' => 1.33322363925000E+02,
314 'p' => 1.33322363925000E+02,
315 'atm' => 1.31578947368421E-03,
316 'at' => 1.31578947368421E-03,
323 'lbf' => 2.24808923655339E-01
325 'dyn' =>
array(
'N' => 1.0E-5,
328 'lbf' => 2.24808923655339E-06
330 'dy' =>
array(
'N' => 1.0E-5,
333 'lbf' => 2.24808923655339E-06
335 'lbf' =>
array(
'N' => 4.448222,
336 'dyn' => 4.448222E+5,
342 'e' => 9.99999519343231E+06,
343 'c' => 2.39006249473467E-01,
344 'cal' => 2.38846190642017E-01,
345 'eV' => 6.24145700000000E+18,
346 'ev' => 6.24145700000000E+18,
347 'HPh' => 3.72506430801000E-07,
348 'hh' => 3.72506430801000E-07,
349 'Wh' => 2.77777916238711E-04,
350 'wh' => 2.77777916238711E-04,
351 'flb' => 2.37304222192651E+01,
352 'BTU' => 9.47815067349015E-04,
353 'btu' => 9.47815067349015E-04
355 'e' =>
array(
'J' => 1.00000048065700E-07,
357 'c' => 2.39006364353494E-08,
358 'cal' => 2.38846305445111E-08,
359 'eV' => 6.24146000000000E+11,
360 'ev' => 6.24146000000000E+11,
361 'HPh' => 3.72506609848824E-14,
362 'hh' => 3.72506609848824E-14,
363 'Wh' => 2.77778049754611E-11,
364 'wh' => 2.77778049754611E-11,
365 'flb' => 2.37304336254586E-06,
366 'BTU' => 9.47815522922962E-11,
367 'btu' => 9.47815522922962E-11
369 'c' =>
array(
'J' => 4.18399101363672E+00,
370 'e' => 4.18398900257312E+07,
372 'cal' => 9.99330315287563E-01,
373 'eV' => 2.61142000000000E+19,
374 'ev' => 2.61142000000000E+19,
375 'HPh' => 1.55856355899327E-06,
376 'hh' => 1.55856355899327E-06,
377 'Wh' => 1.16222030532950E-03,
378 'wh' => 1.16222030532950E-03,
379 'flb' => 9.92878733152102E+01,
380 'BTU' => 3.96564972437776E-03,
381 'btu' => 3.96564972437776E-03
383 'cal' =>
array(
'J' => 4.18679484613929E+00,
384 'e' => 4.18679283372801E+07,
385 'c' => 1.00067013349059E+00,
387 'eV' => 2.61317000000000E+19,
388 'ev' => 2.61317000000000E+19,
389 'HPh' => 1.55960800463137E-06,
390 'hh' => 1.55960800463137E-06,
391 'Wh' => 1.16299914807955E-03,
392 'wh' => 1.16299914807955E-03,
393 'flb' => 9.93544094443283E+01,
394 'BTU' => 3.96830723907002E-03,
395 'btu' => 3.96830723907002E-03
397 'eV' =>
array(
'J' => 1.60219000146921E-19,
398 'e' => 1.60218923136574E-12,
399 'c' => 3.82933423195043E-20,
400 'cal' => 3.82676978535648E-20,
403 'HPh' => 5.96826078912344E-26,
404 'hh' => 5.96826078912344E-26,
405 'Wh' => 4.45053000026614E-23,
406 'wh' => 4.45053000026614E-23,
407 'flb' => 3.80206452103492E-18,
408 'BTU' => 1.51857982414846E-22,
409 'btu' => 1.51857982414846E-22
411 'ev' =>
array(
'J' => 1.60219000146921E-19,
412 'e' => 1.60218923136574E-12,
413 'c' => 3.82933423195043E-20,
414 'cal' => 3.82676978535648E-20,
417 'HPh' => 5.96826078912344E-26,
418 'hh' => 5.96826078912344E-26,
419 'Wh' => 4.45053000026614E-23,
420 'wh' => 4.45053000026614E-23,
421 'flb' => 3.80206452103492E-18,
422 'BTU' => 1.51857982414846E-22,
423 'btu' => 1.51857982414846E-22
425 'HPh' =>
array(
'J' => 2.68451741316170E+06,
426 'e' => 2.68451612283024E+13,
427 'c' => 6.41616438565991E+05,
428 'cal' => 6.41186757845835E+05,
429 'eV' => 1.67553000000000E+25,
430 'ev' => 1.67553000000000E+25,
433 'Wh' => 7.45699653134593E+02,
434 'wh' => 7.45699653134593E+02,
435 'flb' => 6.37047316692964E+07,
436 'BTU' => 2.54442605275546E+03,
437 'btu' => 2.54442605275546E+03
439 'hh' =>
array(
'J' => 2.68451741316170E+06,
440 'e' => 2.68451612283024E+13,
441 'c' => 6.41616438565991E+05,
442 'cal' => 6.41186757845835E+05,
443 'eV' => 1.67553000000000E+25,
444 'ev' => 1.67553000000000E+25,
447 'Wh' => 7.45699653134593E+02,
448 'wh' => 7.45699653134593E+02,
449 'flb' => 6.37047316692964E+07,
450 'BTU' => 2.54442605275546E+03,
451 'btu' => 2.54442605275546E+03
453 'Wh' =>
array(
'J' => 3.59999820554720E+03,
454 'e' => 3.59999647518369E+10,
455 'c' => 8.60422069219046E+02,
456 'cal' => 8.59845857713046E+02,
457 'eV' => 2.24692340000000E+22,
458 'ev' => 2.24692340000000E+22,
459 'HPh' => 1.34102248243839E-03,
460 'hh' => 1.34102248243839E-03,
463 'flb' => 8.54294774062316E+04,
464 'BTU' => 3.41213254164705E+00,
465 'btu' => 3.41213254164705E+00
467 'wh' =>
array(
'J' => 3.59999820554720E+03,
468 'e' => 3.59999647518369E+10,
469 'c' => 8.60422069219046E+02,
470 'cal' => 8.59845857713046E+02,
471 'eV' => 2.24692340000000E+22,
472 'ev' => 2.24692340000000E+22,
473 'HPh' => 1.34102248243839E-03,
474 'hh' => 1.34102248243839E-03,
477 'flb' => 8.54294774062316E+04,
478 'BTU' => 3.41213254164705E+00,
479 'btu' => 3.41213254164705E+00
481 'flb' =>
array(
'J' => 4.21400003236424E-02,
482 'e' => 4.21399800687660E+05,
483 'c' => 1.00717234301644E-02,
484 'cal' => 1.00649785509554E-02,
485 'eV' => 2.63015000000000E+17,
486 'ev' => 2.63015000000000E+17,
487 'HPh' => 1.56974211145130E-08,
488 'hh' => 1.56974211145130E-08,
489 'Wh' => 1.17055614802000E-05,
490 'wh' => 1.17055614802000E-05,
492 'BTU' => 3.99409272448406E-05,
493 'btu' => 3.99409272448406E-05
495 'BTU' =>
array(
'J' => 1.05505813786749E+03,
496 'e' => 1.05505763074665E+10,
497 'c' => 2.52165488508168E+02,
498 'cal' => 2.51996617135510E+02,
499 'eV' => 6.58510000000000E+21,
500 'ev' => 6.58510000000000E+21,
501 'HPh' => 3.93015941224568E-04,
502 'hh' => 3.93015941224568E-04,
503 'Wh' => 2.93071851047526E-01,
504 'wh' => 2.93071851047526E-01,
505 'flb' => 2.50369750774671E+04,
509 'btu' =>
array(
'J' => 1.05505813786749E+03,
510 'e' => 1.05505763074665E+10,
511 'c' => 2.52165488508168E+02,
512 'cal' => 2.51996617135510E+02,
513 'eV' => 6.58510000000000E+21,
514 'ev' => 6.58510000000000E+21,
515 'HPh' => 3.93015941224568E-04,
516 'hh' => 3.93015941224568E-04,
517 'Wh' => 2.93071851047526E-01,
518 'wh' => 2.93071851047526E-01,
519 'flb' => 2.50369750774671E+04,
526 'W' => 7.45701000000000E+02,
527 'w' => 7.45701000000000E+02
529 'h' =>
array(
'HP' => 1.0,
531 'W' => 7.45701000000000E+02,
532 'w' => 7.45701000000000E+02
534 'W' =>
array(
'HP' => 1.34102006031908E-03,
535 'h' => 1.34102006031908E-03,
539 'w' =>
array(
'HP' => 1.34102006031908E-03,
540 'h' => 1.34102006031908E-03,
545 'Magnetism' =>
array(
'T' =>
array(
'T' => 1.0,
548 'ga' =>
array(
'T' => 0.0001,
552 'Liquid' =>
array(
'tsp' =>
array(
'tsp' => 1.0,
553 'tbs' => 3.33333333333333E-01,
554 'oz' => 1.66666666666667E-01,
555 'cup' => 2.08333333333333E-02,
556 'pt' => 1.04166666666667E-02,
557 'us_pt' => 1.04166666666667E-02,
558 'uk_pt' => 8.67558516821960E-03,
559 'qt' => 5.20833333333333E-03,
560 'gal' => 1.30208333333333E-03,
561 'l' => 4.92999408400710E-03,
562 'lt' => 4.92999408400710E-03
564 'tbs' =>
array(
'tsp' => 3.00000000000000E+00,
566 'oz' => 5.00000000000000E-01,
567 'cup' => 6.25000000000000E-02,
568 'pt' => 3.12500000000000E-02,
569 'us_pt' => 3.12500000000000E-02,
570 'uk_pt' => 2.60267555046588E-02,
571 'qt' => 1.56250000000000E-02,
572 'gal' => 3.90625000000000E-03,
573 'l' => 1.47899822520213E-02,
574 'lt' => 1.47899822520213E-02
576 'oz' =>
array(
'tsp' => 6.00000000000000E+00,
577 'tbs' => 2.00000000000000E+00,
579 'cup' => 1.25000000000000E-01,
580 'pt' => 6.25000000000000E-02,
581 'us_pt' => 6.25000000000000E-02,
582 'uk_pt' => 5.20535110093176E-02,
583 'qt' => 3.12500000000000E-02,
584 'gal' => 7.81250000000000E-03,
585 'l' => 2.95799645040426E-02,
586 'lt' => 2.95799645040426E-02
588 'cup' =>
array(
'tsp' => 4.80000000000000E+01,
589 'tbs' => 1.60000000000000E+01,
590 'oz' => 8.00000000000000E+00,
592 'pt' => 5.00000000000000E-01,
593 'us_pt' => 5.00000000000000E-01,
594 'uk_pt' => 4.16428088074541E-01,
595 'qt' => 2.50000000000000E-01,
596 'gal' => 6.25000000000000E-02,
597 'l' => 2.36639716032341E-01,
598 'lt' => 2.36639716032341E-01
600 'pt' =>
array(
'tsp' => 9.60000000000000E+01,
601 'tbs' => 3.20000000000000E+01,
602 'oz' => 1.60000000000000E+01,
603 'cup' => 2.00000000000000E+00,
606 'uk_pt' => 8.32856176149081E-01,
607 'qt' => 5.00000000000000E-01,
608 'gal' => 1.25000000000000E-01,
609 'l' => 4.73279432064682E-01,
610 'lt' => 4.73279432064682E-01
612 'us_pt' =>
array(
'tsp' => 9.60000000000000E+01,
613 'tbs' => 3.20000000000000E+01,
614 'oz' => 1.60000000000000E+01,
615 'cup' => 2.00000000000000E+00,
618 'uk_pt' => 8.32856176149081E-01,
619 'qt' => 5.00000000000000E-01,
620 'gal' => 1.25000000000000E-01,
621 'l' => 4.73279432064682E-01,
622 'lt' => 4.73279432064682E-01
624 'uk_pt' =>
array(
'tsp' => 1.15266000000000E+02,
625 'tbs' => 3.84220000000000E+01,
626 'oz' => 1.92110000000000E+01,
627 'cup' => 2.40137500000000E+00,
628 'pt' => 1.20068750000000E+00,
629 'us_pt' => 1.20068750000000E+00,
631 'qt' => 6.00343750000000E-01,
632 'gal' => 1.50085937500000E-01,
633 'l' => 5.68260698087162E-01,
634 'lt' => 5.68260698087162E-01
636 'qt' =>
array(
'tsp' => 1.92000000000000E+02,
637 'tbs' => 6.40000000000000E+01,
638 'oz' => 3.20000000000000E+01,
639 'cup' => 4.00000000000000E+00,
640 'pt' => 2.00000000000000E+00,
641 'us_pt' => 2.00000000000000E+00,
642 'uk_pt' => 1.66571235229816E+00,
644 'gal' => 2.50000000000000E-01,
645 'l' => 9.46558864129363E-01,
646 'lt' => 9.46558864129363E-01
648 'gal' =>
array(
'tsp' => 7.68000000000000E+02,
649 'tbs' => 2.56000000000000E+02,
650 'oz' => 1.28000000000000E+02,
651 'cup' => 1.60000000000000E+01,
652 'pt' => 8.00000000000000E+00,
653 'us_pt' => 8.00000000000000E+00,
654 'uk_pt' => 6.66284940919265E+00,
655 'qt' => 4.00000000000000E+00,
657 'l' => 3.78623545651745E+00,
658 'lt' => 3.78623545651745E+00
660 'l' =>
array(
'tsp' => 2.02840000000000E+02,
661 'tbs' => 6.76133333333333E+01,
662 'oz' => 3.38066666666667E+01,
663 'cup' => 4.22583333333333E+00,
664 'pt' => 2.11291666666667E+00,
665 'us_pt' => 2.11291666666667E+00,
666 'uk_pt' => 1.75975569552166E+00,
667 'qt' => 1.05645833333333E+00,
668 'gal' => 2.64114583333333E-01,
672 'lt' =>
array(
'tsp' => 2.02840000000000E+02,
673 'tbs' => 6.76133333333333E+01,
674 'oz' => 3.38066666666667E+01,
675 'cup' => 4.22583333333333E+00,
676 'pt' => 2.11291666666667E+00,
677 'us_pt' => 2.11291666666667E+00,
678 'uk_pt' => 1.75975569552166E+00,
679 'qt' => 1.05645833333333E+00,
680 'gal' => 2.64114583333333E-01,
697 $workString = (
string) $complexNumber;
699 $realNumber = $imaginary = 0;
701 $suffix = substr($workString,-1);
702 if (!is_numeric($suffix)) {
703 $workString = substr($workString,0,-1);
710 if (strlen($workString) > 0) {
711 $leadingSign = (($workString{0} ==
'+') || ($workString{0} ==
'-')) ? 1 : 0;
714 $realNumber = strtok($workString,
'+-');
715 if (strtoupper(substr($realNumber,-1)) ==
'E') {
716 $power = strtok(
'+-');
720 $realNumber = substr($workString,0,strlen($realNumber)+strlen($power)+$leadingSign);
723 $imaginary = substr($workString,strlen($realNumber));
725 if (($imaginary ==
'') && (($realNumber ==
'') || ($realNumber ==
'+') || ($realNumber ==
'-'))) {
726 $imaginary = $realNumber.
'1';
728 }
else if ($imaginary ==
'') {
729 $imaginary = $realNumber;
731 } elseif (($imaginary ==
'+') || ($imaginary ==
'-')) {
736 return array(
'real' => $realNumber,
737 'imaginary' => $imaginary,
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;
765 if (!is_null($places)) {
766 if (strlen($xVal) <= $places) {
767 return substr(str_pad($xVal, $places,
'0', STR_PAD_LEFT), -10);
773 return substr($xVal, -10);
800 if ((is_numeric(
$x)) && (is_numeric($ord))) {
809 $fSqrX = (
$x *
$x) / 4;
812 $fTerm /= ($ordK * ($ordK + $ord));
814 }
while ((abs($fTerm) > 1
e-12) && (++$ordK < 100));
819 $fResult = exp($fXAbs) / sqrt($f_2_PI * $fXAbs);
820 if (($ord & 1) && (
$x < 0)) {
821 $fResult = -$fResult;
852 if ((is_numeric(
$x)) && (is_numeric($ord))) {
862 $fSqrX = (
$x *
$x) / -4;
865 $fTerm /= ($ordK * ($ordK + $ord));
867 }
while ((abs($fTerm) > 1
e-12) && (++$ordK < 100));
869 $f_PI_DIV_2 = M_PI / 2;
870 $f_PI_DIV_4 = M_PI / 4;
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;
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))))));
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))))));
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;
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)))))));
941 if ((is_numeric(
$x)) && (is_numeric($ord))) {
942 if (($ord < 0) || (
$x == 0.0)) {
946 switch(floor($ord)) {
947 case 0 :
return self::_Besselk0(
$x);
949 case 1 :
return self::_Besselk1(
$x);
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;
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);
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);
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);
993 $fRet = sqrt(0.636619772 / $fNum) * sin($fNum - 2.356194491);
1021 if ((is_numeric(
$x)) && (is_numeric($ord))) {
1022 if (($ord < 0) || (
$x == 0.0)) {
1026 switch(floor($ord)) {
1027 case 0 :
return self::_Bessely0(
$x);
1029 case 1 :
return self::_Bessely1(
$x);
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;
1078 if (strlen(
$x) > preg_match_all(
'/[01]/',
$x,
$out)) {
1081 if (strlen(
$x) > 10) {
1083 } elseif (strlen(
$x) == 10) {
1086 return '-'.(512-bindec(
$x));
1131 if (strlen(
$x) > preg_match_all(
'/[01]/',
$x,
$out)) {
1134 if (strlen(
$x) > 10) {
1136 } elseif (strlen(
$x) == 10) {
1138 return str_repeat(
'F',8).substr(strtoupper(dechex(bindec(substr(
$x,-9)))),-2);
1140 $hexVal = (
string) strtoupper(dechex(bindec(
$x)));
1142 return self::_nbrConversionFormat($hexVal,$places);
1185 if (strlen(
$x) > preg_match_all(
'/[01]/',
$x,
$out)) {
1188 if (strlen(
$x) > 10) {
1190 } elseif (strlen(
$x) == 10) {
1192 return str_repeat(
'7',7).substr(strtoupper(decoct(bindec(substr(
$x,-9)))),-3);
1194 $octVal = (
string) decoct(bindec(
$x));
1196 return self::_nbrConversionFormat($octVal,$places);
1240 if (strlen(
$x) > preg_match_all(
'/[-0123456789.]/',
$x,
$out)) {
1245 if (strlen(
$r) == 32) {
1247 $r = substr(
$r,-10);
1248 } elseif (strlen(
$r) > 11) {
1252 return self::_nbrConversionFormat(
$r,$places);
1296 if (strlen(
$x) > preg_match_all(
'/[-0123456789.]/',
$x,
$out)) {
1300 $r = strtoupper(dechex(
$x));
1301 if (strlen(
$r) == 8) {
1306 return self::_nbrConversionFormat(
$r,$places);
1350 if (strlen(
$x) > preg_match_all(
'/[-0123456789.]/',
$x,
$out)) {
1355 if (strlen(
$r) == 11) {
1357 $r = substr(
$r,-10);
1360 return self::_nbrConversionFormat(
$r,$places);
1403 if (strlen(
$x) > preg_match_all(
'/[0123456789ABCDEF]/',strtoupper(
$x),
$out)) {
1406 $binVal = decbin(hexdec(
$x));
1408 return substr(self::_nbrConversionFormat($binVal,$places),-10);
1438 if (strlen(
$x) > preg_match_all(
'/[0123456789ABCDEF]/',strtoupper(
$x),
$out)) {
1485 if (strlen(
$x) > preg_match_all(
'/[0123456789ABCDEF]/',strtoupper(
$x),
$out)) {
1488 $octVal = decoct(hexdec(
$x));
1490 return self::_nbrConversionFormat($octVal,$places);
1536 if (preg_match_all(
'/[01234567]/',
$x,
$out) != strlen(
$x)) {
1539 $r = decbin(octdec(
$x));
1541 return self::_nbrConversionFormat(
$r,$places);
1571 if (preg_match_all(
'/[01234567]/',
$x,
$out) != strlen(
$x)) {
1615 if (preg_match_all(
'/[01234567]/',
$x,
$out) != strlen(
$x)) {
1618 $hexVal = strtoupper(dechex(octdec(
$x)));
1620 return self::_nbrConversionFormat($hexVal,$places);
1640 public static function COMPLEX($realNumber=0.0, $imaginary=0.0, $suffix=
'i') {
1645 if (((is_numeric($realNumber)) && (is_numeric($imaginary))) &&
1646 (($suffix ==
'i') || ($suffix ==
'j') || ($suffix ==
''))) {
1647 $realNumber = (float) $realNumber;
1648 $imaginary = (float) $imaginary;
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;
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;
1667 if ($imaginary > 0) { $imaginary = (
string)
'+'.$imaginary; }
1668 return (
string) $realNumber.$imaginary.$suffix;
1692 $parsedComplex = self::_parseComplex($complexNumber);
1693 return $parsedComplex[
'imaginary'];
1710 public static function IMREAL($complexNumber) {
1713 $parsedComplex = self::_parseComplex($complexNumber);
1714 return $parsedComplex[
'real'];
1729 public static function IMABS($complexNumber) {
1732 $parsedComplex = self::_parseComplex($complexNumber);
1734 return sqrt(($parsedComplex[
'real'] * $parsedComplex[
'real']) + ($parsedComplex[
'imaginary'] * $parsedComplex[
'imaginary']));
1753 $parsedComplex = self::_parseComplex($complexNumber);
1755 if ($parsedComplex[
'real'] == 0.0) {
1756 if ($parsedComplex[
'imaginary'] == 0.0) {
1758 } elseif($parsedComplex[
'imaginary'] < 0.0) {
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'])));
1768 return M_PI - atan($parsedComplex[
'imaginary'] / abs($parsedComplex[
'real']));
1787 $parsedComplex = self::_parseComplex($complexNumber);
1789 if ($parsedComplex[
'imaginary'] == 0.0) {
1790 return $parsedComplex[
'real'];
1792 return self::_cleanComplex( self::COMPLEX( $parsedComplex[
'real'],
1793 0 - $parsedComplex[
'imaginary'],
1794 $parsedComplex[
'suffix']
1812 public static function IMCOS($complexNumber) {
1815 $parsedComplex = self::_parseComplex($complexNumber);
1817 if ($parsedComplex[
'imaginary'] == 0.0) {
1818 return cos($parsedComplex[
'real']);
1820 return self::IMCONJUGATE(self::COMPLEX(cos($parsedComplex[
'real']) * cosh($parsedComplex[
'imaginary']),sin($parsedComplex[
'real']) * sinh($parsedComplex[
'imaginary']),$parsedComplex[
'suffix']));
1836 public static function IMSIN($complexNumber) {
1839 $parsedComplex = self::_parseComplex($complexNumber);
1841 if ($parsedComplex[
'imaginary'] == 0.0) {
1842 return sin($parsedComplex[
'real']);
1844 return self::COMPLEX(sin($parsedComplex[
'real']) * cosh($parsedComplex[
'imaginary']),cos($parsedComplex[
'real']) * sinh($parsedComplex[
'imaginary']),$parsedComplex[
'suffix']);
1860 public static function IMSQRT($complexNumber) {
1863 $parsedComplex = self::_parseComplex($complexNumber);
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'])));
1870 if ($parsedComplex[
'suffix'] ==
'') {
1871 return self::COMPLEX($d1 *
$r,$d2 * $r);
1873 return self::COMPLEX($d1 *
$r,$d2 * $r,$parsedComplex[
'suffix']);
1889 public static function IMLN($complexNumber) {
1892 $parsedComplex = self::_parseComplex($complexNumber);
1894 if (($parsedComplex[
'real'] == 0.0) && ($parsedComplex[
'imaginary'] == 0.0)) {
1898 $logR = log(sqrt(($parsedComplex[
'real'] * $parsedComplex[
'real']) + ($parsedComplex[
'imaginary'] * $parsedComplex[
'imaginary'])));
1899 $t = self::IMARGUMENT($complexNumber);
1901 if ($parsedComplex[
'suffix'] ==
'') {
1902 return self::COMPLEX($logR,
$t);
1904 return self::COMPLEX($logR,
$t,$parsedComplex[
'suffix']);
1923 $parsedComplex = self::_parseComplex($complexNumber);
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']);
1931 return self::IMPRODUCT(log10(
EULER),self::IMLN($complexNumber));
1946 public static function IMLOG2($complexNumber) {
1949 $parsedComplex = self::_parseComplex($complexNumber);
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);
1957 return self::IMPRODUCT(log(
EULER,2),self::IMLN($complexNumber));
1972 public static function IMEXP($complexNumber) {
1975 $parsedComplex = self::_parseComplex($complexNumber);
1977 if (($parsedComplex[
'real'] == 0.0) && ($parsedComplex[
'imaginary'] == 0.0)) {
1981 $e = exp($parsedComplex[
'real']);
1982 $eX = $e * cos($parsedComplex[
'imaginary']);
1983 $eY = $e * sin($parsedComplex[
'imaginary']);
1985 if ($parsedComplex[
'suffix'] ==
'') {
1986 return self::COMPLEX($eX,$eY);
1988 return self::COMPLEX($eX,$eY,$parsedComplex[
'suffix']);
2005 public static function IMPOWER($complexNumber,$realNumber) {
2009 if (!is_numeric($realNumber)) {
2013 $parsedComplex = self::_parseComplex($complexNumber);
2015 $r = sqrt(($parsedComplex[
'real'] * $parsedComplex[
'real']) + ($parsedComplex[
'imaginary'] * $parsedComplex[
'imaginary']));
2016 $rPower = pow(
$r,$realNumber);
2017 $theta = self::IMARGUMENT($complexNumber) * $realNumber;
2020 } elseif ($parsedComplex[
'imaginary'] == 0.0) {
2021 return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex[
'suffix']);
2023 return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex[
'suffix']);
2040 public static function IMDIV($complexDividend,$complexDivisor) {
2044 $parsedComplexDividend = self::_parseComplex($complexDividend);
2045 $parsedComplexDivisor = self::_parseComplex($complexDivisor);
2047 if (($parsedComplexDividend[
'suffix'] !=
'') && ($parsedComplexDivisor[
'suffix'] !=
'') &&
2048 ($parsedComplexDividend[
'suffix'] != $parsedComplexDivisor[
'suffix'])) {
2051 if (($parsedComplexDividend[
'suffix'] !=
'') && ($parsedComplexDivisor[
'suffix'] ==
'')) {
2052 $parsedComplexDivisor[
'suffix'] = $parsedComplexDividend[
'suffix'];
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']);
2063 return self::_cleanComplex(
$r.
'+'.
$i.$parsedComplexDivisor[
'suffix']);
2064 } elseif (
$i < 0.0) {
2065 return self::_cleanComplex(
$r.$i.$parsedComplexDivisor[
'suffix']);
2084 public static function IMSUB($complexNumber1,$complexNumber2) {
2088 $parsedComplex1 = self::_parseComplex($complexNumber1);
2089 $parsedComplex2 = self::_parseComplex($complexNumber2);
2091 if ((($parsedComplex1[
'suffix'] !=
'') && ($parsedComplex2[
'suffix'] !=
'')) &&
2092 ($parsedComplex1[
'suffix'] != $parsedComplex2[
'suffix'])) {
2094 } elseif (($parsedComplex1[
'suffix'] ==
'') && ($parsedComplex2[
'suffix'] !=
'')) {
2095 $parsedComplex1[
'suffix'] = $parsedComplex2[
'suffix'];
2098 $d1 = $parsedComplex1[
'real'] - $parsedComplex2[
'real'];
2099 $d2 = $parsedComplex1[
'imaginary'] - $parsedComplex2[
'imaginary'];
2101 return self::COMPLEX($d1,$d2,$parsedComplex1[
'suffix']);
2118 $returnValue = self::_parseComplex(
'0');
2123 foreach ($aArgs as $arg) {
2124 $parsedComplex = self::_parseComplex($arg);
2126 if ($activeSuffix ==
'') {
2127 $activeSuffix = $parsedComplex[
'suffix'];
2128 } elseif (($parsedComplex[
'suffix'] !=
'') && ($activeSuffix != $parsedComplex[
'suffix'])) {
2132 $returnValue[
'real'] += $parsedComplex[
'real'];
2133 $returnValue[
'imaginary'] += $parsedComplex[
'imaginary'];
2136 if ($returnValue[
'imaginary'] == 0.0) { $activeSuffix =
''; }
2137 return self::COMPLEX($returnValue[
'real'],$returnValue[
'imaginary'],$activeSuffix);
2154 $returnValue = self::_parseComplex(
'1');
2159 foreach ($aArgs as $arg) {
2160 $parsedComplex = self::_parseComplex($arg);
2162 $workValue = $returnValue;
2163 if (($parsedComplex[
'suffix'] !=
'') && ($activeSuffix ==
'')) {
2164 $activeSuffix = $parsedComplex[
'suffix'];
2165 } elseif (($parsedComplex[
'suffix'] !=
'') && ($activeSuffix != $parsedComplex[
'suffix'])) {
2168 $returnValue[
'real'] = ($workValue[
'real'] * $parsedComplex[
'real']) - ($workValue[
'imaginary'] * $parsedComplex[
'imaginary']);
2169 $returnValue[
'imaginary'] = ($workValue[
'real'] * $parsedComplex[
'imaginary']) + ($workValue[
'imaginary'] * $parsedComplex[
'real']);
2172 if ($returnValue[
'imaginary'] == 0.0) { $activeSuffix =
''; }
2173 return self::COMPLEX($returnValue[
'real'],$returnValue[
'imaginary'],$activeSuffix);
2192 public static function DELTA($a, $b=0) {
2196 return (
int) ($a == $b);
2215 public static function GESTEP($number, $step=0) {
2219 return (
int) ($number >= $step);
2229 if (abs(
$x) > 2.2) {
2230 return 1 - self::_erfcVal(
$x);
2236 $term *= $xsqr / $j;
2237 $sum -= $term / (2 * $j + 1);
2239 $term *= $xsqr / $j;
2240 $sum += $term / (2 * $j + 1);
2245 }
while (abs($term / $sum) >
PRECISION);
2246 return self::$_two_sqrtpi * $sum;
2268 public static function ERF($lower, $upper = NULL) {
2272 if (is_numeric($lower)) {
2273 if (is_null($upper)) {
2274 return self::_erfVal($lower);
2276 if (is_numeric($upper)) {
2277 return self::_erfVal($upper) - self::_erfVal($lower);
2290 if (abs(
$x) < 2.2) {
2291 return 1 - self::_erfVal(
$x);
2294 return 2 - self::ERFC(-
$x);
2299 $q1 = $q2 = $b /
$d;
2311 }
while ((abs($q1 - $q2) / $q2) >
PRECISION);
2312 return self::$_one_sqrtpi * exp(-
$x *
$x) * $q2;
2335 if (is_numeric(
$x)) {
2336 return self::_erfcVal(
$x);
2349 $conversionGroups =
array();
2350 foreach(self::$_conversionUnits as $conversionUnit) {
2351 $conversionGroups[] = $conversionUnit[
'Group'];
2353 return array_merge(array_unique($conversionGroups));
2365 $conversionGroups =
array();
2366 foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) {
2367 if ((is_null($group)) || ($conversionGroup[
'Group'] == $group)) {
2368 $conversionGroups[$conversionGroup[
'Group']][] = $conversionUnit;
2371 return $conversionGroups;
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']
2390 return $conversionGroups;
2401 return self::$_conversionMultipliers;
2426 if (!is_numeric($value)) {
2429 $fromMultiplier = 1.0;
2430 if (isset(self::$_conversionUnits[$fromUOM])) {
2431 $unitGroup1 = self::$_conversionUnits[$fromUOM][
'Group'];
2433 $fromMultiplier = substr($fromUOM,0,1);
2434 $fromUOM = substr($fromUOM,1);
2435 if (isset(self::$_conversionMultipliers[$fromMultiplier])) {
2436 $fromMultiplier = self::$_conversionMultipliers[$fromMultiplier][
'multiplier'];
2440 if ((isset(self::$_conversionUnits[$fromUOM])) && (self::$_conversionUnits[$fromUOM][
'AllowPrefix'])) {
2441 $unitGroup1 = self::$_conversionUnits[$fromUOM][
'Group'];
2446 $value *= $fromMultiplier;
2448 $toMultiplier = 1.0;
2449 if (isset(self::$_conversionUnits[$toUOM])) {
2450 $unitGroup2 = self::$_conversionUnits[$toUOM][
'Group'];
2452 $toMultiplier = substr($toUOM,0,1);
2453 $toUOM = substr($toUOM,1);
2454 if (isset(self::$_conversionMultipliers[$toMultiplier])) {
2455 $toMultiplier = self::$_conversionMultipliers[$toMultiplier][
'multiplier'];
2459 if ((isset(self::$_conversionUnits[$toUOM])) && (self::$_conversionUnits[$toUOM][
'AllowPrefix'])) {
2460 $unitGroup2 = self::$_conversionUnits[$toUOM][
'Group'];
2465 if ($unitGroup1 != $unitGroup2) {
2469 if (($fromUOM == $toUOM) && ($fromMultiplier == $toMultiplier)) {
2472 return $value / $fromMultiplier;
2473 } elseif ($unitGroup1 ==
'Temperature') {
2474 if (($fromUOM ==
'F') || ($fromUOM ==
'fah')) {
2475 if (($toUOM ==
'F') || ($toUOM ==
'fah')) {
2478 $value = (($value - 32) / 1.8);
2479 if (($toUOM ==
'K') || ($toUOM ==
'kel')) {
2484 } elseif ((($fromUOM ==
'K') || ($fromUOM ==
'kel')) &&
2485 (($toUOM ==
'K') || ($toUOM ==
'kel'))) {
2487 } elseif ((($fromUOM ==
'C') || ($fromUOM ==
'cel')) &&
2488 (($toUOM ==
'C') || ($toUOM ==
'cel'))) {
2491 if (($toUOM ==
'F') || ($toUOM ==
'fah')) {
2492 if (($fromUOM ==
'K') || ($fromUOM ==
'kel')) {
2495 return ($value * 1.8) + 32;
2497 if (($toUOM ==
'C') || ($toUOM ==
'cel')) {
2498 return $value - 273.15;
2500 return $value + 273.15;
2502 return ($value * self::$_unitConversions[$unitGroup1][$fromUOM][$toUOM]) / $toMultiplier;
static IMAGINARY($complexNumber)
static IMARGUMENT($complexNumber)
IMARGUMENT.
static IMCOS($complexNumber)
IMCOS.
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
static HEXTOBIN($x, $places=null)
static _parseComplex($complexNumber)
_parseComplex
static $_conversionMultipliers
const PRECISION
PRECISION.
static IMLOG10($complexNumber)
IMLOG10.
static IMEXP($complexNumber)
IMEXP.
static COMPLEX($realNumber=0.0, $imaginary=0.0, $suffix='i')
static _cleanComplex($complexNumber)
Cleans the leading characters in a complex number string.
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
static IMLOG2($complexNumber)
IMLOG2.
static GESTEP($number, $step=0)
GESTEP.
static DECTOBIN($x, $places=NULL)
static IMSQRT($complexNumber)
IMSQRT.
static _nbrConversionFormat($xVal, $places)
Formats a number base string value with leading zeroes.
static IMPOWER($complexNumber, $realNumber)
IMPOWER.
static DELTA($a, $b=0)
DELTA.
static getConversionMultipliers()
getConversionMultipliers Returns an array of the Multiplier prefixes that can be used with Units of M...
static OCTTOHEX($x, $places=null)
static OCTTOBIN($x, $places=null)
static IMREAL($complexNumber)
static IMPRODUCT()
IMPRODUCT.
const COMPATIBILITY_OPENOFFICE
static IMABS($complexNumber)
IMABS.
static IMSUB($complexNumber1, $complexNumber2)
IMSUB.
Create styles array
The data for the language used.
static getCompatibilityMode()
static IMCONJUGATE($complexNumber)
IMCONJUGATE.
static getConversionGroupUnits($group=NULL)
getConversionGroupUnits Returns an array of units of measure, for a specified conversion group...
const EULER(!defined('PHPEXCEL_ROOT'))
PHPExcel root directory.
static IMLN($complexNumber)
IMLN.
static getConversionGroupUnitDetails($group=NULL)
getConversionGroupUnitDetails
static BINTOOCT($x, $places=NULL)
static DECTOOCT($x, $places=null)
static getConversionGroups()
getConversionGroups Returns a list of the different conversion groups for UOM conversions ...
static ERF($lower, $upper=NULL)
ERF.
static BINTOHEX($x, $places=NULL)
static DECTOHEX($x, $places=null)
static CONVERTUOM($value, $fromUOM, $toUOM)
CONVERTUOM.
static IMSIN($complexNumber)
IMSIN.
const COMPATIBILITY_GNUMERIC
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
static IMDIV($complexDividend, $complexDivisor)
IMDIV.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
static HEXTOOCT($x, $places=null)