| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174 | 
							- <?php
 
- /**
 
-  * PHPExcel
 
-  *
 
-  * Copyright (c) 2006 - 2011 PHPExcel
 
-  *
 
-  * This library is free software; you can redistribute it and/or
 
-  * modify it under the terms of the GNU Lesser General Public
 
-  * License as published by the Free Software Foundation; either
 
-  * version 2.1 of the License, or (at your option) any later version.
 
-  *
 
-  * This library is distributed in the hope that it will be useful,
 
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
-  * Lesser General Public License for more details.
 
-  *
 
-  * You should have received a copy of the GNU Lesser General Public
 
-  * License along with this library; if not, write to the Free Software
 
-  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-  *
 
-  * @category	PHPExcel
 
-  * @package		PHPExcel_Calculation
 
-  * @copyright	Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
 
-  * @license		http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt	LGPL
 
-  * @version		1.7.6, 2011-02-27
 
-  */
 
- /** PHPExcel root directory */
 
- if (!defined('PHPEXCEL_ROOT')) {
 
- 	/**
 
- 	 * @ignore
 
- 	 */
 
- 	define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
 
- 	require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
 
- }
 
- /** EULER */
 
- define('EULER', 2.71828182845904523536);
 
- /**
 
-  * PHPExcel_Calculation_Engineering
 
-  *
 
-  * @category	PHPExcel
 
-  * @package		PHPExcel_Calculation
 
-  * @copyright	Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
 
-  */
 
- class PHPExcel_Calculation_Engineering {
 
- 	private static $_conversionUnits = array( 'g'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'Gram',						'AllowPrefix'	=> True		),
 
- 											  'sg'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'Slug',						'AllowPrefix'	=> False	),
 
- 											  'lbm'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'Pound mass (avoirdupois)',	'AllowPrefix'	=> False	),
 
- 											  'u'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'U (atomic mass unit)',		'AllowPrefix'	=> True		),
 
- 											  'ozm'		=> array(	'Group'	=> 'Mass',			'Unit Name'	=> 'Ounce mass (avoirdupois)',	'AllowPrefix'	=> False	),
 
- 											  'm'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Meter',						'AllowPrefix'	=> True		),
 
- 											  'mi'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Statute mile',				'AllowPrefix'	=> False	),
 
- 											  'Nmi'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Nautical mile',				'AllowPrefix'	=> False	),
 
- 											  'in'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Inch',						'AllowPrefix'	=> False	),
 
- 											  'ft'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Foot',						'AllowPrefix'	=> False	),
 
- 											  'yd'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Yard',						'AllowPrefix'	=> False	),
 
- 											  'ang'		=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Angstrom',					'AllowPrefix'	=> True		),
 
- 											  'Pica'	=> array(	'Group'	=> 'Distance',		'Unit Name'	=> 'Pica (1/72 in)',			'AllowPrefix'	=> False	),
 
- 											  'yr'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Year',						'AllowPrefix'	=> False	),
 
- 											  'day'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Day',						'AllowPrefix'	=> False	),
 
- 											  'hr'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Hour',						'AllowPrefix'	=> False	),
 
- 											  'mn'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Minute',					'AllowPrefix'	=> False	),
 
- 											  'sec'		=> array(	'Group'	=> 'Time',			'Unit Name'	=> 'Second',					'AllowPrefix'	=> True		),
 
- 											  'Pa'		=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'Pascal',					'AllowPrefix'	=> True		),
 
- 											  'p'		=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'Pascal',					'AllowPrefix'	=> True		),
 
- 											  'atm'		=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'Atmosphere',				'AllowPrefix'	=> True		),
 
- 											  'at'		=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'Atmosphere',				'AllowPrefix'	=> True		),
 
- 											  'mmHg'	=> array(	'Group'	=> 'Pressure',		'Unit Name'	=> 'mm of Mercury',				'AllowPrefix'	=> True		),
 
- 											  'N'		=> array(	'Group'	=> 'Force',			'Unit Name'	=> 'Newton',					'AllowPrefix'	=> True		),
 
- 											  'dyn'		=> array(	'Group'	=> 'Force',			'Unit Name'	=> 'Dyne',						'AllowPrefix'	=> True		),
 
- 											  'dy'		=> array(	'Group'	=> 'Force',			'Unit Name'	=> 'Dyne',						'AllowPrefix'	=> True		),
 
- 											  'lbf'		=> array(	'Group'	=> 'Force',			'Unit Name'	=> 'Pound force',				'AllowPrefix'	=> False	),
 
- 											  'J'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Joule',						'AllowPrefix'	=> True		),
 
- 											  'e'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Erg',						'AllowPrefix'	=> True		),
 
- 											  'c'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Thermodynamic calorie',		'AllowPrefix'	=> True		),
 
- 											  'cal'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'IT calorie',				'AllowPrefix'	=> True		),
 
- 											  'eV'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Electron volt',				'AllowPrefix'	=> True		),
 
- 											  'ev'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Electron volt',				'AllowPrefix'	=> True		),
 
- 											  'HPh'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Horsepower-hour',			'AllowPrefix'	=> False	),
 
- 											  'hh'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Horsepower-hour',			'AllowPrefix'	=> False	),
 
- 											  'Wh'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Watt-hour',					'AllowPrefix'	=> True		),
 
- 											  'wh'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Watt-hour',					'AllowPrefix'	=> True		),
 
- 											  'flb'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'Foot-pound',				'AllowPrefix'	=> False	),
 
- 											  'BTU'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'BTU',						'AllowPrefix'	=> False	),
 
- 											  'btu'		=> array(	'Group'	=> 'Energy',		'Unit Name'	=> 'BTU',						'AllowPrefix'	=> False	),
 
- 											  'HP'		=> array(	'Group'	=> 'Power',			'Unit Name'	=> 'Horsepower',				'AllowPrefix'	=> False	),
 
- 											  'h'		=> array(	'Group'	=> 'Power',			'Unit Name'	=> 'Horsepower',				'AllowPrefix'	=> False	),
 
- 											  'W'		=> array(	'Group'	=> 'Power',			'Unit Name'	=> 'Watt',						'AllowPrefix'	=> True		),
 
- 											  'w'		=> array(	'Group'	=> 'Power',			'Unit Name'	=> 'Watt',						'AllowPrefix'	=> True		),
 
- 											  'T'		=> array(	'Group'	=> 'Magnetism',		'Unit Name'	=> 'Tesla',						'AllowPrefix'	=> True		),
 
- 											  'ga'		=> array(	'Group'	=> 'Magnetism',		'Unit Name'	=> 'Gauss',						'AllowPrefix'	=> True		),
 
- 											  'C'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Celsius',					'AllowPrefix'	=> False	),
 
- 											  'cel'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Celsius',					'AllowPrefix'	=> False	),
 
- 											  'F'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Fahrenheit',				'AllowPrefix'	=> False	),
 
- 											  'fah'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Fahrenheit',				'AllowPrefix'	=> False	),
 
- 											  'K'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Kelvin',					'AllowPrefix'	=> False	),
 
- 											  'kel'		=> array(	'Group'	=> 'Temperature',	'Unit Name'	=> 'Kelvin',					'AllowPrefix'	=> False	),
 
- 											  'tsp'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Teaspoon',					'AllowPrefix'	=> False	),
 
- 											  'tbs'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Tablespoon',				'AllowPrefix'	=> False	),
 
- 											  'oz'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Fluid Ounce',				'AllowPrefix'	=> False	),
 
- 											  'cup'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Cup',						'AllowPrefix'	=> False	),
 
- 											  'pt'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'U.S. Pint',					'AllowPrefix'	=> False	),
 
- 											  'us_pt'	=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'U.S. Pint',					'AllowPrefix'	=> False	),
 
- 											  'uk_pt'	=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'U.K. Pint',					'AllowPrefix'	=> False	),
 
- 											  'qt'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Quart',						'AllowPrefix'	=> False	),
 
- 											  'gal'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Gallon',					'AllowPrefix'	=> False	),
 
- 											  'l'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Litre',						'AllowPrefix'	=> True		),
 
- 											  'lt'		=> array(	'Group'	=> 'Liquid',		'Unit Name'	=> 'Litre',						'AllowPrefix'	=> True		)
 
- 											);
 
- 	private static $_conversionMultipliers = 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'	)
 
- 												 );
 
- 	private static $_unitConversions = array(	'Mass'		=> array(	'g'		=> array(	'g'		=> 1.0,
 
- 																							'sg'	=> 6.85220500053478E-05,
 
- 																							'lbm'	=> 2.20462291469134E-03,
 
- 																							'u'		=> 6.02217000000000E+23,
 
- 																							'ozm'	=> 3.52739718003627E-02
 
- 																						),
 
- 																		'sg'	=> array(	'g'		=> 1.45938424189287E+04,
 
- 																							'sg'	=> 1.0,
 
- 																							'lbm'	=> 3.21739194101647E+01,
 
- 																							'u'		=> 8.78866000000000E+27,
 
- 																							'ozm'	=> 5.14782785944229E+02
 
- 																						),
 
- 																		'lbm'	=> array(	'g'		=> 4.5359230974881148E+02,
 
- 																							'sg'	=> 3.10810749306493E-02,
 
- 																							'lbm'	=> 1.0,
 
- 																							'u'		=> 2.73161000000000E+26,
 
- 																							'ozm'	=> 1.60000023429410E+01
 
- 																						),
 
- 																		'u'		=> array(	'g'		=> 1.66053100460465E-24,
 
- 																							'sg'	=> 1.13782988532950E-28,
 
- 																							'lbm'	=> 3.66084470330684E-27,
 
- 																							'u'		=> 1.0,
 
- 																							'ozm'	=> 5.85735238300524E-26
 
- 																						),
 
- 																		'ozm'	=> array(	'g'		=> 2.83495152079732E+01,
 
- 																							'sg'	=> 1.94256689870811E-03,
 
- 																							'lbm'	=> 6.24999908478882E-02,
 
- 																							'u'		=> 1.70725600000000E+25,
 
- 																							'ozm'	=> 1.0
 
- 																						)
 
- 																	),
 
- 												'Distance'	=> array(	'm'		=> array(	'm'		=> 1.0,
 
- 																							'mi'	=> 6.21371192237334E-04,
 
- 																							'Nmi'	=> 5.39956803455724E-04,
 
- 																							'in'	=> 3.93700787401575E+01,
 
- 																							'ft'	=> 3.28083989501312E+00,
 
- 																							'yd'	=> 1.09361329797891E+00,
 
- 																							'ang'	=> 1.00000000000000E+10,
 
- 																							'Pica'	=> 2.83464566929116E+03
 
- 																						),
 
- 																		'mi'	=> array(	'm'		=> 1.60934400000000E+03,
 
- 																							'mi'	=> 1.0,
 
- 																							'Nmi'	=> 8.68976241900648E-01,
 
- 																							'in'	=> 6.33600000000000E+04,
 
- 																							'ft'	=> 5.28000000000000E+03,
 
- 																							'yd'	=> 1.76000000000000E+03,
 
- 																							'ang'	=> 1.60934400000000E+13,
 
- 																							'Pica'	=> 4.56191999999971E+06
 
- 																						),
 
- 																		'Nmi'	=> array(	'm'		=> 1.85200000000000E+03,
 
- 																							'mi'	=> 1.15077944802354E+00,
 
- 																							'Nmi'	=> 1.0,
 
- 																							'in'	=> 7.29133858267717E+04,
 
- 																							'ft'	=> 6.07611548556430E+03,
 
- 																							'yd'	=> 2.02537182785694E+03,
 
- 																							'ang'	=> 1.85200000000000E+13,
 
- 																							'Pica'	=> 5.24976377952723E+06
 
- 																						),
 
- 																		'in'	=> array(	'm'		=> 2.54000000000000E-02,
 
- 																							'mi'	=> 1.57828282828283E-05,
 
- 																							'Nmi'	=> 1.37149028077754E-05,
 
- 																							'in'	=> 1.0,
 
- 																							'ft'	=> 8.33333333333333E-02,
 
- 																							'yd'	=> 2.77777777686643E-02,
 
- 																							'ang'	=> 2.54000000000000E+08,
 
- 																							'Pica'	=> 7.19999999999955E+01
 
- 																						),
 
- 																		'ft'	=> array(	'm'		=> 3.04800000000000E-01,
 
- 																							'mi'	=> 1.89393939393939E-04,
 
- 																							'Nmi'	=> 1.64578833693305E-04,
 
- 																							'in'	=> 1.20000000000000E+01,
 
- 																							'ft'	=> 1.0,
 
- 																							'yd'	=> 3.33333333223972E-01,
 
- 																							'ang'	=> 3.04800000000000E+09,
 
- 																							'Pica'	=> 8.63999999999946E+02
 
- 																						),
 
- 																		'yd'	=> array(	'm'		=> 9.14400000300000E-01,
 
- 																							'mi'	=> 5.68181818368230E-04,
 
- 																							'Nmi'	=> 4.93736501241901E-04,
 
- 																							'in'	=> 3.60000000118110E+01,
 
- 																							'ft'	=> 3.00000000000000E+00,
 
- 																							'yd'	=> 1.0,
 
- 																							'ang'	=> 9.14400000300000E+09,
 
- 																							'Pica'	=> 2.59200000085023E+03
 
- 																						),
 
- 																		'ang'	=> array(	'm'		=> 1.00000000000000E-10,
 
- 																							'mi'	=> 6.21371192237334E-14,
 
- 																							'Nmi'	=> 5.39956803455724E-14,
 
- 																							'in'	=> 3.93700787401575E-09,
 
- 																							'ft'	=> 3.28083989501312E-10,
 
- 																							'yd'	=> 1.09361329797891E-10,
 
- 																							'ang'	=> 1.0,
 
- 																							'Pica'	=> 2.83464566929116E-07
 
- 																						),
 
- 																		'Pica'	=> array(	'm'		=> 3.52777777777800E-04,
 
- 																							'mi'	=> 2.19205948372629E-07,
 
- 																							'Nmi'	=> 1.90484761219114E-07,
 
- 																							'in'	=> 1.38888888888898E-02,
 
- 																							'ft'	=> 1.15740740740748E-03,
 
- 																							'yd'	=> 3.85802469009251E-04,
 
- 																							'ang'	=> 3.52777777777800E+06,
 
- 																							'Pica'	=> 1.0
 
- 																						)
 
- 																	),
 
- 												'Time'		=> array(	'yr'	=> array(	'yr'		=> 1.0,
 
- 																							'day'		=> 365.25,
 
- 																							'hr'		=> 8766.0,
 
- 																							'mn'		=> 525960.0,
 
- 																							'sec'		=> 31557600.0
 
- 																						),
 
- 																		'day'	=> array(	'yr'		=> 2.73785078713210E-03,
 
- 																							'day'		=> 1.0,
 
- 																							'hr'		=> 24.0,
 
- 																							'mn'		=> 1440.0,
 
- 																							'sec'		=> 86400.0
 
- 																						),
 
- 																		'hr'	=> array(	'yr'		=> 1.14077116130504E-04,
 
- 																							'day'		=> 4.16666666666667E-02,
 
- 																							'hr'		=> 1.0,
 
- 																							'mn'		=> 60.0,
 
- 																							'sec'		=> 3600.0
 
- 																						),
 
- 																		'mn'	=> array(	'yr'		=> 1.90128526884174E-06,
 
- 																							'day'		=> 6.94444444444444E-04,
 
- 																							'hr'		=> 1.66666666666667E-02,
 
- 																							'mn'		=> 1.0,
 
- 																							'sec'		=> 60.0
 
- 																						),
 
- 																		'sec'	=> array(	'yr'		=> 3.16880878140289E-08,
 
- 																							'day'		=> 1.15740740740741E-05,
 
- 																							'hr'		=> 2.77777777777778E-04,
 
- 																							'mn'		=> 1.66666666666667E-02,
 
- 																							'sec'		=> 1.0
 
- 																						)
 
- 																	),
 
- 												'Pressure'	=> array(	'Pa'	=> array(	'Pa'		=> 1.0,
 
- 																							'p'			=> 1.0,
 
- 																							'atm'		=> 9.86923299998193E-06,
 
- 																							'at'		=> 9.86923299998193E-06,
 
- 																							'mmHg'		=> 7.50061707998627E-03
 
- 																						),
 
- 																		'p'		=> array(	'Pa'		=> 1.0,
 
- 																							'p'			=> 1.0,
 
- 																							'atm'		=> 9.86923299998193E-06,
 
- 																							'at'		=> 9.86923299998193E-06,
 
- 																							'mmHg'		=> 7.50061707998627E-03
 
- 																						),
 
- 																		'atm'	=> array(	'Pa'		=> 1.01324996583000E+05,
 
- 																							'p'			=> 1.01324996583000E+05,
 
- 																							'atm'		=> 1.0,
 
- 																							'at'		=> 1.0,
 
- 																							'mmHg'		=> 760.0
 
- 																						),
 
- 																		'at'	=> array(	'Pa'		=> 1.01324996583000E+05,
 
- 																							'p'			=> 1.01324996583000E+05,
 
- 																							'atm'		=> 1.0,
 
- 																							'at'		=> 1.0,
 
- 																							'mmHg'		=> 760.0
 
- 																						),
 
- 																		'mmHg'	=> array(	'Pa'		=> 1.33322363925000E+02,
 
- 																							'p'			=> 1.33322363925000E+02,
 
- 																							'atm'		=> 1.31578947368421E-03,
 
- 																							'at'		=> 1.31578947368421E-03,
 
- 																							'mmHg'		=> 1.0
 
- 																						)
 
- 																	),
 
- 												'Force'		=> array(	'N'		=> array(	'N'			=> 1.0,
 
- 																							'dyn'		=> 1.0E+5,
 
- 																							'dy'		=> 1.0E+5,
 
- 																							'lbf'		=> 2.24808923655339E-01
 
- 																						),
 
- 																		'dyn'	=> array(	'N'			=> 1.0E-5,
 
- 																							'dyn'		=> 1.0,
 
- 																							'dy'		=> 1.0,
 
- 																							'lbf'		=> 2.24808923655339E-06
 
- 																						),
 
- 																		'dy'	=> array(	'N'			=> 1.0E-5,
 
- 																							'dyn'		=> 1.0,
 
- 																							'dy'		=> 1.0,
 
- 																							'lbf'		=> 2.24808923655339E-06
 
- 																						),
 
- 																		'lbf'	=> array(	'N'			=> 4.448222,
 
- 																							'dyn'		=> 4.448222E+5,
 
- 																							'dy'		=> 4.448222E+5,
 
- 																							'lbf'		=> 1.0
 
- 																						)
 
- 																	),
 
- 												'Energy'	=> array(	'J'		=> array(	'J'			=> 1.0,
 
- 																							'e'			=> 9.99999519343231E+06,
 
- 																							'c'			=> 2.39006249473467E-01,
 
- 																							'cal'		=> 2.38846190642017E-01,
 
- 																							'eV'		=> 6.24145700000000E+18,
 
- 																							'ev'		=> 6.24145700000000E+18,
 
- 																							'HPh'		=> 3.72506430801000E-07,
 
- 																							'hh'		=> 3.72506430801000E-07,
 
- 																							'Wh'		=> 2.77777916238711E-04,
 
- 																							'wh'		=> 2.77777916238711E-04,
 
- 																							'flb'		=> 2.37304222192651E+01,
 
- 																							'BTU'		=> 9.47815067349015E-04,
 
- 																							'btu'		=> 9.47815067349015E-04
 
- 																						),
 
- 																		'e'		=> array(	'J'			=> 1.00000048065700E-07,
 
- 																							'e'			=> 1.0,
 
- 																							'c'			=> 2.39006364353494E-08,
 
- 																							'cal'		=> 2.38846305445111E-08,
 
- 																							'eV'		=> 6.24146000000000E+11,
 
- 																							'ev'		=> 6.24146000000000E+11,
 
- 																							'HPh'		=> 3.72506609848824E-14,
 
- 																							'hh'		=> 3.72506609848824E-14,
 
- 																							'Wh'		=> 2.77778049754611E-11,
 
- 																							'wh'		=> 2.77778049754611E-11,
 
- 																							'flb'		=> 2.37304336254586E-06,
 
- 																							'BTU'		=> 9.47815522922962E-11,
 
- 																							'btu'		=> 9.47815522922962E-11
 
- 																						),
 
- 																		'c'		=> array(	'J'			=> 4.18399101363672E+00,
 
- 																							'e'			=> 4.18398900257312E+07,
 
- 																							'c'			=> 1.0,
 
- 																							'cal'		=> 9.99330315287563E-01,
 
- 																							'eV'		=> 2.61142000000000E+19,
 
- 																							'ev'		=> 2.61142000000000E+19,
 
- 																							'HPh'		=> 1.55856355899327E-06,
 
- 																							'hh'		=> 1.55856355899327E-06,
 
- 																							'Wh'		=> 1.16222030532950E-03,
 
- 																							'wh'		=> 1.16222030532950E-03,
 
- 																							'flb'		=> 9.92878733152102E+01,
 
- 																							'BTU'		=> 3.96564972437776E-03,
 
- 																							'btu'		=> 3.96564972437776E-03
 
- 																						),
 
- 																		'cal'	=> array(	'J'			=> 4.18679484613929E+00,
 
- 																							'e'			=> 4.18679283372801E+07,
 
- 																							'c'			=> 1.00067013349059E+00,
 
- 																							'cal'		=> 1.0,
 
- 																							'eV'		=> 2.61317000000000E+19,
 
- 																							'ev'		=> 2.61317000000000E+19,
 
- 																							'HPh'		=> 1.55960800463137E-06,
 
- 																							'hh'		=> 1.55960800463137E-06,
 
- 																							'Wh'		=> 1.16299914807955E-03,
 
- 																							'wh'		=> 1.16299914807955E-03,
 
- 																							'flb'		=> 9.93544094443283E+01,
 
- 																							'BTU'		=> 3.96830723907002E-03,
 
- 																							'btu'		=> 3.96830723907002E-03
 
- 																						),
 
- 																		'eV'	=> array(	'J'			=> 1.60219000146921E-19,
 
- 																							'e'			=> 1.60218923136574E-12,
 
- 																							'c'			=> 3.82933423195043E-20,
 
- 																							'cal'		=> 3.82676978535648E-20,
 
- 																							'eV'		=> 1.0,
 
- 																							'ev'		=> 1.0,
 
- 																							'HPh'		=> 5.96826078912344E-26,
 
- 																							'hh'		=> 5.96826078912344E-26,
 
- 																							'Wh'		=> 4.45053000026614E-23,
 
- 																							'wh'		=> 4.45053000026614E-23,
 
- 																							'flb'		=> 3.80206452103492E-18,
 
- 																							'BTU'		=> 1.51857982414846E-22,
 
- 																							'btu'		=> 1.51857982414846E-22
 
- 																						),
 
- 																		'ev'	=> array(	'J'			=> 1.60219000146921E-19,
 
- 																							'e'			=> 1.60218923136574E-12,
 
- 																							'c'			=> 3.82933423195043E-20,
 
- 																							'cal'		=> 3.82676978535648E-20,
 
- 																							'eV'		=> 1.0,
 
- 																							'ev'		=> 1.0,
 
- 																							'HPh'		=> 5.96826078912344E-26,
 
- 																							'hh'		=> 5.96826078912344E-26,
 
- 																							'Wh'		=> 4.45053000026614E-23,
 
- 																							'wh'		=> 4.45053000026614E-23,
 
- 																							'flb'		=> 3.80206452103492E-18,
 
- 																							'BTU'		=> 1.51857982414846E-22,
 
- 																							'btu'		=> 1.51857982414846E-22
 
- 																						),
 
- 																		'HPh'	=> array(	'J'			=> 2.68451741316170E+06,
 
- 																							'e'			=> 2.68451612283024E+13,
 
- 																							'c'			=> 6.41616438565991E+05,
 
- 																							'cal'		=> 6.41186757845835E+05,
 
- 																							'eV'		=> 1.67553000000000E+25,
 
- 																							'ev'		=> 1.67553000000000E+25,
 
- 																							'HPh'		=> 1.0,
 
- 																							'hh'		=> 1.0,
 
- 																							'Wh'		=> 7.45699653134593E+02,
 
- 																							'wh'		=> 7.45699653134593E+02,
 
- 																							'flb'		=> 6.37047316692964E+07,
 
- 																							'BTU'		=> 2.54442605275546E+03,
 
- 																							'btu'		=> 2.54442605275546E+03
 
- 																						),
 
- 																		'hh'	=> array(	'J'			=> 2.68451741316170E+06,
 
- 																							'e'			=> 2.68451612283024E+13,
 
- 																							'c'			=> 6.41616438565991E+05,
 
- 																							'cal'		=> 6.41186757845835E+05,
 
- 																							'eV'		=> 1.67553000000000E+25,
 
- 																							'ev'		=> 1.67553000000000E+25,
 
- 																							'HPh'		=> 1.0,
 
- 																							'hh'		=> 1.0,
 
- 																							'Wh'		=> 7.45699653134593E+02,
 
- 																							'wh'		=> 7.45699653134593E+02,
 
- 																							'flb'		=> 6.37047316692964E+07,
 
- 																							'BTU'		=> 2.54442605275546E+03,
 
- 																							'btu'		=> 2.54442605275546E+03
 
- 																						),
 
- 																		'Wh'	=> array(	'J'			=> 3.59999820554720E+03,
 
- 																							'e'			=> 3.59999647518369E+10,
 
- 																							'c'			=> 8.60422069219046E+02,
 
- 																							'cal'		=> 8.59845857713046E+02,
 
- 																							'eV'		=> 2.24692340000000E+22,
 
- 																							'ev'		=> 2.24692340000000E+22,
 
- 																							'HPh'		=> 1.34102248243839E-03,
 
- 																							'hh'		=> 1.34102248243839E-03,
 
- 																							'Wh'		=> 1.0,
 
- 																							'wh'		=> 1.0,
 
- 																							'flb'		=> 8.54294774062316E+04,
 
- 																							'BTU'		=> 3.41213254164705E+00,
 
- 																							'btu'		=> 3.41213254164705E+00
 
- 																						),
 
- 																		'wh'	=> array(	'J'			=> 3.59999820554720E+03,
 
- 																							'e'			=> 3.59999647518369E+10,
 
- 																							'c'			=> 8.60422069219046E+02,
 
- 																							'cal'		=> 8.59845857713046E+02,
 
- 																							'eV'		=> 2.24692340000000E+22,
 
- 																							'ev'		=> 2.24692340000000E+22,
 
- 																							'HPh'		=> 1.34102248243839E-03,
 
- 																							'hh'		=> 1.34102248243839E-03,
 
- 																							'Wh'		=> 1.0,
 
- 																							'wh'		=> 1.0,
 
- 																							'flb'		=> 8.54294774062316E+04,
 
- 																							'BTU'		=> 3.41213254164705E+00,
 
- 																							'btu'		=> 3.41213254164705E+00
 
- 																						),
 
- 																		'flb'	=> array(	'J'			=> 4.21400003236424E-02,
 
- 																							'e'			=> 4.21399800687660E+05,
 
- 																							'c'			=> 1.00717234301644E-02,
 
- 																							'cal'		=> 1.00649785509554E-02,
 
- 																							'eV'		=> 2.63015000000000E+17,
 
- 																							'ev'		=> 2.63015000000000E+17,
 
- 																							'HPh'		=> 1.56974211145130E-08,
 
- 																							'hh'		=> 1.56974211145130E-08,
 
- 																							'Wh'		=> 1.17055614802000E-05,
 
- 																							'wh'		=> 1.17055614802000E-05,
 
- 																							'flb'		=> 1.0,
 
- 																							'BTU'		=> 3.99409272448406E-05,
 
- 																							'btu'		=> 3.99409272448406E-05
 
- 																						),
 
- 																		'BTU'	=> array(	'J'			=> 1.05505813786749E+03,
 
- 																							'e'			=> 1.05505763074665E+10,
 
- 																							'c'			=> 2.52165488508168E+02,
 
- 																							'cal'		=> 2.51996617135510E+02,
 
- 																							'eV'		=> 6.58510000000000E+21,
 
- 																							'ev'		=> 6.58510000000000E+21,
 
- 																							'HPh'		=> 3.93015941224568E-04,
 
- 																							'hh'		=> 3.93015941224568E-04,
 
- 																							'Wh'		=> 2.93071851047526E-01,
 
- 																							'wh'		=> 2.93071851047526E-01,
 
- 																							'flb'		=> 2.50369750774671E+04,
 
- 																							'BTU'		=> 1.0,
 
- 																							'btu'		=> 1.0,
 
- 																						),
 
- 																		'btu'	=> array(	'J'			=> 1.05505813786749E+03,
 
- 																							'e'			=> 1.05505763074665E+10,
 
- 																							'c'			=> 2.52165488508168E+02,
 
- 																							'cal'		=> 2.51996617135510E+02,
 
- 																							'eV'		=> 6.58510000000000E+21,
 
- 																							'ev'		=> 6.58510000000000E+21,
 
- 																							'HPh'		=> 3.93015941224568E-04,
 
- 																							'hh'		=> 3.93015941224568E-04,
 
- 																							'Wh'		=> 2.93071851047526E-01,
 
- 																							'wh'		=> 2.93071851047526E-01,
 
- 																							'flb'		=> 2.50369750774671E+04,
 
- 																							'BTU'		=> 1.0,
 
- 																							'btu'		=> 1.0,
 
- 																						)
 
- 																	),
 
- 												'Power'		=> array(	'HP'	=> array(	'HP'		=> 1.0,
 
- 																							'h'			=> 1.0,
 
- 																							'W'			=> 7.45701000000000E+02,
 
- 																							'w'			=> 7.45701000000000E+02
 
- 																						),
 
- 																		'h'		=> array(	'HP'		=> 1.0,
 
- 																							'h'			=> 1.0,
 
- 																							'W'			=> 7.45701000000000E+02,
 
- 																							'w'			=> 7.45701000000000E+02
 
- 																						),
 
- 																		'W'		=> array(	'HP'		=> 1.34102006031908E-03,
 
- 																							'h'			=> 1.34102006031908E-03,
 
- 																							'W'			=> 1.0,
 
- 																							'w'			=> 1.0
 
- 																						),
 
- 																		'w'		=> array(	'HP'		=> 1.34102006031908E-03,
 
- 																							'h'			=> 1.34102006031908E-03,
 
- 																							'W'			=> 1.0,
 
- 																							'w'			=> 1.0
 
- 																						)
 
- 																	),
 
- 												'Magnetism'	=> array(	'T'		=> array(	'T'			=> 1.0,
 
- 																							'ga'		=> 10000.0
 
- 																						),
 
- 																		'ga'	=> array(	'T'			=> 0.0001,
 
- 																							'ga'		=> 1.0
 
- 																						)
 
- 																	),
 
- 												'Liquid'	=> array(	'tsp'	=> array(	'tsp'		=> 1.0,
 
- 																							'tbs'		=> 3.33333333333333E-01,
 
- 																							'oz'		=> 1.66666666666667E-01,
 
- 																							'cup'		=> 2.08333333333333E-02,
 
- 																							'pt'		=> 1.04166666666667E-02,
 
- 																							'us_pt'		=> 1.04166666666667E-02,
 
- 																							'uk_pt'		=> 8.67558516821960E-03,
 
- 																							'qt'		=> 5.20833333333333E-03,
 
- 																							'gal'		=> 1.30208333333333E-03,
 
- 																							'l'			=> 4.92999408400710E-03,
 
- 																							'lt'		=> 4.92999408400710E-03
 
- 																						),
 
- 																		'tbs'	=> array(	'tsp'		=> 3.00000000000000E+00,
 
- 																							'tbs'		=> 1.0,
 
- 																							'oz'		=> 5.00000000000000E-01,
 
- 																							'cup'		=> 6.25000000000000E-02,
 
- 																							'pt'		=> 3.12500000000000E-02,
 
- 																							'us_pt'		=> 3.12500000000000E-02,
 
- 																							'uk_pt'		=> 2.60267555046588E-02,
 
- 																							'qt'		=> 1.56250000000000E-02,
 
- 																							'gal'		=> 3.90625000000000E-03,
 
- 																							'l'			=> 1.47899822520213E-02,
 
- 																							'lt'		=> 1.47899822520213E-02
 
- 																						),
 
- 																		'oz'	=> array(	'tsp'		=> 6.00000000000000E+00,
 
- 																							'tbs'		=> 2.00000000000000E+00,
 
- 																							'oz'		=> 1.0,
 
- 																							'cup'		=> 1.25000000000000E-01,
 
- 																							'pt'		=> 6.25000000000000E-02,
 
- 																							'us_pt'		=> 6.25000000000000E-02,
 
- 																							'uk_pt'		=> 5.20535110093176E-02,
 
- 																							'qt'		=> 3.12500000000000E-02,
 
- 																							'gal'		=> 7.81250000000000E-03,
 
- 																							'l'			=> 2.95799645040426E-02,
 
- 																							'lt'		=> 2.95799645040426E-02
 
- 																						),
 
- 																		'cup'	=> array(	'tsp'		=> 4.80000000000000E+01,
 
- 																							'tbs'		=> 1.60000000000000E+01,
 
- 																							'oz'		=> 8.00000000000000E+00,
 
- 																							'cup'		=> 1.0,
 
- 																							'pt'		=> 5.00000000000000E-01,
 
- 																							'us_pt'		=> 5.00000000000000E-01,
 
- 																							'uk_pt'		=> 4.16428088074541E-01,
 
- 																							'qt'		=> 2.50000000000000E-01,
 
- 																							'gal'		=> 6.25000000000000E-02,
 
- 																							'l'			=> 2.36639716032341E-01,
 
- 																							'lt'		=> 2.36639716032341E-01
 
- 																						),
 
- 																		'pt'	=> array(	'tsp'		=> 9.60000000000000E+01,
 
- 																							'tbs'		=> 3.20000000000000E+01,
 
- 																							'oz'		=> 1.60000000000000E+01,
 
- 																							'cup'		=> 2.00000000000000E+00,
 
- 																							'pt'		=> 1.0,
 
- 																							'us_pt'		=> 1.0,
 
- 																							'uk_pt'		=> 8.32856176149081E-01,
 
- 																							'qt'		=> 5.00000000000000E-01,
 
- 																							'gal'		=> 1.25000000000000E-01,
 
- 																							'l'			=> 4.73279432064682E-01,
 
- 																							'lt'		=> 4.73279432064682E-01
 
- 																						),
 
- 																		'us_pt'	=> array(	'tsp'		=> 9.60000000000000E+01,
 
- 																							'tbs'		=> 3.20000000000000E+01,
 
- 																							'oz'		=> 1.60000000000000E+01,
 
- 																							'cup'		=> 2.00000000000000E+00,
 
- 																							'pt'		=> 1.0,
 
- 																							'us_pt'		=> 1.0,
 
- 																							'uk_pt'		=> 8.32856176149081E-01,
 
- 																							'qt'		=> 5.00000000000000E-01,
 
- 																							'gal'		=> 1.25000000000000E-01,
 
- 																							'l'			=> 4.73279432064682E-01,
 
- 																							'lt'		=> 4.73279432064682E-01
 
- 																						),
 
- 																		'uk_pt'	=> array(	'tsp'		=> 1.15266000000000E+02,
 
- 																							'tbs'		=> 3.84220000000000E+01,
 
- 																							'oz'		=> 1.92110000000000E+01,
 
- 																							'cup'		=> 2.40137500000000E+00,
 
- 																							'pt'		=> 1.20068750000000E+00,
 
- 																							'us_pt'		=> 1.20068750000000E+00,
 
- 																							'uk_pt'		=> 1.0,
 
- 																							'qt'		=> 6.00343750000000E-01,
 
- 																							'gal'		=> 1.50085937500000E-01,
 
- 																							'l'			=> 5.68260698087162E-01,
 
- 																							'lt'		=> 5.68260698087162E-01
 
- 																						),
 
- 																		'qt'	=> array(	'tsp'		=> 1.92000000000000E+02,
 
- 																							'tbs'		=> 6.40000000000000E+01,
 
- 																							'oz'		=> 3.20000000000000E+01,
 
- 																							'cup'		=> 4.00000000000000E+00,
 
- 																							'pt'		=> 2.00000000000000E+00,
 
- 																							'us_pt'		=> 2.00000000000000E+00,
 
- 																							'uk_pt'		=> 1.66571235229816E+00,
 
- 																							'qt'		=> 1.0,
 
- 																							'gal'		=> 2.50000000000000E-01,
 
- 																							'l'			=> 9.46558864129363E-01,
 
- 																							'lt'		=> 9.46558864129363E-01
 
- 																						),
 
- 																		'gal'	=> array(	'tsp'		=> 7.68000000000000E+02,
 
- 																							'tbs'		=> 2.56000000000000E+02,
 
- 																							'oz'		=> 1.28000000000000E+02,
 
- 																							'cup'		=> 1.60000000000000E+01,
 
- 																							'pt'		=> 8.00000000000000E+00,
 
- 																							'us_pt'		=> 8.00000000000000E+00,
 
- 																							'uk_pt'		=> 6.66284940919265E+00,
 
- 																							'qt'		=> 4.00000000000000E+00,
 
- 																							'gal'		=> 1.0,
 
- 																							'l'			=> 3.78623545651745E+00,
 
- 																							'lt'		=> 3.78623545651745E+00
 
- 																						),
 
- 																		'l'		=> array(	'tsp'		=> 2.02840000000000E+02,
 
- 																							'tbs'		=> 6.76133333333333E+01,
 
- 																							'oz'		=> 3.38066666666667E+01,
 
- 																							'cup'		=> 4.22583333333333E+00,
 
- 																							'pt'		=> 2.11291666666667E+00,
 
- 																							'us_pt'		=> 2.11291666666667E+00,
 
- 																							'uk_pt'		=> 1.75975569552166E+00,
 
- 																							'qt'		=> 1.05645833333333E+00,
 
- 																							'gal'		=> 2.64114583333333E-01,
 
- 																							'l'			=> 1.0,
 
- 																							'lt'		=> 1.0
 
- 																						),
 
- 																		'lt'	=> array(	'tsp'		=> 2.02840000000000E+02,
 
- 																							'tbs'		=> 6.76133333333333E+01,
 
- 																							'oz'		=> 3.38066666666667E+01,
 
- 																							'cup'		=> 4.22583333333333E+00,
 
- 																							'pt'		=> 2.11291666666667E+00,
 
- 																							'us_pt'		=> 2.11291666666667E+00,
 
- 																							'uk_pt'		=> 1.75975569552166E+00,
 
- 																							'qt'		=> 1.05645833333333E+00,
 
- 																							'gal'		=> 2.64114583333333E-01,
 
- 																							'l'			=> 1.0,
 
- 																							'lt'		=> 1.0
 
- 																						)
 
- 																	)
 
- 											);
 
- 	public static function _parseComplex($complexNumber) {
 
- 		$workString = (string) $complexNumber;
 
- 		$realNumber = $imaginary = 0;
 
- 		//	Extract the suffix, if there is one
 
- 		$suffix = substr($workString,-1);
 
- 		if (!is_numeric($suffix)) {
 
- 			$workString = substr($workString,0,-1);
 
- 		} else {
 
- 			$suffix = '';
 
- 		}
 
- 		//	Split the input into its Real and Imaginary components
 
- 		$leadingSign = 0;
 
- 		if (strlen($workString) > 0) {
 
- 			$leadingSign = (($workString{0} == '+') || ($workString{0} == '-')) ? 1 : 0;
 
- 		}
 
- 		$power = '';
 
- 		$realNumber = strtok($workString, '+-');
 
- 		if (strtoupper(substr($realNumber,-1)) == 'E') {
 
- 			$power = strtok('+-');
 
- 			++$leadingSign;
 
- 		}
 
- 		$realNumber = substr($workString,0,strlen($realNumber)+strlen($power)+$leadingSign);
 
- 		if ($suffix != '') {
 
- 			$imaginary = substr($workString,strlen($realNumber));
 
- 			if (($imaginary == '') && (($realNumber == '') || ($realNumber == '+') || ($realNumber == '-'))) {
 
- 				$imaginary = $realNumber.'1';
 
- 				$realNumber = '0';
 
- 			} else if ($imaginary == '') {
 
- 				$imaginary = $realNumber;
 
- 				$realNumber = '0';
 
- 			} elseif (($imaginary == '+') || ($imaginary == '-')) {
 
- 				$imaginary .= '1';
 
- 			}
 
- 		}
 
- 		return array( 'real'		=> $realNumber,
 
- 					  'imaginary'	=> $imaginary,
 
- 					  'suffix'		=> $suffix
 
- 					);
 
- 	}	//	function _parseComplex()
 
- 	private static function _cleanComplex($complexNumber) {
 
- 		if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1);
 
- 		if ($complexNumber{0} == '0') $complexNumber = substr($complexNumber,1);
 
- 		if ($complexNumber{0} == '.') $complexNumber = '0'.$complexNumber;
 
- 		if ($complexNumber{0} == '+') $complexNumber = substr($complexNumber,1);
 
- 		return $complexNumber;
 
- 	}
 
- 	private static function _nbrConversionFormat($xVal,$places) {
 
- 		if (!is_null($places)) {
 
- 			if (strlen($xVal) <= $places) {
 
- 				return substr(str_pad($xVal,$places,'0',STR_PAD_LEFT),-10);
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::NaN();
 
- 			}
 
- 		}
 
- 		return substr($xVal,-10);
 
- 	}	//	function _nbrConversionFormat()
 
- 	/**
 
- 	 * BESSELI
 
- 	 *
 
- 	 * Returns the modified Bessel function, which is equivalent to the Bessel function evaluated for purely imaginary arguments
 
- 	 *
 
- 	 * @param	float		$x
 
- 	 * @param	float		$n
 
- 	 * @return	int
 
- 	 */
 
- 	public static function BESSELI($x, $n) {
 
- 		$x	= (is_null($x))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$n	= (is_null($n))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($n);
 
- 		if ((is_numeric($x)) && (is_numeric($n))) {
 
- 			$n	= floor($n);
 
- 			if ($n < 0) {
 
- 				return PHPExcel_Calculation_Functions::NaN();
 
- 			}
 
- 			$f_2_PI = 2 * M_PI;
 
- 			if (abs($x) <= 30) {
 
- 				$fTerm = pow($x / 2, $n) / PHPExcel_Calculation_MathTrig::FACT($n);
 
- 				$nK = 1;
 
- 				$fResult = $fTerm;
 
- 				$fSqrX = ($x * $x) / 4;
 
- 				do {
 
- 					$fTerm *= $fSqrX;
 
- 					$fTerm /= ($nK * ($nK + $n));
 
- 					$fResult += $fTerm;
 
- 				} while ((abs($fTerm) > 1e-10) && (++$nK < 100));
 
- 			} else {
 
- 				$fXAbs = abs($x);
 
- 				$fResult = exp($fXAbs) / sqrt($f_2_PI * $fXAbs);
 
- 				if (($n && 1) && ($x < 0)) {
 
- 					$fResult = -$fResult;
 
- 				}
 
- 			}
 
- 			return $fResult;
 
- 		}
 
- 		return PHPExcel_Calculation_Functions::VALUE();
 
- 	}	//	function BESSELI()
 
- 	/**
 
- 	 * BESSELJ
 
- 	 *
 
- 	 * Returns the Bessel function
 
- 	 *
 
- 	 * @param	float		$x
 
- 	 * @param	float		$n
 
- 	 * @return	int
 
- 	 */
 
- 	public static function BESSELJ($x, $n) {
 
- 		$x	= (is_null($x))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$n	= (is_null($n))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($n);
 
- 		if ((is_numeric($x)) && (is_numeric($n))) {
 
- 			$n	= floor($n);
 
- 			if ($n < 0) {
 
- 				return PHPExcel_Calculation_Functions::NaN();
 
- 			}
 
- 			$f_PI_DIV_2 = M_PI / 2;
 
- 			$f_PI_DIV_4 = M_PI / 4;
 
- 			$fResult = 0;
 
- 			if (abs($x) <= 30) {
 
- 				$fTerm = pow($x / 2, $n) / PHPExcel_Calculation_MathTrig::FACT($n);
 
- 				$nK = 1;
 
- 				$fResult = $fTerm;
 
- 				$fSqrX = ($x * $x) / -4;
 
- 				do {
 
- 					$fTerm *= $fSqrX;
 
- 					$fTerm /= ($nK * ($nK + $n));
 
- 					$fResult += $fTerm;
 
- 				} while ((abs($fTerm) > 1e-10) && (++$nK < 100));
 
- 			} else {
 
- 				$fXAbs = abs($x);
 
- 				$fResult = sqrt(M_2DIVPI / $fXAbs) * cos($fXAbs - $n * $f_PI_DIV_2 - $f_PI_DIV_4);
 
- 				if (($n && 1) && ($x < 0)) {
 
- 					$fResult = -$fResult;
 
- 				}
 
- 			}
 
- 			return $fResult;
 
- 		}
 
- 		return PHPExcel_Calculation_Functions::VALUE();
 
- 	}	//	function BESSELJ()
 
- 	private static function _Besselk0($fNum) {
 
- 		if ($fNum <= 2) {
 
- 			$fNum2 = $fNum * 0.5;
 
- 			$y = ($fNum2 * $fNum2);
 
- 			$fRet = -log($fNum2) * self::BESSELI($fNum, 0) +
 
- 					(-0.57721566 + $y * (0.42278420 + $y * (0.23069756 + $y * (0.3488590e-1 + $y * (0.262698e-2 + $y *
 
- 					(0.10750e-3 + $y * 0.74e-5))))));
 
- 		} else {
 
- 			$y = 2 / $fNum;
 
- 			$fRet = exp(-$fNum) / sqrt($fNum) *
 
- 					(1.25331414 + $y * (-0.7832358e-1 + $y * (0.2189568e-1 + $y * (-0.1062446e-1 + $y *
 
- 					(0.587872e-2 + $y * (-0.251540e-2 + $y * 0.53208e-3))))));
 
- 		}
 
- 		return $fRet;
 
- 	}	//	function _Besselk0()
 
- 	private static function _Besselk1($fNum) {
 
- 		if ($fNum <= 2) {
 
- 			$fNum2 = $fNum * 0.5;
 
- 			$y = ($fNum2 * $fNum2);
 
- 			$fRet = log($fNum2) * self::BESSELI($fNum, 1) +
 
- 					(1 + $y * (0.15443144 + $y * (-0.67278579 + $y * (-0.18156897 + $y * (-0.1919402e-1 + $y *
 
- 					(-0.110404e-2 + $y * (-0.4686e-4))))))) / $fNum;
 
- 		} else {
 
- 			$y = 2 / $fNum;
 
- 			$fRet = exp(-$fNum) / sqrt($fNum) *
 
- 					(1.25331414 + $y * (0.23498619 + $y * (-0.3655620e-1 + $y * (0.1504268e-1 + $y * (-0.780353e-2 + $y *
 
- 					(0.325614e-2 + $y * (-0.68245e-3)))))));
 
- 		}
 
- 		return $fRet;
 
- 	}	//	function _Besselk1()
 
- 	/**
 
- 	 * BESSELK
 
- 	 *
 
- 	 * Returns the modified Bessel function, which is equivalent to the Bessel functions evaluated for purely imaginary arguments.
 
- 	 *
 
- 	 * @param	float		$x
 
- 	 * @param	float		$ord
 
- 	 * @return	float
 
- 	 */
 
- 	public static function BESSELK($x, $ord) {
 
- 		$x		= (is_null($x))		? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$ord	= (is_null($ord))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($ord);
 
- 		if ((is_numeric($x)) && (is_numeric($ord))) {
 
- 			if (($ord < 0) || ($x == 0.0)) {
 
- 				return PHPExcel_Calculation_Functions::NaN();
 
- 			}
 
- 			switch(floor($ord)) {
 
- 				case 0 :	return self::_Besselk0($x);
 
- 							break;
 
- 				case 1 :	return self::_Besselk1($x);
 
- 							break;
 
- 				default :	$fTox	= 2 / $x;
 
- 							$fBkm	= self::_Besselk0($x);
 
- 							$fBk	= self::_Besselk1($x);
 
- 							for ($n = 1; $n < $ord; ++$n) {
 
- 								$fBkp	= $fBkm + $n * $fTox * $fBk;
 
- 								$fBkm	= $fBk;
 
- 								$fBk	= $fBkp;
 
- 							}
 
- 			}
 
- 			return $fBk;
 
- 		}
 
- 		return PHPExcel_Calculation_Functions::VALUE();
 
- 	}	//	function BESSELK()
 
- 	private static function _Bessely0($fNum) {
 
- 		if ($fNum < 8.0) {
 
- 			$y = ($fNum * $fNum);
 
- 			$f1 = -2957821389.0 + $y * (7062834065.0 + $y * (-512359803.6 + $y * (10879881.29 + $y * (-86327.92757 + $y * 228.4622733))));
 
- 			$f2 = 40076544269.0 + $y * (745249964.8 + $y * (7189466.438 + $y * (47447.26470 + $y * (226.1030244 + $y))));
 
- 			$fRet = $f1 / $f2 + M_2DIVPI * self::BESSELJ($fNum, 0) * log($fNum);
 
- 		} else {
 
- 			$z = 8.0 / $fNum;
 
- 			$y = ($z * $z);
 
- 			$xx = $fNum - 0.785398164;
 
- 			$f1 = 1 + $y * (-0.1098628627e-2 + $y * (0.2734510407e-4 + $y * (-0.2073370639e-5 + $y * 0.2093887211e-6)));
 
- 			$f2 = -0.1562499995e-1 + $y * (0.1430488765e-3 + $y * (-0.6911147651e-5 + $y * (0.7621095161e-6 + $y * (-0.934945152e-7))));
 
- 			$fRet = sqrt(M_2DIVPI / $fNum) * (sin($xx) * $f1 + $z * cos($xx) * $f2);
 
- 		}
 
- 		return $fRet;
 
- 	}	//	function _Bessely0()
 
- 	private static function _Bessely1($fNum) {
 
- 		if ($fNum < 8.0) {
 
- 			$y = ($fNum * $fNum);
 
- 			$f1 = $fNum * (-0.4900604943e13 + $y * (0.1275274390e13 + $y * (-0.5153438139e11 + $y * (0.7349264551e9 + $y *
 
- 				(-0.4237922726e7 + $y * 0.8511937935e4)))));
 
- 			$f2 = 0.2499580570e14 + $y * (0.4244419664e12 + $y * (0.3733650367e10 + $y * (0.2245904002e8 + $y *
 
- 				(0.1020426050e6 + $y * (0.3549632885e3 + $y)))));
 
- 			$fRet = $f1 / $f2 + M_2DIVPI * ( self::BESSELJ($fNum, 1) * log($fNum) - 1 / $fNum);
 
- 		} else {
 
- 			$z = 8.0 / $fNum;
 
- 			$y = ($z * $z);
 
- 			$xx = $fNum - 2.356194491;
 
- 			$f1 = 1 + $y * (0.183105e-2 + $y * (-0.3516396496e-4 + $y * (0.2457520174e-5 + $y * (-0.240337019e6))));
 
- 			$f2 = 0.04687499995 + $y * (-0.2002690873e-3 + $y * (0.8449199096e-5 + $y * (-0.88228987e-6 + $y * 0.105787412e-6)));
 
- 			$fRet = sqrt(M_2DIVPI / $fNum) * (sin($xx) * $f1 + $z * cos($xx) * $f2);
 
- 			#i12430# ...but this seems to work much better.
 
- //			$fRet = sqrt(M_2DIVPI / $fNum) * sin($fNum - 2.356194491);
 
- 		}
 
- 		return $fRet;
 
- 	}	//	function _Bessely1()
 
- 	/**
 
- 	 * BESSELY
 
- 	 *
 
- 	 * Returns the Bessel function, which is also called the Weber function or the Neumann function.
 
- 	 *
 
- 	 * @param	float		$x
 
- 	 * @param	float		$n
 
- 	 * @return	int
 
- 	 */
 
- 	public static function BESSELY($x, $ord) {
 
- 		$x		= (is_null($x))		? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$ord	= (is_null($ord))	? 0.0 :	PHPExcel_Calculation_Functions::flattenSingleValue($ord);
 
- 		if ((is_numeric($x)) && (is_numeric($ord))) {
 
- 			if (($ord < 0) || ($x == 0.0)) {
 
- 				return PHPExcel_Calculation_Functions::NaN();
 
- 			}
 
- 			switch(floor($ord)) {
 
- 				case 0 :	return self::_Bessely0($x);
 
- 							break;
 
- 				case 1 :	return self::_Bessely1($x);
 
- 							break;
 
- 				default:	$fTox	= 2 / $x;
 
- 							$fBym	= self::_Bessely0($x);
 
- 							$fBy	= self::_Bessely1($x);
 
- 							for ($n = 1; $n < $ord; ++$n) {
 
- 								$fByp	= $n * $fTox * $fBy - $fBym;
 
- 								$fBym	= $fBy;
 
- 								$fBy	= $fByp;
 
- 							}
 
- 			}
 
- 			return $fBy;
 
- 		}
 
- 		return PHPExcel_Calculation_Functions::VALUE();
 
- 	}	//	function BESSELY()
 
- 	/**
 
- 	 * BINTODEC
 
- 	 *
 
- 	 * Return a binary value as Decimal.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function BINTODEC($x) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		if (is_bool($x)) {
 
- 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
 
- 				$x = (int) $x;
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::VALUE();
 
- 			}
 
- 		}
 
- 		if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
 
- 			$x = floor($x);
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (strlen($x) > preg_match_all('/[01]/',$x,$out)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		if (strlen($x) > 10) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		} elseif (strlen($x) == 10) {
 
- 			//	Two's Complement
 
- 			$x = substr($x,-9);
 
- 			return '-'.(512-bindec($x));
 
- 		}
 
- 		return bindec($x);
 
- 	}	//	function BINTODEC()
 
- 	/**
 
- 	 * BINTOHEX
 
- 	 *
 
- 	 * Return a binary value as Hex.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function BINTOHEX($x, $places=null) {
 
- 		$x	= floor(PHPExcel_Calculation_Functions::flattenSingleValue($x));
 
- 		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
 
- 		if (is_bool($x)) {
 
- 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
 
- 				$x = (int) $x;
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::VALUE();
 
- 			}
 
- 		}
 
- 		if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
 
- 			$x = floor($x);
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (strlen($x) > preg_match_all('/[01]/',$x,$out)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		if (strlen($x) > 10) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		} elseif (strlen($x) == 10) {
 
- 			//	Two's Complement
 
- 			return str_repeat('F',8).substr(strtoupper(dechex(bindec(substr($x,-9)))),-2);
 
- 		}
 
- 		$hexVal = (string) strtoupper(dechex(bindec($x)));
 
- 		return self::_nbrConversionFormat($hexVal,$places);
 
- 	}	//	function BINTOHEX()
 
- 	/**
 
- 	 * BINTOOCT
 
- 	 *
 
- 	 * Return a binary value as Octal.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function BINTOOCT($x, $places=null) {
 
- 		$x	= floor(PHPExcel_Calculation_Functions::flattenSingleValue($x));
 
- 		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
 
- 		if (is_bool($x)) {
 
- 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
 
- 				$x = (int) $x;
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::VALUE();
 
- 			}
 
- 		}
 
- 		if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC) {
 
- 			$x = floor($x);
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (strlen($x) > preg_match_all('/[01]/',$x,$out)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		if (strlen($x) > 10) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		} elseif (strlen($x) == 10) {
 
- 			//	Two's Complement
 
- 			return str_repeat('7',7).substr(strtoupper(decoct(bindec(substr($x,-9)))),-3);
 
- 		}
 
- 		$octVal = (string) decoct(bindec($x));
 
- 		return self::_nbrConversionFormat($octVal,$places);
 
- 	}	//	function BINTOOCT()
 
- 	/**
 
- 	 * DECTOBIN
 
- 	 *
 
- 	 * Return an octal value as binary.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function DECTOBIN($x, $places=null) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
 
- 		if (is_bool($x)) {
 
- 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
 
- 				$x = (int) $x;
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::VALUE();
 
- 			}
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$x = (string) floor($x);
 
- 		$r = decbin($x);
 
- 		if (strlen($r) == 32) {
 
- 			//	Two's Complement
 
- 			$r = substr($r,-10);
 
- 		} elseif (strlen($r) > 11) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		return self::_nbrConversionFormat($r,$places);
 
- 	}	//	function DECTOBIN()
 
- 	/**
 
- 	 * DECTOHEX
 
- 	 *
 
- 	 * Return an octal value as binary.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function DECTOHEX($x, $places=null) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
 
- 		if (is_bool($x)) {
 
- 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
 
- 				$x = (int) $x;
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::VALUE();
 
- 			}
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$x = (string) floor($x);
 
- 		$r = strtoupper(dechex($x));
 
- 		if (strlen($r) == 8) {
 
- 			//	Two's Complement
 
- 			$r = 'FF'.$r;
 
- 		}
 
- 		return self::_nbrConversionFormat($r,$places);
 
- 	}	//	function DECTOHEX()
 
- 	/**
 
- 	 * DECTOOCT
 
- 	 *
 
- 	 * Return an octal value as binary.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function DECTOOCT($x, $places=null) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
 
- 		if (is_bool($x)) {
 
- 			if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
 
- 				$x = (int) $x;
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::VALUE();
 
- 			}
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (strlen($x) > preg_match_all('/[-0123456789.]/',$x,$out)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$x = (string) floor($x);
 
- 		$r = decoct($x);
 
- 		if (strlen($r) == 11) {
 
- 			//	Two's Complement
 
- 			$r = substr($r,-10);
 
- 		}
 
- 		return self::_nbrConversionFormat($r,$places);
 
- 	}	//	function DECTOOCT()
 
- 	/**
 
- 	 * HEXTOBIN
 
- 	 *
 
- 	 * Return a hex value as binary.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function HEXTOBIN($x, $places=null) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
 
- 		if (is_bool($x)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		$binVal = decbin(hexdec($x));
 
- 		return substr(self::_nbrConversionFormat($binVal,$places),-10);
 
- 	}	//	function HEXTOBIN()
 
- 	/**
 
- 	 * HEXTODEC
 
- 	 *
 
- 	 * Return a hex value as octal.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function HEXTODEC($x) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		if (is_bool($x)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		return hexdec($x);
 
- 	}	//	function HEXTODEC()
 
- 	/**
 
- 	 * HEXTOOCT
 
- 	 *
 
- 	 * Return a hex value as octal.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function HEXTOOCT($x, $places=null) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
 
- 		if (is_bool($x)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/',strtoupper($x),$out)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		$octVal = decoct(hexdec($x));
 
- 		return self::_nbrConversionFormat($octVal,$places);
 
- 	}	//	function HEXTOOCT()
 
- 	/**
 
- 	 * OCTTOBIN
 
- 	 *
 
- 	 * Return an octal value as binary.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function OCTTOBIN($x, $places=null) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
 
- 		if (is_bool($x)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		$r = decbin(octdec($x));
 
- 		return self::_nbrConversionFormat($r,$places);
 
- 	}	//	function OCTTOBIN()
 
- 	/**
 
- 	 * OCTTODEC
 
- 	 *
 
- 	 * Return an octal value as binary.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function OCTTODEC($x) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		if (is_bool($x)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		return octdec($x);
 
- 	}	//	function OCTTODEC()
 
- 	/**
 
- 	 * OCTTOHEX
 
- 	 *
 
- 	 * Return an octal value as hex.
 
- 	 *
 
- 	 * @param	string		$x
 
- 	 * @return	string
 
- 	 */
 
- 	public static function OCTTOHEX($x, $places=null) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		$places	= PHPExcel_Calculation_Functions::flattenSingleValue($places);
 
- 		if (is_bool($x)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$x = (string) $x;
 
- 		if (preg_match_all('/[01234567]/',$x,$out) != strlen($x)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		$hexVal = strtoupper(dechex(octdec($x)));
 
- 		return self::_nbrConversionFormat($hexVal,$places);
 
- 	}	//	function OCTTOHEX()
 
- 	/**
 
- 	 * COMPLEX
 
- 	 *
 
- 	 * returns a complex number of the form x + yi or x + yj.
 
- 	 *
 
- 	 * @param	float		$realNumber
 
- 	 * @param	float		$imaginary
 
- 	 * @param	string		$suffix
 
- 	 * @return	string
 
- 	 */
 
- 	public static function COMPLEX($realNumber=0.0, $imaginary=0.0, $suffix='i') {
 
- 		$realNumber	= (is_null($realNumber))	? 0.0 :	(float) PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
 
- 		$imaginary	= (is_null($imaginary))		? 0.0 :	(float) PHPExcel_Calculation_Functions::flattenSingleValue($imaginary);
 
- 		$suffix		= (is_null($suffix))		? 'i' :	PHPExcel_Calculation_Functions::flattenSingleValue($suffix);
 
- 		if (((is_numeric($realNumber)) && (is_numeric($imaginary))) &&
 
- 			(($suffix == 'i') || ($suffix == 'j') || ($suffix == ''))) {
 
- 			if ($suffix == '') $suffix = 'i';
 
- 			if ($realNumber == 0.0) {
 
- 				if ($imaginary == 0.0) {
 
- 					return (string) '0';
 
- 				} elseif ($imaginary == 1.0) {
 
- 					return (string) $suffix;
 
- 				} elseif ($imaginary == -1.0) {
 
- 					return (string) '-'.$suffix;
 
- 				}
 
- 				return (string) $imaginary.$suffix;
 
- 			} elseif ($imaginary == 0.0) {
 
- 				return (string) $realNumber;
 
- 			} elseif ($imaginary == 1.0) {
 
- 				return (string) $realNumber.'+'.$suffix;
 
- 			} elseif ($imaginary == -1.0) {
 
- 				return (string) $realNumber.'-'.$suffix;
 
- 			}
 
- 			if ($imaginary > 0) { $imaginary = (string) '+'.$imaginary; }
 
- 			return (string) $realNumber.$imaginary.$suffix;
 
- 		}
 
- 		return PHPExcel_Calculation_Functions::VALUE();
 
- 	}	//	function COMPLEX()
 
- 	/**
 
- 	 * IMAGINARY
 
- 	 *
 
- 	 * Returns the imaginary coefficient of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	real
 
- 	 */
 
- 	public static function IMAGINARY($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		return $parsedComplex['imaginary'];
 
- 	}	//	function IMAGINARY()
 
- 	/**
 
- 	 * IMREAL
 
- 	 *
 
- 	 * Returns the real coefficient of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	real
 
- 	 */
 
- 	public static function IMREAL($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		return $parsedComplex['real'];
 
- 	}	//	function IMREAL()
 
- 	/**
 
- 	 * IMABS
 
- 	 *
 
- 	 * Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	real
 
- 	 */
 
- 	public static function IMABS($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		return sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']));
 
- 	}	//	function IMABS()
 
- 	/**
 
- 	 * 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.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMARGUMENT($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		if ($parsedComplex['real'] == 0.0) {
 
- 			if ($parsedComplex['imaginary'] == 0.0) {
 
- 				return 0.0;
 
- 			} elseif($parsedComplex['imaginary'] < 0.0) {
 
- 				return M_PI / -2;
 
- 			} else {
 
- 				return M_PI / 2;
 
- 			}
 
- 		} elseif ($parsedComplex['real'] > 0.0) {
 
- 			return atan($parsedComplex['imaginary'] / $parsedComplex['real']);
 
- 		} elseif ($parsedComplex['imaginary'] < 0.0) {
 
- 			return 0 - (M_PI - atan(abs($parsedComplex['imaginary']) / abs($parsedComplex['real'])));
 
- 		} else {
 
- 			return M_PI - atan($parsedComplex['imaginary'] / abs($parsedComplex['real']));
 
- 		}
 
- 	}	//	function IMARGUMENT()
 
- 	/**
 
- 	 * IMCONJUGATE
 
- 	 *
 
- 	 * Returns the complex conjugate of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMCONJUGATE($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		if ($parsedComplex['imaginary'] == 0.0) {
 
- 			return $parsedComplex['real'];
 
- 		} else {
 
- 			return self::_cleanComplex(self::COMPLEX($parsedComplex['real'], 0 - $parsedComplex['imaginary'], $parsedComplex['suffix']));
 
- 		}
 
- 	}	//	function IMCONJUGATE()
 
- 	/**
 
- 	 * IMCOS
 
- 	 *
 
- 	 * Returns the cosine of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMCOS($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		if ($parsedComplex['imaginary'] == 0.0) {
 
- 			return cos($parsedComplex['real']);
 
- 		} else {
 
- 			return self::IMCONJUGATE(self::COMPLEX(cos($parsedComplex['real']) * cosh($parsedComplex['imaginary']),sin($parsedComplex['real']) * sinh($parsedComplex['imaginary']),$parsedComplex['suffix']));
 
- 		}
 
- 	}	//	function IMCOS()
 
- 	/**
 
- 	 * IMSIN
 
- 	 *
 
- 	 * Returns the sine of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMSIN($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		if ($parsedComplex['imaginary'] == 0.0) {
 
- 			return sin($parsedComplex['real']);
 
- 		} else {
 
- 			return self::COMPLEX(sin($parsedComplex['real']) * cosh($parsedComplex['imaginary']),cos($parsedComplex['real']) * sinh($parsedComplex['imaginary']),$parsedComplex['suffix']);
 
- 		}
 
- 	}	//	function IMSIN()
 
- 	/**
 
- 	 * IMSQRT
 
- 	 *
 
- 	 * Returns the square root of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMSQRT($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		$theta = self::IMARGUMENT($complexNumber);
 
- 		$d1 = cos($theta / 2);
 
- 		$d2 = sin($theta / 2);
 
- 		$r = sqrt(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));
 
- 		if ($parsedComplex['suffix'] == '') {
 
- 			return self::COMPLEX($d1 * $r,$d2 * $r);
 
- 		} else {
 
- 			return self::COMPLEX($d1 * $r,$d2 * $r,$parsedComplex['suffix']);
 
- 		}
 
- 	}	//	function IMSQRT()
 
- 	/**
 
- 	 * IMLN
 
- 	 *
 
- 	 * Returns the natural logarithm of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMLN($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		$logR = log(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));
 
- 		$t = self::IMARGUMENT($complexNumber);
 
- 		if ($parsedComplex['suffix'] == '') {
 
- 			return self::COMPLEX($logR,$t);
 
- 		} else {
 
- 			return self::COMPLEX($logR,$t,$parsedComplex['suffix']);
 
- 		}
 
- 	}	//	function IMLN()
 
- 	/**
 
- 	 * IMLOG10
 
- 	 *
 
- 	 * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMLOG10($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		} elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
 
- 			return log10($parsedComplex['real']);
 
- 		}
 
- 		return self::IMPRODUCT(log10(EULER),self::IMLN($complexNumber));
 
- 	}	//	function IMLOG10()
 
- 	/**
 
- 	 * IMLOG2
 
- 	 *
 
- 	 * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMLOG2($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		} elseif (($parsedComplex['real'] > 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
 
- 			return log($parsedComplex['real'],2);
 
- 		}
 
- 		return self::IMPRODUCT(log(EULER,2),self::IMLN($complexNumber));
 
- 	}	//	function IMLOG2()
 
- 	/**
 
- 	 * IMEXP
 
- 	 *
 
- 	 * Returns the exponential of a complex number in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMEXP($complexNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		if (($parsedComplex['real'] == 0.0) && ($parsedComplex['imaginary'] == 0.0)) {
 
- 			return '1';
 
- 		}
 
- 		$e = exp($parsedComplex['real']);
 
- 		$eX = $e * cos($parsedComplex['imaginary']);
 
- 		$eY = $e * sin($parsedComplex['imaginary']);
 
- 		if ($parsedComplex['suffix'] == '') {
 
- 			return self::COMPLEX($eX,$eY);
 
- 		} else {
 
- 			return self::COMPLEX($eX,$eY,$parsedComplex['suffix']);
 
- 		}
 
- 	}	//	function IMEXP()
 
- 	/**
 
- 	 * IMPOWER
 
- 	 *
 
- 	 * Returns a complex number in x + yi or x + yj text format raised to a power.
 
- 	 *
 
- 	 * @param	string		$complexNumber
 
- 	 * @return	string
 
- 	 */
 
- 	public static function IMPOWER($complexNumber,$realNumber) {
 
- 		$complexNumber	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
 
- 		$realNumber		= PHPExcel_Calculation_Functions::flattenSingleValue($realNumber);
 
- 		if (!is_numeric($realNumber)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$parsedComplex = self::_parseComplex($complexNumber);
 
- 		if (!is_array($parsedComplex)) {
 
- 			return $parsedComplex;
 
- 		}
 
- 		$r = sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']));
 
- 		$rPower = pow($r,$realNumber);
 
- 		$theta = self::IMARGUMENT($complexNumber) * $realNumber;
 
- 		if ($theta == 0) {
 
- 			return 1;
 
- 		} elseif ($parsedComplex['imaginary'] == 0.0) {
 
- 			return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex['suffix']);
 
- 		} else {
 
- 			return self::COMPLEX($rPower * cos($theta),$rPower * sin($theta),$parsedComplex['suffix']);
 
- 		}
 
- 	}	//	function IMPOWER()
 
- 	/**
 
- 	 * IMDIV
 
- 	 *
 
- 	 * Returns the quotient of two complex numbers in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexDividend
 
- 	 * @param	string		$complexDivisor
 
- 	 * @return	real
 
- 	 */
 
- 	public static function IMDIV($complexDividend,$complexDivisor) {
 
- 		$complexDividend	= PHPExcel_Calculation_Functions::flattenSingleValue($complexDividend);
 
- 		$complexDivisor	= PHPExcel_Calculation_Functions::flattenSingleValue($complexDivisor);
 
- 		$parsedComplexDividend = self::_parseComplex($complexDividend);
 
- 		if (!is_array($parsedComplexDividend)) {
 
- 			return $parsedComplexDividend;
 
- 		}
 
- 		$parsedComplexDivisor = self::_parseComplex($complexDivisor);
 
- 		if (!is_array($parsedComplexDivisor)) {
 
- 			return $parsedComplexDividend;
 
- 		}
 
- 		if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] != '') &&
 
- 			($parsedComplexDividend['suffix'] != $parsedComplexDivisor['suffix'])) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		}
 
- 		if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] == '')) {
 
- 			$parsedComplexDivisor['suffix'] = $parsedComplexDividend['suffix'];
 
- 		}
 
- 		$d1 = ($parsedComplexDividend['real'] * $parsedComplexDivisor['real']) + ($parsedComplexDividend['imaginary'] * $parsedComplexDivisor['imaginary']);
 
- 		$d2 = ($parsedComplexDividend['imaginary'] * $parsedComplexDivisor['real']) - ($parsedComplexDividend['real'] * $parsedComplexDivisor['imaginary']);
 
- 		$d3 = ($parsedComplexDivisor['real'] * $parsedComplexDivisor['real']) + ($parsedComplexDivisor['imaginary'] * $parsedComplexDivisor['imaginary']);
 
- 		$r = $d1/$d3;
 
- 		$i = $d2/$d3;
 
- 		if ($i > 0.0) {
 
- 			return self::_cleanComplex($r.'+'.$i.$parsedComplexDivisor['suffix']);
 
- 		} elseif ($i < 0.0) {
 
- 			return self::_cleanComplex($r.$i.$parsedComplexDivisor['suffix']);
 
- 		} else {
 
- 			return $r;
 
- 		}
 
- 	}	//	function IMDIV()
 
- 	/**
 
- 	 * IMSUB
 
- 	 *
 
- 	 * Returns the difference of two complex numbers in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	string		$complexNumber1
 
- 	 * @param	string		$complexNumber2
 
- 	 * @return	real
 
- 	 */
 
- 	public static function IMSUB($complexNumber1,$complexNumber2) {
 
- 		$complexNumber1	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber1);
 
- 		$complexNumber2	= PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber2);
 
- 		$parsedComplex1 = self::_parseComplex($complexNumber1);
 
- 		if (!is_array($parsedComplex1)) {
 
- 			return $parsedComplex1;
 
- 		}
 
- 		$parsedComplex2 = self::_parseComplex($complexNumber2);
 
- 		if (!is_array($parsedComplex2)) {
 
- 			return $parsedComplex2;
 
- 		}
 
- 		if ((($parsedComplex1['suffix'] != '') && ($parsedComplex2['suffix'] != '')) &&
 
- 			($parsedComplex1['suffix'] != $parsedComplex2['suffix'])) {
 
- 			return PHPExcel_Calculation_Functions::NaN();
 
- 		} elseif (($parsedComplex1['suffix'] == '') && ($parsedComplex2['suffix'] != '')) {
 
- 			$parsedComplex1['suffix'] = $parsedComplex2['suffix'];
 
- 		}
 
- 		$d1 = $parsedComplex1['real'] - $parsedComplex2['real'];
 
- 		$d2 = $parsedComplex1['imaginary'] - $parsedComplex2['imaginary'];
 
- 		return self::COMPLEX($d1,$d2,$parsedComplex1['suffix']);
 
- 	}	//	function IMSUB()
 
- 	/**
 
- 	 * IMSUM
 
- 	 *
 
- 	 * Returns the sum of two or more complex numbers in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	array of mixed		Data Series
 
- 	 * @return	real
 
- 	 */
 
- 	public static function IMSUM() {
 
- 		// Return value
 
- 		$returnValue = self::_parseComplex('0');
 
- 		$activeSuffix = '';
 
- 		// Loop through the arguments
 
- 		$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
 
- 		foreach ($aArgs as $arg) {
 
- 			$parsedComplex = self::_parseComplex($arg);
 
- 			if (!is_array($parsedComplex)) {
 
- 				return $parsedComplex;
 
- 			}
 
- 			if ($activeSuffix == '') {
 
- 				$activeSuffix = $parsedComplex['suffix'];
 
- 			} elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) {
 
- 				return PHPExcel_Calculation_Functions::VALUE();
 
- 			}
 
- 			$returnValue['real'] += $parsedComplex['real'];
 
- 			$returnValue['imaginary'] += $parsedComplex['imaginary'];
 
- 		}
 
- 		if ($returnValue['imaginary'] == 0.0) { $activeSuffix = ''; }
 
- 		return self::COMPLEX($returnValue['real'],$returnValue['imaginary'],$activeSuffix);
 
- 	}	//	function IMSUM()
 
- 	/**
 
- 	 * IMPRODUCT
 
- 	 *
 
- 	 * Returns the product of two or more complex numbers in x + yi or x + yj text format.
 
- 	 *
 
- 	 * @param	array of mixed		Data Series
 
- 	 * @return	real
 
- 	 */
 
- 	public static function IMPRODUCT() {
 
- 		// Return value
 
- 		$returnValue = self::_parseComplex('1');
 
- 		$activeSuffix = '';
 
- 		// Loop through the arguments
 
- 		$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
 
- 		foreach ($aArgs as $arg) {
 
- 			$parsedComplex = self::_parseComplex($arg);
 
- 			if (!is_array($parsedComplex)) {
 
- 				return $parsedComplex;
 
- 			}
 
- 			$workValue = $returnValue;
 
- 			if (($parsedComplex['suffix'] != '') && ($activeSuffix == '')) {
 
- 				$activeSuffix = $parsedComplex['suffix'];
 
- 			} elseif (($parsedComplex['suffix'] != '') && ($activeSuffix != $parsedComplex['suffix'])) {
 
- 				return PHPExcel_Calculation_Functions::NaN();
 
- 			}
 
- 			$returnValue['real'] = ($workValue['real'] * $parsedComplex['real']) - ($workValue['imaginary'] * $parsedComplex['imaginary']);
 
- 			$returnValue['imaginary'] = ($workValue['real'] * $parsedComplex['imaginary']) + ($workValue['imaginary'] * $parsedComplex['real']);
 
- 		}
 
- 		if ($returnValue['imaginary'] == 0.0) { $activeSuffix = ''; }
 
- 		return self::COMPLEX($returnValue['real'],$returnValue['imaginary'],$activeSuffix);
 
- 	}	//	function IMPRODUCT()
 
- 	/**
 
- 	 * DELTA
 
- 	 *
 
- 	 * Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise.
 
- 	 *
 
- 	 * @param	float		$a
 
- 	 * @param	float		$b
 
- 	 * @return	int
 
- 	 */
 
- 	public static function DELTA($a, $b=0) {
 
- 		$a	= PHPExcel_Calculation_Functions::flattenSingleValue($a);
 
- 		$b	= PHPExcel_Calculation_Functions::flattenSingleValue($b);
 
- 		return (int) ($a == $b);
 
- 	}	//	function DELTA()
 
- 	/**
 
- 	 * GESTEP
 
- 	 *
 
- 	 * Returns 1 if number = step; returns 0 (zero) otherwise
 
- 	 *
 
- 	 * @param	float		$number
 
- 	 * @param	float		$step
 
- 	 * @return	int
 
- 	 */
 
- 	public static function GESTEP($number, $step=0) {
 
- 		$number	= PHPExcel_Calculation_Functions::flattenSingleValue($number);
 
- 		$step	= PHPExcel_Calculation_Functions::flattenSingleValue($step);
 
- 		return (int) ($number >= $step);
 
- 	}	//	function GESTEP()
 
- 	//
 
- 	//	Private method to calculate the erf value
 
- 	//
 
- 	private static $_two_sqrtpi = 1.128379167095512574;
 
- 	public static function _erfVal($x) {
 
- 		if (abs($x) > 2.2) {
 
- 			return 1 - self::_erfcVal($x);
 
- 		}
 
- 		$sum = $term = $x;
 
- 		$xsqr = ($x * $x);
 
- 		$j = 1;
 
- 		do {
 
- 			$term *= $xsqr / $j;
 
- 			$sum -= $term / (2 * $j + 1);
 
- 			++$j;
 
- 			$term *= $xsqr / $j;
 
- 			$sum += $term / (2 * $j + 1);
 
- 			++$j;
 
- 			if ($sum == 0.0) {
 
- 				break;
 
- 			}
 
- 		} while (abs($term / $sum) > PRECISION);
 
- 		return self::$_two_sqrtpi * $sum;
 
- 	}	//	function _erfVal()
 
- 	/**
 
- 	 * ERF
 
- 	 *
 
- 	 * Returns the error function integrated between lower_limit and upper_limit
 
- 	 *
 
- 	 * @param	float		$lower	lower bound for integrating ERF
 
- 	 * @param	float		$upper	upper bound for integrating ERF.
 
- 	 *								If omitted, ERF integrates between zero and lower_limit
 
- 	 * @return	int
 
- 	 */
 
- 	public static function ERF($lower, $upper = null) {
 
- 		$lower	= PHPExcel_Calculation_Functions::flattenSingleValue($lower);
 
- 		$upper	= PHPExcel_Calculation_Functions::flattenSingleValue($upper);
 
- 		if (is_numeric($lower)) {
 
- 			if ($lower < 0) {
 
- 				return PHPExcel_Calculation_Functions::NaN();
 
- 			}
 
- 			if (is_null($upper)) {
 
- 				return self::_erfVal($lower);
 
- 			}
 
- 			if (is_numeric($upper)) {
 
- 				if ($upper < 0) {
 
- 					return PHPExcel_Calculation_Functions::NaN();
 
- 				}
 
- 				return self::_erfVal($upper) - self::_erfVal($lower);
 
- 			}
 
- 		}
 
- 		return PHPExcel_Calculation_Functions::VALUE();
 
- 	}	//	function ERF()
 
- 	//
 
- 	//	Private method to calculate the erfc value
 
- 	//
 
- 	private static $_one_sqrtpi = 0.564189583547756287;
 
- 	private static function _erfcVal($x) {
 
- 		if (abs($x) < 2.2) {
 
- 			return 1 - self::_erfVal($x);
 
- 		}
 
- 		if ($x < 0) {
 
- 			return 2 - self::ERFC(-$x);
 
- 		}
 
- 		$a = $n = 1;
 
- 		$b = $c = $x;
 
- 		$d = ($x * $x) + 0.5;
 
- 		$q1 = $q2 = $b / $d;
 
- 		$t = 0;
 
- 		do {
 
- 			$t = $a * $n + $b * $x;
 
- 			$a = $b;
 
- 			$b = $t;
 
- 			$t = $c * $n + $d * $x;
 
- 			$c = $d;
 
- 			$d = $t;
 
- 			$n += 0.5;
 
- 			$q1 = $q2;
 
- 			$q2 = $b / $d;
 
- 		} while ((abs($q1 - $q2) / $q2) > PRECISION);
 
- 		return self::$_one_sqrtpi * exp(-$x * $x) * $q2;
 
- 	}	//	function _erfcVal()
 
- 	/**
 
- 	 * ERFC
 
- 	 *
 
- 	 * Returns the complementary ERF function integrated between x and infinity
 
- 	 *
 
- 	 * @param	float		$x		The lower bound for integrating ERF
 
- 	 * @return	int
 
- 	 */
 
- 	public static function ERFC($x) {
 
- 		$x	= PHPExcel_Calculation_Functions::flattenSingleValue($x);
 
- 		if (is_numeric($x)) {
 
- 			if ($x < 0) {
 
- 				return PHPExcel_Calculation_Functions::NaN();
 
- 			}
 
- 			return self::_erfcVal($x);
 
- 		}
 
- 		return PHPExcel_Calculation_Functions::VALUE();
 
- 	}	//	function ERFC()
 
- 	/**
 
- 	 * getConversionGroups
 
- 	 *
 
- 	 * @return	array
 
- 	 */
 
- 	public static function getConversionGroups() {
 
- 		$conversionGroups = array();
 
- 		foreach(self::$_conversionUnits as $conversionUnit) {
 
- 			$conversionGroups[] = $conversionUnit['Group'];
 
- 		}
 
- 		return array_merge(array_unique($conversionGroups));
 
- 	}	//	function getConversionGroups()
 
- 	/**
 
- 	 * getConversionGroupUnits
 
- 	 *
 
- 	 * @return	array
 
- 	 */
 
- 	public static function getConversionGroupUnits($group = NULL) {
 
- 		$conversionGroups = array();
 
- 		foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) {
 
- 			if ((is_null($group)) || ($conversionGroup['Group'] == $group)) {
 
- 				$conversionGroups[$conversionGroup['Group']][] = $conversionUnit;
 
- 			}
 
- 		}
 
- 		return $conversionGroups;
 
- 	}	//	function getConversionGroupUnits()
 
- 	/**
 
- 	 * getConversionGroupUnitDetails
 
- 	 *
 
- 	 * @return	array
 
- 	 */
 
- 	public static function getConversionGroupUnitDetails($group = NULL) {
 
- 		$conversionGroups = array();
 
- 		foreach(self::$_conversionUnits as $conversionUnit => $conversionGroup) {
 
- 			if ((is_null($group)) || ($conversionGroup['Group'] == $group)) {
 
- 				$conversionGroups[$conversionGroup['Group']][] = array(	'unit'			=> $conversionUnit,
 
- 																		'description'	=> $conversionGroup['Unit Name']
 
- 																	  );
 
- 			}
 
- 		}
 
- 		return $conversionGroups;
 
- 	}	//	function getConversionGroupUnitDetails()
 
- 	/**
 
- 	 * getConversionGroups
 
- 	 *
 
- 	 * @return	array
 
- 	 */
 
- 	public static function getConversionMultipliers() {
 
- 		return self::$_conversionMultipliers;
 
- 	}	//	function getConversionGroups()
 
- 	/**
 
- 	 * CONVERTUOM
 
- 	 *
 
- 	 * @param	float		$value
 
- 	 * @param	string		$fromUOM
 
- 	 * @param	string		$toUOM
 
- 	 * @return	float
 
- 	 */
 
- 	public static function CONVERTUOM($value, $fromUOM, $toUOM) {
 
- 		$value		= PHPExcel_Calculation_Functions::flattenSingleValue($value);
 
- 		$fromUOM	= PHPExcel_Calculation_Functions::flattenSingleValue($fromUOM);
 
- 		$toUOM		= PHPExcel_Calculation_Functions::flattenSingleValue($toUOM);
 
- 		if (!is_numeric($value)) {
 
- 			return PHPExcel_Calculation_Functions::VALUE();
 
- 		}
 
- 		$fromMultiplier = 1;
 
- 		if (isset(self::$_conversionUnits[$fromUOM])) {
 
- 			$unitGroup1 = self::$_conversionUnits[$fromUOM]['Group'];
 
- 		} else {
 
- 			$fromMultiplier = substr($fromUOM,0,1);
 
- 			$fromUOM = substr($fromUOM,1);
 
- 			if (isset(self::$_conversionMultipliers[$fromMultiplier])) {
 
- 				$fromMultiplier = self::$_conversionMultipliers[$fromMultiplier]['multiplier'];
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::NA();
 
- 			}
 
- 			if ((isset(self::$_conversionUnits[$fromUOM])) && (self::$_conversionUnits[$fromUOM]['AllowPrefix'])) {
 
- 				$unitGroup1 = self::$_conversionUnits[$fromUOM]['Group'];
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::NA();
 
- 			}
 
- 		}
 
- 		$value *= $fromMultiplier;
 
- 		$toMultiplier = 1;
 
- 		if (isset(self::$_conversionUnits[$toUOM])) {
 
- 			$unitGroup2 = self::$_conversionUnits[$toUOM]['Group'];
 
- 		} else {
 
- 			$toMultiplier = substr($toUOM,0,1);
 
- 			$toUOM = substr($toUOM,1);
 
- 			if (isset(self::$_conversionMultipliers[$toMultiplier])) {
 
- 				$toMultiplier = self::$_conversionMultipliers[$toMultiplier]['multiplier'];
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::NA();
 
- 			}
 
- 			if ((isset(self::$_conversionUnits[$toUOM])) && (self::$_conversionUnits[$toUOM]['AllowPrefix'])) {
 
- 				$unitGroup2 = self::$_conversionUnits[$toUOM]['Group'];
 
- 			} else {
 
- 				return PHPExcel_Calculation_Functions::NA();
 
- 			}
 
- 		}
 
- 		if ($unitGroup1 != $unitGroup2) {
 
- 			return PHPExcel_Calculation_Functions::NA();
 
- 		}
 
- 		if ($fromUOM == $toUOM) {
 
- 			return 1.0;
 
- 		} elseif ($unitGroup1 == 'Temperature') {
 
- 			if (($fromUOM == 'F') || ($fromUOM == 'fah')) {
 
- 				if (($toUOM == 'F') || ($toUOM == 'fah')) {
 
- 					return 1.0;
 
- 				} else {
 
- 					$value = (($value - 32) / 1.8);
 
- 					if (($toUOM == 'K') || ($toUOM == 'kel')) {
 
- 						$value += 273.15;
 
- 					}
 
- 					return $value;
 
- 				}
 
- 			} elseif ((($fromUOM == 'K') || ($fromUOM == 'kel')) &&
 
- 					  (($toUOM == 'K') || ($toUOM == 'kel'))) {
 
- 						return 1.0;
 
- 			} elseif ((($fromUOM == 'C') || ($fromUOM == 'cel')) &&
 
- 					  (($toUOM == 'C') || ($toUOM == 'cel'))) {
 
- 					return 1.0;
 
- 			}
 
- 			if (($toUOM == 'F') || ($toUOM == 'fah')) {
 
- 				if (($fromUOM == 'K') || ($fromUOM == 'kel')) {
 
- 					$value -= 273.15;
 
- 				}
 
- 				return ($value * 1.8) + 32;
 
- 			}
 
- 			if (($toUOM == 'C') || ($toUOM == 'cel')) {
 
- 				return $value - 273.15;
 
- 			}
 
- 			return $value + 273.15;
 
- 		}
 
- 		return ($value * self::$_unitConversions[$unitGroup1][$fromUOM][$toUOM]) / $toMultiplier;
 
- 	}	//	function CONVERTUOM()
 
- }	//	class PHPExcel_Calculation_Engineering
 
 
  |