Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Engineering often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Engineering, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
30 | class Engineering |
||
31 | { |
||
32 | /** |
||
33 | * Details of the Units of measure that can be used in CONVERTUOM(). |
||
34 | * |
||
35 | * @var mixed[] |
||
36 | */ |
||
37 | private static $conversionUnits = [ |
||
38 | 'g' => ['Group' => 'Mass', 'Unit Name' => 'Gram', 'AllowPrefix' => true], |
||
39 | 'sg' => ['Group' => 'Mass', 'Unit Name' => 'Slug', 'AllowPrefix' => false], |
||
40 | 'lbm' => ['Group' => 'Mass', 'Unit Name' => 'Pound mass (avoirdupois)', 'AllowPrefix' => false], |
||
41 | 'u' => ['Group' => 'Mass', 'Unit Name' => 'U (atomic mass unit)', 'AllowPrefix' => true], |
||
42 | 'ozm' => ['Group' => 'Mass', 'Unit Name' => 'Ounce mass (avoirdupois)', 'AllowPrefix' => false], |
||
43 | 'm' => ['Group' => 'Distance', 'Unit Name' => 'Meter', 'AllowPrefix' => true], |
||
44 | 'mi' => ['Group' => 'Distance', 'Unit Name' => 'Statute mile', 'AllowPrefix' => false], |
||
45 | 'Nmi' => ['Group' => 'Distance', 'Unit Name' => 'Nautical mile', 'AllowPrefix' => false], |
||
46 | 'in' => ['Group' => 'Distance', 'Unit Name' => 'Inch', 'AllowPrefix' => false], |
||
47 | 'ft' => ['Group' => 'Distance', 'Unit Name' => 'Foot', 'AllowPrefix' => false], |
||
48 | 'yd' => ['Group' => 'Distance', 'Unit Name' => 'Yard', 'AllowPrefix' => false], |
||
49 | 'ang' => ['Group' => 'Distance', 'Unit Name' => 'Angstrom', 'AllowPrefix' => true], |
||
50 | 'Pica' => ['Group' => 'Distance', 'Unit Name' => 'Pica (1/72 in)', 'AllowPrefix' => false], |
||
51 | 'yr' => ['Group' => 'Time', 'Unit Name' => 'Year', 'AllowPrefix' => false], |
||
52 | 'day' => ['Group' => 'Time', 'Unit Name' => 'Day', 'AllowPrefix' => false], |
||
53 | 'hr' => ['Group' => 'Time', 'Unit Name' => 'Hour', 'AllowPrefix' => false], |
||
54 | 'mn' => ['Group' => 'Time', 'Unit Name' => 'Minute', 'AllowPrefix' => false], |
||
55 | 'sec' => ['Group' => 'Time', 'Unit Name' => 'Second', 'AllowPrefix' => true], |
||
56 | 'Pa' => ['Group' => 'Pressure', 'Unit Name' => 'Pascal', 'AllowPrefix' => true], |
||
57 | 'p' => ['Group' => 'Pressure', 'Unit Name' => 'Pascal', 'AllowPrefix' => true], |
||
58 | 'atm' => ['Group' => 'Pressure', 'Unit Name' => 'Atmosphere', 'AllowPrefix' => true], |
||
59 | 'at' => ['Group' => 'Pressure', 'Unit Name' => 'Atmosphere', 'AllowPrefix' => true], |
||
60 | 'mmHg' => ['Group' => 'Pressure', 'Unit Name' => 'mm of Mercury', 'AllowPrefix' => true], |
||
61 | 'N' => ['Group' => 'Force', 'Unit Name' => 'Newton', 'AllowPrefix' => true], |
||
62 | 'dyn' => ['Group' => 'Force', 'Unit Name' => 'Dyne', 'AllowPrefix' => true], |
||
63 | 'dy' => ['Group' => 'Force', 'Unit Name' => 'Dyne', 'AllowPrefix' => true], |
||
64 | 'lbf' => ['Group' => 'Force', 'Unit Name' => 'Pound force', 'AllowPrefix' => false], |
||
65 | 'J' => ['Group' => 'Energy', 'Unit Name' => 'Joule', 'AllowPrefix' => true], |
||
66 | 'e' => ['Group' => 'Energy', 'Unit Name' => 'Erg', 'AllowPrefix' => true], |
||
67 | 'c' => ['Group' => 'Energy', 'Unit Name' => 'Thermodynamic calorie', 'AllowPrefix' => true], |
||
68 | 'cal' => ['Group' => 'Energy', 'Unit Name' => 'IT calorie', 'AllowPrefix' => true], |
||
69 | 'eV' => ['Group' => 'Energy', 'Unit Name' => 'Electron volt', 'AllowPrefix' => true], |
||
70 | 'ev' => ['Group' => 'Energy', 'Unit Name' => 'Electron volt', 'AllowPrefix' => true], |
||
71 | 'HPh' => ['Group' => 'Energy', 'Unit Name' => 'Horsepower-hour', 'AllowPrefix' => false], |
||
72 | 'hh' => ['Group' => 'Energy', 'Unit Name' => 'Horsepower-hour', 'AllowPrefix' => false], |
||
73 | 'Wh' => ['Group' => 'Energy', 'Unit Name' => 'Watt-hour', 'AllowPrefix' => true], |
||
74 | 'wh' => ['Group' => 'Energy', 'Unit Name' => 'Watt-hour', 'AllowPrefix' => true], |
||
75 | 'flb' => ['Group' => 'Energy', 'Unit Name' => 'Foot-pound', 'AllowPrefix' => false], |
||
76 | 'BTU' => ['Group' => 'Energy', 'Unit Name' => 'BTU', 'AllowPrefix' => false], |
||
77 | 'btu' => ['Group' => 'Energy', 'Unit Name' => 'BTU', 'AllowPrefix' => false], |
||
78 | 'HP' => ['Group' => 'Power', 'Unit Name' => 'Horsepower', 'AllowPrefix' => false], |
||
79 | 'h' => ['Group' => 'Power', 'Unit Name' => 'Horsepower', 'AllowPrefix' => false], |
||
80 | 'W' => ['Group' => 'Power', 'Unit Name' => 'Watt', 'AllowPrefix' => true], |
||
81 | 'w' => ['Group' => 'Power', 'Unit Name' => 'Watt', 'AllowPrefix' => true], |
||
82 | 'T' => ['Group' => 'Magnetism', 'Unit Name' => 'Tesla', 'AllowPrefix' => true], |
||
83 | 'ga' => ['Group' => 'Magnetism', 'Unit Name' => 'Gauss', 'AllowPrefix' => true], |
||
84 | 'C' => ['Group' => 'Temperature', 'Unit Name' => 'Celsius', 'AllowPrefix' => false], |
||
85 | 'cel' => ['Group' => 'Temperature', 'Unit Name' => 'Celsius', 'AllowPrefix' => false], |
||
86 | 'F' => ['Group' => 'Temperature', 'Unit Name' => 'Fahrenheit', 'AllowPrefix' => false], |
||
87 | 'fah' => ['Group' => 'Temperature', 'Unit Name' => 'Fahrenheit', 'AllowPrefix' => false], |
||
88 | 'K' => ['Group' => 'Temperature', 'Unit Name' => 'Kelvin', 'AllowPrefix' => false], |
||
89 | 'kel' => ['Group' => 'Temperature', 'Unit Name' => 'Kelvin', 'AllowPrefix' => false], |
||
90 | 'tsp' => ['Group' => 'Liquid', 'Unit Name' => 'Teaspoon', 'AllowPrefix' => false], |
||
91 | 'tbs' => ['Group' => 'Liquid', 'Unit Name' => 'Tablespoon', 'AllowPrefix' => false], |
||
92 | 'oz' => ['Group' => 'Liquid', 'Unit Name' => 'Fluid Ounce', 'AllowPrefix' => false], |
||
93 | 'cup' => ['Group' => 'Liquid', 'Unit Name' => 'Cup', 'AllowPrefix' => false], |
||
94 | 'pt' => ['Group' => 'Liquid', 'Unit Name' => 'U.S. Pint', 'AllowPrefix' => false], |
||
95 | 'us_pt' => ['Group' => 'Liquid', 'Unit Name' => 'U.S. Pint', 'AllowPrefix' => false], |
||
96 | 'uk_pt' => ['Group' => 'Liquid', 'Unit Name' => 'U.K. Pint', 'AllowPrefix' => false], |
||
97 | 'qt' => ['Group' => 'Liquid', 'Unit Name' => 'Quart', 'AllowPrefix' => false], |
||
98 | 'gal' => ['Group' => 'Liquid', 'Unit Name' => 'Gallon', 'AllowPrefix' => false], |
||
99 | 'l' => ['Group' => 'Liquid', 'Unit Name' => 'Litre', 'AllowPrefix' => true], |
||
100 | 'lt' => ['Group' => 'Liquid', 'Unit Name' => 'Litre', 'AllowPrefix' => true], |
||
101 | ]; |
||
102 | |||
103 | /** |
||
104 | * Details of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM(). |
||
105 | * |
||
106 | * @var mixed[] |
||
107 | */ |
||
108 | private static $conversionMultipliers = [ |
||
109 | 'Y' => ['multiplier' => 1E24, 'name' => 'yotta'], |
||
110 | 'Z' => ['multiplier' => 1E21, 'name' => 'zetta'], |
||
111 | 'E' => ['multiplier' => 1E18, 'name' => 'exa'], |
||
112 | 'P' => ['multiplier' => 1E15, 'name' => 'peta'], |
||
113 | 'T' => ['multiplier' => 1E12, 'name' => 'tera'], |
||
114 | 'G' => ['multiplier' => 1E9, 'name' => 'giga'], |
||
115 | 'M' => ['multiplier' => 1E6, 'name' => 'mega'], |
||
116 | 'k' => ['multiplier' => 1E3, 'name' => 'kilo'], |
||
117 | 'h' => ['multiplier' => 1E2, 'name' => 'hecto'], |
||
118 | 'e' => ['multiplier' => 1E1, 'name' => 'deka'], |
||
119 | 'd' => ['multiplier' => 1E-1, 'name' => 'deci'], |
||
120 | 'c' => ['multiplier' => 1E-2, 'name' => 'centi'], |
||
121 | 'm' => ['multiplier' => 1E-3, 'name' => 'milli'], |
||
122 | 'u' => ['multiplier' => 1E-6, 'name' => 'micro'], |
||
123 | 'n' => ['multiplier' => 1E-9, 'name' => 'nano'], |
||
124 | 'p' => ['multiplier' => 1E-12, 'name' => 'pico'], |
||
125 | 'f' => ['multiplier' => 1E-15, 'name' => 'femto'], |
||
126 | 'a' => ['multiplier' => 1E-18, 'name' => 'atto'], |
||
127 | 'z' => ['multiplier' => 1E-21, 'name' => 'zepto'], |
||
128 | 'y' => ['multiplier' => 1E-24, 'name' => 'yocto'], |
||
129 | ]; |
||
130 | |||
131 | /** |
||
132 | * Details of the Units of measure conversion factors, organised by group. |
||
133 | * |
||
134 | * @var mixed[] |
||
135 | */ |
||
136 | private static $unitConversions = [ |
||
137 | 'Mass' => [ |
||
138 | 'g' => [ |
||
139 | 'g' => 1.0, |
||
140 | 'sg' => 6.85220500053478E-05, |
||
141 | 'lbm' => 2.20462291469134E-03, |
||
142 | 'u' => 6.02217000000000E+23, |
||
143 | 'ozm' => 3.52739718003627E-02, |
||
144 | ], |
||
145 | 'sg' => [ |
||
146 | 'g' => 1.45938424189287E+04, |
||
147 | 'sg' => 1.0, |
||
148 | 'lbm' => 3.21739194101647E+01, |
||
149 | 'u' => 8.78866000000000E+27, |
||
150 | 'ozm' => 5.14782785944229E+02, |
||
151 | ], |
||
152 | 'lbm' => [ |
||
153 | 'g' => 4.5359230974881148E+02, |
||
154 | 'sg' => 3.10810749306493E-02, |
||
155 | 'lbm' => 1.0, |
||
156 | 'u' => 2.73161000000000E+26, |
||
157 | 'ozm' => 1.60000023429410E+01, |
||
158 | ], |
||
159 | 'u' => [ |
||
160 | 'g' => 1.66053100460465E-24, |
||
161 | 'sg' => 1.13782988532950E-28, |
||
162 | 'lbm' => 3.66084470330684E-27, |
||
163 | 'u' => 1.0, |
||
164 | 'ozm' => 5.85735238300524E-26, |
||
165 | ], |
||
166 | 'ozm' => [ |
||
167 | 'g' => 2.83495152079732E+01, |
||
168 | 'sg' => 1.94256689870811E-03, |
||
169 | 'lbm' => 6.24999908478882E-02, |
||
170 | 'u' => 1.70725600000000E+25, |
||
171 | 'ozm' => 1.0, |
||
172 | ], |
||
173 | ], |
||
174 | 'Distance' => [ |
||
175 | 'm' => [ |
||
176 | 'm' => 1.0, |
||
177 | 'mi' => 6.21371192237334E-04, |
||
178 | 'Nmi' => 5.39956803455724E-04, |
||
179 | 'in' => 3.93700787401575E+01, |
||
180 | 'ft' => 3.28083989501312E+00, |
||
181 | 'yd' => 1.09361329797891E+00, |
||
182 | 'ang' => 1.00000000000000E+10, |
||
183 | 'Pica' => 2.83464566929116E+03, |
||
184 | ], |
||
185 | 'mi' => [ |
||
186 | 'm' => 1.60934400000000E+03, |
||
187 | 'mi' => 1.0, |
||
188 | 'Nmi' => 8.68976241900648E-01, |
||
189 | 'in' => 6.33600000000000E+04, |
||
190 | 'ft' => 5.28000000000000E+03, |
||
191 | 'yd' => 1.76000000000000E+03, |
||
192 | 'ang' => 1.60934400000000E+13, |
||
193 | 'Pica' => 4.56191999999971E+06, |
||
194 | ], |
||
195 | 'Nmi' => [ |
||
196 | 'm' => 1.85200000000000E+03, |
||
197 | 'mi' => 1.15077944802354E+00, |
||
198 | 'Nmi' => 1.0, |
||
199 | 'in' => 7.29133858267717E+04, |
||
200 | 'ft' => 6.07611548556430E+03, |
||
201 | 'yd' => 2.02537182785694E+03, |
||
202 | 'ang' => 1.85200000000000E+13, |
||
203 | 'Pica' => 5.24976377952723E+06, |
||
204 | ], |
||
205 | 'in' => [ |
||
206 | 'm' => 2.54000000000000E-02, |
||
207 | 'mi' => 1.57828282828283E-05, |
||
208 | 'Nmi' => 1.37149028077754E-05, |
||
209 | 'in' => 1.0, |
||
210 | 'ft' => 8.33333333333333E-02, |
||
211 | 'yd' => 2.77777777686643E-02, |
||
212 | 'ang' => 2.54000000000000E+08, |
||
213 | 'Pica' => 7.19999999999955E+01, |
||
214 | ], |
||
215 | 'ft' => [ |
||
216 | 'm' => 3.04800000000000E-01, |
||
217 | 'mi' => 1.89393939393939E-04, |
||
218 | 'Nmi' => 1.64578833693305E-04, |
||
219 | 'in' => 1.20000000000000E+01, |
||
220 | 'ft' => 1.0, |
||
221 | 'yd' => 3.33333333223972E-01, |
||
222 | 'ang' => 3.04800000000000E+09, |
||
223 | 'Pica' => 8.63999999999946E+02, |
||
224 | ], |
||
225 | 'yd' => [ |
||
226 | 'm' => 9.14400000300000E-01, |
||
227 | 'mi' => 5.68181818368230E-04, |
||
228 | 'Nmi' => 4.93736501241901E-04, |
||
229 | 'in' => 3.60000000118110E+01, |
||
230 | 'ft' => 3.00000000000000E+00, |
||
231 | 'yd' => 1.0, |
||
232 | 'ang' => 9.14400000300000E+09, |
||
233 | 'Pica' => 2.59200000085023E+03, |
||
234 | ], |
||
235 | 'ang' => [ |
||
236 | 'm' => 1.00000000000000E-10, |
||
237 | 'mi' => 6.21371192237334E-14, |
||
238 | 'Nmi' => 5.39956803455724E-14, |
||
239 | 'in' => 3.93700787401575E-09, |
||
240 | 'ft' => 3.28083989501312E-10, |
||
241 | 'yd' => 1.09361329797891E-10, |
||
242 | 'ang' => 1.0, |
||
243 | 'Pica' => 2.83464566929116E-07, |
||
244 | ], |
||
245 | 'Pica' => [ |
||
246 | 'm' => 3.52777777777800E-04, |
||
247 | 'mi' => 2.19205948372629E-07, |
||
248 | 'Nmi' => 1.90484761219114E-07, |
||
249 | 'in' => 1.38888888888898E-02, |
||
250 | 'ft' => 1.15740740740748E-03, |
||
251 | 'yd' => 3.85802469009251E-04, |
||
252 | 'ang' => 3.52777777777800E+06, |
||
253 | 'Pica' => 1.0, |
||
254 | ], |
||
255 | ], |
||
256 | 'Time' => [ |
||
257 | 'yr' => [ |
||
258 | 'yr' => 1.0, |
||
259 | 'day' => 365.25, |
||
260 | 'hr' => 8766.0, |
||
261 | 'mn' => 525960.0, |
||
262 | 'sec' => 31557600.0, |
||
263 | ], |
||
264 | 'day' => [ |
||
265 | 'yr' => 2.73785078713210E-03, |
||
266 | 'day' => 1.0, |
||
267 | 'hr' => 24.0, |
||
268 | 'mn' => 1440.0, |
||
269 | 'sec' => 86400.0, |
||
270 | ], |
||
271 | 'hr' => [ |
||
272 | 'yr' => 1.14077116130504E-04, |
||
273 | 'day' => 4.16666666666667E-02, |
||
274 | 'hr' => 1.0, |
||
275 | 'mn' => 60.0, |
||
276 | 'sec' => 3600.0, |
||
277 | ], |
||
278 | 'mn' => [ |
||
279 | 'yr' => 1.90128526884174E-06, |
||
280 | 'day' => 6.94444444444444E-04, |
||
281 | 'hr' => 1.66666666666667E-02, |
||
282 | 'mn' => 1.0, |
||
283 | 'sec' => 60.0, |
||
284 | ], |
||
285 | 'sec' => [ |
||
286 | 'yr' => 3.16880878140289E-08, |
||
287 | 'day' => 1.15740740740741E-05, |
||
288 | 'hr' => 2.77777777777778E-04, |
||
289 | 'mn' => 1.66666666666667E-02, |
||
290 | 'sec' => 1.0, |
||
291 | ], |
||
292 | ], |
||
293 | 'Pressure' => [ |
||
294 | 'Pa' => [ |
||
295 | 'Pa' => 1.0, |
||
296 | 'p' => 1.0, |
||
297 | 'atm' => 9.86923299998193E-06, |
||
298 | 'at' => 9.86923299998193E-06, |
||
299 | 'mmHg' => 7.50061707998627E-03, |
||
300 | ], |
||
301 | 'p' => [ |
||
302 | 'Pa' => 1.0, |
||
303 | 'p' => 1.0, |
||
304 | 'atm' => 9.86923299998193E-06, |
||
305 | 'at' => 9.86923299998193E-06, |
||
306 | 'mmHg' => 7.50061707998627E-03, |
||
307 | ], |
||
308 | 'atm' => [ |
||
309 | 'Pa' => 1.01324996583000E+05, |
||
310 | 'p' => 1.01324996583000E+05, |
||
311 | 'atm' => 1.0, |
||
312 | 'at' => 1.0, |
||
313 | 'mmHg' => 760.0, |
||
314 | ], |
||
315 | 'at' => [ |
||
316 | 'Pa' => 1.01324996583000E+05, |
||
317 | 'p' => 1.01324996583000E+05, |
||
318 | 'atm' => 1.0, |
||
319 | 'at' => 1.0, |
||
320 | 'mmHg' => 760.0, |
||
321 | ], |
||
322 | 'mmHg' => [ |
||
323 | 'Pa' => 1.33322363925000E+02, |
||
324 | 'p' => 1.33322363925000E+02, |
||
325 | 'atm' => 1.31578947368421E-03, |
||
326 | 'at' => 1.31578947368421E-03, |
||
327 | 'mmHg' => 1.0, |
||
328 | ], |
||
329 | ], |
||
330 | 'Force' => [ |
||
331 | 'N' => [ |
||
332 | 'N' => 1.0, |
||
333 | 'dyn' => 1.0E+5, |
||
334 | 'dy' => 1.0E+5, |
||
335 | 'lbf' => 2.24808923655339E-01, |
||
336 | ], |
||
337 | 'dyn' => [ |
||
338 | 'N' => 1.0E-5, |
||
339 | 'dyn' => 1.0, |
||
340 | 'dy' => 1.0, |
||
341 | 'lbf' => 2.24808923655339E-06, |
||
342 | ], |
||
343 | 'dy' => [ |
||
344 | 'N' => 1.0E-5, |
||
345 | 'dyn' => 1.0, |
||
346 | 'dy' => 1.0, |
||
347 | 'lbf' => 2.24808923655339E-06, |
||
348 | ], |
||
349 | 'lbf' => [ |
||
350 | 'N' => 4.448222, |
||
351 | 'dyn' => 4.448222E+5, |
||
352 | 'dy' => 4.448222E+5, |
||
353 | 'lbf' => 1.0, |
||
354 | ], |
||
355 | ], |
||
356 | 'Energy' => [ |
||
357 | 'J' => [ |
||
358 | 'J' => 1.0, |
||
359 | 'e' => 9.99999519343231E+06, |
||
360 | 'c' => 2.39006249473467E-01, |
||
361 | 'cal' => 2.38846190642017E-01, |
||
362 | 'eV' => 6.24145700000000E+18, |
||
363 | 'ev' => 6.24145700000000E+18, |
||
364 | 'HPh' => 3.72506430801000E-07, |
||
365 | 'hh' => 3.72506430801000E-07, |
||
366 | 'Wh' => 2.77777916238711E-04, |
||
367 | 'wh' => 2.77777916238711E-04, |
||
368 | 'flb' => 2.37304222192651E+01, |
||
369 | 'BTU' => 9.47815067349015E-04, |
||
370 | 'btu' => 9.47815067349015E-04, |
||
371 | ], |
||
372 | 'e' => [ |
||
373 | 'J' => 1.00000048065700E-07, |
||
374 | 'e' => 1.0, |
||
375 | 'c' => 2.39006364353494E-08, |
||
376 | 'cal' => 2.38846305445111E-08, |
||
377 | 'eV' => 6.24146000000000E+11, |
||
378 | 'ev' => 6.24146000000000E+11, |
||
379 | 'HPh' => 3.72506609848824E-14, |
||
380 | 'hh' => 3.72506609848824E-14, |
||
381 | 'Wh' => 2.77778049754611E-11, |
||
382 | 'wh' => 2.77778049754611E-11, |
||
383 | 'flb' => 2.37304336254586E-06, |
||
384 | 'BTU' => 9.47815522922962E-11, |
||
385 | 'btu' => 9.47815522922962E-11, |
||
386 | ], |
||
387 | 'c' => [ |
||
388 | 'J' => 4.18399101363672E+00, |
||
389 | 'e' => 4.18398900257312E+07, |
||
390 | 'c' => 1.0, |
||
391 | 'cal' => 9.99330315287563E-01, |
||
392 | 'eV' => 2.61142000000000E+19, |
||
393 | 'ev' => 2.61142000000000E+19, |
||
394 | 'HPh' => 1.55856355899327E-06, |
||
395 | 'hh' => 1.55856355899327E-06, |
||
396 | 'Wh' => 1.16222030532950E-03, |
||
397 | 'wh' => 1.16222030532950E-03, |
||
398 | 'flb' => 9.92878733152102E+01, |
||
399 | 'BTU' => 3.96564972437776E-03, |
||
400 | 'btu' => 3.96564972437776E-03, |
||
401 | ], |
||
402 | 'cal' => [ |
||
403 | 'J' => 4.18679484613929E+00, |
||
404 | 'e' => 4.18679283372801E+07, |
||
405 | 'c' => 1.00067013349059E+00, |
||
406 | 'cal' => 1.0, |
||
407 | 'eV' => 2.61317000000000E+19, |
||
408 | 'ev' => 2.61317000000000E+19, |
||
409 | 'HPh' => 1.55960800463137E-06, |
||
410 | 'hh' => 1.55960800463137E-06, |
||
411 | 'Wh' => 1.16299914807955E-03, |
||
412 | 'wh' => 1.16299914807955E-03, |
||
413 | 'flb' => 9.93544094443283E+01, |
||
414 | 'BTU' => 3.96830723907002E-03, |
||
415 | 'btu' => 3.96830723907002E-03, |
||
416 | ], |
||
417 | 'eV' => [ |
||
418 | 'J' => 1.60219000146921E-19, |
||
419 | 'e' => 1.60218923136574E-12, |
||
420 | 'c' => 3.82933423195043E-20, |
||
421 | 'cal' => 3.82676978535648E-20, |
||
422 | 'eV' => 1.0, |
||
423 | 'ev' => 1.0, |
||
424 | 'HPh' => 5.96826078912344E-26, |
||
425 | 'hh' => 5.96826078912344E-26, |
||
426 | 'Wh' => 4.45053000026614E-23, |
||
427 | 'wh' => 4.45053000026614E-23, |
||
428 | 'flb' => 3.80206452103492E-18, |
||
429 | 'BTU' => 1.51857982414846E-22, |
||
430 | 'btu' => 1.51857982414846E-22, |
||
431 | ], |
||
432 | 'ev' => [ |
||
433 | 'J' => 1.60219000146921E-19, |
||
434 | 'e' => 1.60218923136574E-12, |
||
435 | 'c' => 3.82933423195043E-20, |
||
436 | 'cal' => 3.82676978535648E-20, |
||
437 | 'eV' => 1.0, |
||
438 | 'ev' => 1.0, |
||
439 | 'HPh' => 5.96826078912344E-26, |
||
440 | 'hh' => 5.96826078912344E-26, |
||
441 | 'Wh' => 4.45053000026614E-23, |
||
442 | 'wh' => 4.45053000026614E-23, |
||
443 | 'flb' => 3.80206452103492E-18, |
||
444 | 'BTU' => 1.51857982414846E-22, |
||
445 | 'btu' => 1.51857982414846E-22, |
||
446 | ], |
||
447 | 'HPh' => [ |
||
448 | 'J' => 2.68451741316170E+06, |
||
449 | 'e' => 2.68451612283024E+13, |
||
450 | 'c' => 6.41616438565991E+05, |
||
451 | 'cal' => 6.41186757845835E+05, |
||
452 | 'eV' => 1.67553000000000E+25, |
||
453 | 'ev' => 1.67553000000000E+25, |
||
454 | 'HPh' => 1.0, |
||
455 | 'hh' => 1.0, |
||
456 | 'Wh' => 7.45699653134593E+02, |
||
457 | 'wh' => 7.45699653134593E+02, |
||
458 | 'flb' => 6.37047316692964E+07, |
||
459 | 'BTU' => 2.54442605275546E+03, |
||
460 | 'btu' => 2.54442605275546E+03, |
||
461 | ], |
||
462 | 'hh' => [ |
||
463 | 'J' => 2.68451741316170E+06, |
||
464 | 'e' => 2.68451612283024E+13, |
||
465 | 'c' => 6.41616438565991E+05, |
||
466 | 'cal' => 6.41186757845835E+05, |
||
467 | 'eV' => 1.67553000000000E+25, |
||
468 | 'ev' => 1.67553000000000E+25, |
||
469 | 'HPh' => 1.0, |
||
470 | 'hh' => 1.0, |
||
471 | 'Wh' => 7.45699653134593E+02, |
||
472 | 'wh' => 7.45699653134593E+02, |
||
473 | 'flb' => 6.37047316692964E+07, |
||
474 | 'BTU' => 2.54442605275546E+03, |
||
475 | 'btu' => 2.54442605275546E+03, |
||
476 | ], |
||
477 | 'Wh' => [ |
||
478 | 'J' => 3.59999820554720E+03, |
||
479 | 'e' => 3.59999647518369E+10, |
||
480 | 'c' => 8.60422069219046E+02, |
||
481 | 'cal' => 8.59845857713046E+02, |
||
482 | 'eV' => 2.24692340000000E+22, |
||
483 | 'ev' => 2.24692340000000E+22, |
||
484 | 'HPh' => 1.34102248243839E-03, |
||
485 | 'hh' => 1.34102248243839E-03, |
||
486 | 'Wh' => 1.0, |
||
487 | 'wh' => 1.0, |
||
488 | 'flb' => 8.54294774062316E+04, |
||
489 | 'BTU' => 3.41213254164705E+00, |
||
490 | 'btu' => 3.41213254164705E+00, |
||
491 | ], |
||
492 | 'wh' => [ |
||
493 | 'J' => 3.59999820554720E+03, |
||
494 | 'e' => 3.59999647518369E+10, |
||
495 | 'c' => 8.60422069219046E+02, |
||
496 | 'cal' => 8.59845857713046E+02, |
||
497 | 'eV' => 2.24692340000000E+22, |
||
498 | 'ev' => 2.24692340000000E+22, |
||
499 | 'HPh' => 1.34102248243839E-03, |
||
500 | 'hh' => 1.34102248243839E-03, |
||
501 | 'Wh' => 1.0, |
||
502 | 'wh' => 1.0, |
||
503 | 'flb' => 8.54294774062316E+04, |
||
504 | 'BTU' => 3.41213254164705E+00, |
||
505 | 'btu' => 3.41213254164705E+00, |
||
506 | ], |
||
507 | 'flb' => [ |
||
508 | 'J' => 4.21400003236424E-02, |
||
509 | 'e' => 4.21399800687660E+05, |
||
510 | 'c' => 1.00717234301644E-02, |
||
511 | 'cal' => 1.00649785509554E-02, |
||
512 | 'eV' => 2.63015000000000E+17, |
||
513 | 'ev' => 2.63015000000000E+17, |
||
514 | 'HPh' => 1.56974211145130E-08, |
||
515 | 'hh' => 1.56974211145130E-08, |
||
516 | 'Wh' => 1.17055614802000E-05, |
||
517 | 'wh' => 1.17055614802000E-05, |
||
518 | 'flb' => 1.0, |
||
519 | 'BTU' => 3.99409272448406E-05, |
||
520 | 'btu' => 3.99409272448406E-05, |
||
521 | ], |
||
522 | 'BTU' => [ |
||
523 | 'J' => 1.05505813786749E+03, |
||
524 | 'e' => 1.05505763074665E+10, |
||
525 | 'c' => 2.52165488508168E+02, |
||
526 | 'cal' => 2.51996617135510E+02, |
||
527 | 'eV' => 6.58510000000000E+21, |
||
528 | 'ev' => 6.58510000000000E+21, |
||
529 | 'HPh' => 3.93015941224568E-04, |
||
530 | 'hh' => 3.93015941224568E-04, |
||
531 | 'Wh' => 2.93071851047526E-01, |
||
532 | 'wh' => 2.93071851047526E-01, |
||
533 | 'flb' => 2.50369750774671E+04, |
||
534 | 'BTU' => 1.0, |
||
535 | 'btu' => 1.0, |
||
536 | ], |
||
537 | 'btu' => [ |
||
538 | 'J' => 1.05505813786749E+03, |
||
539 | 'e' => 1.05505763074665E+10, |
||
540 | 'c' => 2.52165488508168E+02, |
||
541 | 'cal' => 2.51996617135510E+02, |
||
542 | 'eV' => 6.58510000000000E+21, |
||
543 | 'ev' => 6.58510000000000E+21, |
||
544 | 'HPh' => 3.93015941224568E-04, |
||
545 | 'hh' => 3.93015941224568E-04, |
||
546 | 'Wh' => 2.93071851047526E-01, |
||
547 | 'wh' => 2.93071851047526E-01, |
||
548 | 'flb' => 2.50369750774671E+04, |
||
549 | 'BTU' => 1.0, |
||
550 | 'btu' => 1.0, |
||
551 | ], |
||
552 | ], |
||
553 | 'Power' => [ |
||
554 | 'HP' => [ |
||
555 | 'HP' => 1.0, |
||
556 | 'h' => 1.0, |
||
557 | 'W' => 7.45701000000000E+02, |
||
558 | 'w' => 7.45701000000000E+02, |
||
559 | ], |
||
560 | 'h' => [ |
||
561 | 'HP' => 1.0, |
||
562 | 'h' => 1.0, |
||
563 | 'W' => 7.45701000000000E+02, |
||
564 | 'w' => 7.45701000000000E+02, |
||
565 | ], |
||
566 | 'W' => [ |
||
567 | 'HP' => 1.34102006031908E-03, |
||
568 | 'h' => 1.34102006031908E-03, |
||
569 | 'W' => 1.0, |
||
570 | 'w' => 1.0, |
||
571 | ], |
||
572 | 'w' => [ |
||
573 | 'HP' => 1.34102006031908E-03, |
||
574 | 'h' => 1.34102006031908E-03, |
||
575 | 'W' => 1.0, |
||
576 | 'w' => 1.0, |
||
577 | ], |
||
578 | ], |
||
579 | 'Magnetism' => [ |
||
580 | 'T' => [ |
||
581 | 'T' => 1.0, |
||
582 | 'ga' => 10000.0, |
||
583 | ], |
||
584 | 'ga' => [ |
||
585 | 'T' => 0.0001, |
||
586 | 'ga' => 1.0, |
||
587 | ], |
||
588 | ], |
||
589 | 'Liquid' => [ |
||
590 | 'tsp' => [ |
||
591 | 'tsp' => 1.0, |
||
592 | 'tbs' => 3.33333333333333E-01, |
||
593 | 'oz' => 1.66666666666667E-01, |
||
594 | 'cup' => 2.08333333333333E-02, |
||
595 | 'pt' => 1.04166666666667E-02, |
||
596 | 'us_pt' => 1.04166666666667E-02, |
||
597 | 'uk_pt' => 8.67558516821960E-03, |
||
598 | 'qt' => 5.20833333333333E-03, |
||
599 | 'gal' => 1.30208333333333E-03, |
||
600 | 'l' => 4.92999408400710E-03, |
||
601 | 'lt' => 4.92999408400710E-03, |
||
602 | ], |
||
603 | 'tbs' => [ |
||
604 | 'tsp' => 3.00000000000000E+00, |
||
605 | 'tbs' => 1.0, |
||
606 | 'oz' => 5.00000000000000E-01, |
||
607 | 'cup' => 6.25000000000000E-02, |
||
608 | 'pt' => 3.12500000000000E-02, |
||
609 | 'us_pt' => 3.12500000000000E-02, |
||
610 | 'uk_pt' => 2.60267555046588E-02, |
||
611 | 'qt' => 1.56250000000000E-02, |
||
612 | 'gal' => 3.90625000000000E-03, |
||
613 | 'l' => 1.47899822520213E-02, |
||
614 | 'lt' => 1.47899822520213E-02, |
||
615 | ], |
||
616 | 'oz' => [ |
||
617 | 'tsp' => 6.00000000000000E+00, |
||
618 | 'tbs' => 2.00000000000000E+00, |
||
619 | 'oz' => 1.0, |
||
620 | 'cup' => 1.25000000000000E-01, |
||
621 | 'pt' => 6.25000000000000E-02, |
||
622 | 'us_pt' => 6.25000000000000E-02, |
||
623 | 'uk_pt' => 5.20535110093176E-02, |
||
624 | 'qt' => 3.12500000000000E-02, |
||
625 | 'gal' => 7.81250000000000E-03, |
||
626 | 'l' => 2.95799645040426E-02, |
||
627 | 'lt' => 2.95799645040426E-02, |
||
628 | ], |
||
629 | 'cup' => [ |
||
630 | 'tsp' => 4.80000000000000E+01, |
||
631 | 'tbs' => 1.60000000000000E+01, |
||
632 | 'oz' => 8.00000000000000E+00, |
||
633 | 'cup' => 1.0, |
||
634 | 'pt' => 5.00000000000000E-01, |
||
635 | 'us_pt' => 5.00000000000000E-01, |
||
636 | 'uk_pt' => 4.16428088074541E-01, |
||
637 | 'qt' => 2.50000000000000E-01, |
||
638 | 'gal' => 6.25000000000000E-02, |
||
639 | 'l' => 2.36639716032341E-01, |
||
640 | 'lt' => 2.36639716032341E-01, |
||
641 | ], |
||
642 | 'pt' => [ |
||
643 | 'tsp' => 9.60000000000000E+01, |
||
644 | 'tbs' => 3.20000000000000E+01, |
||
645 | 'oz' => 1.60000000000000E+01, |
||
646 | 'cup' => 2.00000000000000E+00, |
||
647 | 'pt' => 1.0, |
||
648 | 'us_pt' => 1.0, |
||
649 | 'uk_pt' => 8.32856176149081E-01, |
||
650 | 'qt' => 5.00000000000000E-01, |
||
651 | 'gal' => 1.25000000000000E-01, |
||
652 | 'l' => 4.73279432064682E-01, |
||
653 | 'lt' => 4.73279432064682E-01, |
||
654 | ], |
||
655 | 'us_pt' => [ |
||
656 | 'tsp' => 9.60000000000000E+01, |
||
657 | 'tbs' => 3.20000000000000E+01, |
||
658 | 'oz' => 1.60000000000000E+01, |
||
659 | 'cup' => 2.00000000000000E+00, |
||
660 | 'pt' => 1.0, |
||
661 | 'us_pt' => 1.0, |
||
662 | 'uk_pt' => 8.32856176149081E-01, |
||
663 | 'qt' => 5.00000000000000E-01, |
||
664 | 'gal' => 1.25000000000000E-01, |
||
665 | 'l' => 4.73279432064682E-01, |
||
666 | 'lt' => 4.73279432064682E-01, |
||
667 | ], |
||
668 | 'uk_pt' => [ |
||
669 | 'tsp' => 1.15266000000000E+02, |
||
670 | 'tbs' => 3.84220000000000E+01, |
||
671 | 'oz' => 1.92110000000000E+01, |
||
672 | 'cup' => 2.40137500000000E+00, |
||
673 | 'pt' => 1.20068750000000E+00, |
||
674 | 'us_pt' => 1.20068750000000E+00, |
||
675 | 'uk_pt' => 1.0, |
||
676 | 'qt' => 6.00343750000000E-01, |
||
677 | 'gal' => 1.50085937500000E-01, |
||
678 | 'l' => 5.68260698087162E-01, |
||
679 | 'lt' => 5.68260698087162E-01, |
||
680 | ], |
||
681 | 'qt' => [ |
||
682 | 'tsp' => 1.92000000000000E+02, |
||
683 | 'tbs' => 6.40000000000000E+01, |
||
684 | 'oz' => 3.20000000000000E+01, |
||
685 | 'cup' => 4.00000000000000E+00, |
||
686 | 'pt' => 2.00000000000000E+00, |
||
687 | 'us_pt' => 2.00000000000000E+00, |
||
688 | 'uk_pt' => 1.66571235229816E+00, |
||
689 | 'qt' => 1.0, |
||
690 | 'gal' => 2.50000000000000E-01, |
||
691 | 'l' => 9.46558864129363E-01, |
||
692 | 'lt' => 9.46558864129363E-01, |
||
693 | ], |
||
694 | 'gal' => [ |
||
695 | 'tsp' => 7.68000000000000E+02, |
||
696 | 'tbs' => 2.56000000000000E+02, |
||
697 | 'oz' => 1.28000000000000E+02, |
||
698 | 'cup' => 1.60000000000000E+01, |
||
699 | 'pt' => 8.00000000000000E+00, |
||
700 | 'us_pt' => 8.00000000000000E+00, |
||
701 | 'uk_pt' => 6.66284940919265E+00, |
||
702 | 'qt' => 4.00000000000000E+00, |
||
703 | 'gal' => 1.0, |
||
704 | 'l' => 3.78623545651745E+00, |
||
705 | 'lt' => 3.78623545651745E+00, |
||
706 | ], |
||
707 | 'l' => [ |
||
708 | 'tsp' => 2.02840000000000E+02, |
||
709 | 'tbs' => 6.76133333333333E+01, |
||
710 | 'oz' => 3.38066666666667E+01, |
||
711 | 'cup' => 4.22583333333333E+00, |
||
712 | 'pt' => 2.11291666666667E+00, |
||
713 | 'us_pt' => 2.11291666666667E+00, |
||
714 | 'uk_pt' => 1.75975569552166E+00, |
||
715 | 'qt' => 1.05645833333333E+00, |
||
716 | 'gal' => 2.64114583333333E-01, |
||
717 | 'l' => 1.0, |
||
718 | 'lt' => 1.0, |
||
719 | ], |
||
720 | 'lt' => [ |
||
721 | 'tsp' => 2.02840000000000E+02, |
||
722 | 'tbs' => 6.76133333333333E+01, |
||
723 | 'oz' => 3.38066666666667E+01, |
||
724 | 'cup' => 4.22583333333333E+00, |
||
725 | 'pt' => 2.11291666666667E+00, |
||
726 | 'us_pt' => 2.11291666666667E+00, |
||
727 | 'uk_pt' => 1.75975569552166E+00, |
||
728 | 'qt' => 1.05645833333333E+00, |
||
729 | 'gal' => 2.64114583333333E-01, |
||
730 | 'l' => 1.0, |
||
731 | 'lt' => 1.0, |
||
732 | ], |
||
733 | ], |
||
734 | ]; |
||
735 | |||
736 | /** |
||
737 | * parseComplex. |
||
738 | * |
||
739 | * Parses a complex number into its real and imaginary parts, and an I or J suffix |
||
740 | * |
||
741 | * @param string $complexNumber The complex number |
||
742 | * |
||
743 | * @return string[] Indexed on "real", "imaginary" and "suffix" |
||
744 | */ |
||
745 | 354 | public static function parseComplex($complexNumber) |
|
792 | |||
793 | /** |
||
794 | * Cleans the leading characters in a complex number string. |
||
795 | * |
||
796 | * @param string $complexNumber The complex number to clean |
||
797 | * |
||
798 | * @return string The "cleaned" complex number |
||
799 | */ |
||
800 | 38 | private static function cleanComplex($complexNumber) |
|
817 | |||
818 | /** |
||
819 | * Formats a number base string value with leading zeroes. |
||
820 | * |
||
821 | * @param string $xVal The "number" to pad |
||
822 | * @param int $places The length that we want to pad this value |
||
823 | * |
||
824 | * @return string The padded "number" |
||
825 | */ |
||
826 | 82 | private static function nbrConversionFormat($xVal, $places) |
|
846 | |||
847 | /** |
||
848 | * BESSELI. |
||
849 | * |
||
850 | * Returns the modified Bessel function In(x), which is equivalent to the Bessel function evaluated |
||
851 | * for purely imaginary arguments |
||
852 | * |
||
853 | * Excel Function: |
||
854 | * BESSELI(x,ord) |
||
855 | * |
||
856 | * @category Engineering Functions |
||
857 | * |
||
858 | * @param float $x The value at which to evaluate the function. |
||
859 | * If x is nonnumeric, BESSELI returns the #VALUE! error value. |
||
860 | * @param int $ord The order of the Bessel function. |
||
861 | * If ord is not an integer, it is truncated. |
||
862 | * If $ord is nonnumeric, BESSELI returns the #VALUE! error value. |
||
863 | * If $ord < 0, BESSELI returns the #NUM! error value. |
||
864 | * |
||
865 | * @return float |
||
866 | */ |
||
867 | 74 | public static function BESSELI($x, $ord) |
|
902 | |||
903 | /** |
||
904 | * BESSELJ. |
||
905 | * |
||
906 | * Returns the Bessel function |
||
907 | * |
||
908 | * Excel Function: |
||
909 | * BESSELJ(x,ord) |
||
910 | * |
||
911 | * @category Engineering Functions |
||
912 | * |
||
913 | * @param float $x The value at which to evaluate the function. |
||
914 | * If x is nonnumeric, BESSELJ returns the #VALUE! error value. |
||
915 | * @param int $ord The order of the Bessel function. If n is not an integer, it is truncated. |
||
916 | * If $ord is nonnumeric, BESSELJ returns the #VALUE! error value. |
||
917 | * If $ord < 0, BESSELJ returns the #NUM! error value. |
||
918 | * |
||
919 | * @return float |
||
920 | */ |
||
921 | 50 | public static function BESSELJ($x, $ord) |
|
958 | |||
959 | 22 | private static function besselK0($fNum) |
|
976 | |||
977 | 30 | private static function besselK1($fNum) |
|
994 | |||
995 | /** |
||
996 | * BESSELK. |
||
997 | * |
||
998 | * Returns the modified Bessel function Kn(x), which is equivalent to the Bessel functions evaluated |
||
999 | * for purely imaginary arguments. |
||
1000 | * |
||
1001 | * Excel Function: |
||
1002 | * BESSELK(x,ord) |
||
1003 | * |
||
1004 | * @category Engineering Functions |
||
1005 | * |
||
1006 | * @param float $x The value at which to evaluate the function. |
||
1007 | * If x is nonnumeric, BESSELK returns the #VALUE! error value. |
||
1008 | * @param int $ord The order of the Bessel function. If n is not an integer, it is truncated. |
||
1009 | * If $ord is nonnumeric, BESSELK returns the #VALUE! error value. |
||
1010 | * If $ord < 0, BESSELK returns the #NUM! error value. |
||
1011 | * |
||
1012 | * @return float |
||
1013 | */ |
||
1014 | 38 | View Code Duplication | public static function BESSELK($x, $ord) |
1047 | |||
1048 | 11 | private static function besselY0($fNum) |
|
1066 | |||
1067 | 16 | private static function besselY1($fNum) |
|
1082 | |||
1083 | /** |
||
1084 | * BESSELY. |
||
1085 | * |
||
1086 | * Returns the Bessel function, which is also called the Weber function or the Neumann function. |
||
1087 | * |
||
1088 | * Excel Function: |
||
1089 | * BESSELY(x,ord) |
||
1090 | * |
||
1091 | * @category Engineering Functions |
||
1092 | * |
||
1093 | * @param float $x The value at which to evaluate the function. |
||
1094 | * If x is nonnumeric, BESSELK returns the #VALUE! error value. |
||
1095 | * @param int $ord The order of the Bessel function. If n is not an integer, it is truncated. |
||
1096 | * If $ord is nonnumeric, BESSELK returns the #VALUE! error value. |
||
1097 | * If $ord < 0, BESSELK returns the #NUM! error value. |
||
1098 | * |
||
1099 | * @return float |
||
1100 | */ |
||
1101 | 23 | View Code Duplication | public static function BESSELY($x, $ord) |
1134 | |||
1135 | /** |
||
1136 | * BINTODEC. |
||
1137 | * |
||
1138 | * Return a binary value as decimal. |
||
1139 | * |
||
1140 | * Excel Function: |
||
1141 | * BIN2DEC(x) |
||
1142 | * |
||
1143 | * @category Engineering Functions |
||
1144 | * |
||
1145 | * @param string $x The binary number (as a string) that you want to convert. The number |
||
1146 | * cannot contain more than 10 characters (10 bits). The most significant |
||
1147 | * bit of number is the sign bit. The remaining 9 bits are magnitude bits. |
||
1148 | * Negative numbers are represented using two's-complement notation. |
||
1149 | * If number is not a valid binary number, or if number contains more than |
||
1150 | * 10 characters (10 bits), BIN2DEC returns the #NUM! error value. |
||
1151 | * |
||
1152 | * @return string |
||
1153 | */ |
||
1154 | 10 | public static function BINTODEC($x) |
|
1183 | |||
1184 | /** |
||
1185 | * BINTOHEX. |
||
1186 | * |
||
1187 | * Return a binary value as hex. |
||
1188 | * |
||
1189 | * Excel Function: |
||
1190 | * BIN2HEX(x[,places]) |
||
1191 | * |
||
1192 | * @category Engineering Functions |
||
1193 | * |
||
1194 | * @param string $x The binary number (as a string) that you want to convert. The number |
||
1195 | * cannot contain more than 10 characters (10 bits). The most significant |
||
1196 | * bit of number is the sign bit. The remaining 9 bits are magnitude bits. |
||
1197 | * Negative numbers are represented using two's-complement notation. |
||
1198 | * If number is not a valid binary number, or if number contains more than |
||
1199 | * 10 characters (10 bits), BIN2HEX returns the #NUM! error value. |
||
1200 | * @param int $places The number of characters to use. If places is omitted, BIN2HEX uses the |
||
1201 | * minimum number of characters necessary. Places is useful for padding the |
||
1202 | * return value with leading 0s (zeros). |
||
1203 | * If places is not an integer, it is truncated. |
||
1204 | * If places is nonnumeric, BIN2HEX returns the #VALUE! error value. |
||
1205 | * If places is negative, BIN2HEX returns the #NUM! error value. |
||
1206 | * |
||
1207 | * @return string |
||
1208 | */ |
||
1209 | 14 | View Code Duplication | public static function BINTOHEX($x, $places = null) |
1239 | |||
1240 | /** |
||
1241 | * BINTOOCT. |
||
1242 | * |
||
1243 | * Return a binary value as octal. |
||
1244 | * |
||
1245 | * Excel Function: |
||
1246 | * BIN2OCT(x[,places]) |
||
1247 | * |
||
1248 | * @category Engineering Functions |
||
1249 | * |
||
1250 | * @param string $x The binary number (as a string) that you want to convert. The number |
||
1251 | * cannot contain more than 10 characters (10 bits). The most significant |
||
1252 | * bit of number is the sign bit. The remaining 9 bits are magnitude bits. |
||
1253 | * Negative numbers are represented using two's-complement notation. |
||
1254 | * If number is not a valid binary number, or if number contains more than |
||
1255 | * 10 characters (10 bits), BIN2OCT returns the #NUM! error value. |
||
1256 | * @param int $places The number of characters to use. If places is omitted, BIN2OCT uses the |
||
1257 | * minimum number of characters necessary. Places is useful for padding the |
||
1258 | * return value with leading 0s (zeros). |
||
1259 | * If places is not an integer, it is truncated. |
||
1260 | * If places is nonnumeric, BIN2OCT returns the #VALUE! error value. |
||
1261 | * If places is negative, BIN2OCT returns the #NUM! error value. |
||
1262 | * |
||
1263 | * @return string |
||
1264 | */ |
||
1265 | 15 | View Code Duplication | public static function BINTOOCT($x, $places = null) |
1294 | |||
1295 | /** |
||
1296 | * DECTOBIN. |
||
1297 | * |
||
1298 | * Return a decimal value as binary. |
||
1299 | * |
||
1300 | * Excel Function: |
||
1301 | * DEC2BIN(x[,places]) |
||
1302 | * |
||
1303 | * @category Engineering Functions |
||
1304 | * |
||
1305 | * @param string $x The decimal integer you want to convert. If number is negative, |
||
1306 | * valid place values are ignored and DEC2BIN returns a 10-character |
||
1307 | * (10-bit) binary number in which the most significant bit is the sign |
||
1308 | * bit. The remaining 9 bits are magnitude bits. Negative numbers are |
||
1309 | * represented using two's-complement notation. |
||
1310 | * If number < -512 or if number > 511, DEC2BIN returns the #NUM! error |
||
1311 | * value. |
||
1312 | * If number is nonnumeric, DEC2BIN returns the #VALUE! error value. |
||
1313 | * If DEC2BIN requires more than places characters, it returns the #NUM! |
||
1314 | * error value. |
||
1315 | * @param int $places The number of characters to use. If places is omitted, DEC2BIN uses |
||
1316 | * the minimum number of characters necessary. Places is useful for |
||
1317 | * padding the return value with leading 0s (zeros). |
||
1318 | * If places is not an integer, it is truncated. |
||
1319 | * If places is nonnumeric, DEC2BIN returns the #VALUE! error value. |
||
1320 | * If places is zero or negative, DEC2BIN returns the #NUM! error value. |
||
1321 | * |
||
1322 | * @return string |
||
1323 | */ |
||
1324 | 41 | public static function DECTOBIN($x, $places = null) |
|
1355 | |||
1356 | /** |
||
1357 | * DECTOHEX. |
||
1358 | * |
||
1359 | * Return a decimal value as hex. |
||
1360 | * |
||
1361 | * Excel Function: |
||
1362 | * DEC2HEX(x[,places]) |
||
1363 | * |
||
1364 | * @category Engineering Functions |
||
1365 | * |
||
1366 | * @param string $x The decimal integer you want to convert. If number is negative, |
||
1367 | * places is ignored and DEC2HEX returns a 10-character (40-bit) |
||
1368 | * hexadecimal number in which the most significant bit is the sign |
||
1369 | * bit. The remaining 39 bits are magnitude bits. Negative numbers |
||
1370 | * are represented using two's-complement notation. |
||
1371 | * If number < -549,755,813,888 or if number > 549,755,813,887, |
||
1372 | * DEC2HEX returns the #NUM! error value. |
||
1373 | * If number is nonnumeric, DEC2HEX returns the #VALUE! error value. |
||
1374 | * If DEC2HEX requires more than places characters, it returns the |
||
1375 | * #NUM! error value. |
||
1376 | * @param int $places The number of characters to use. If places is omitted, DEC2HEX uses |
||
1377 | * the minimum number of characters necessary. Places is useful for |
||
1378 | * padding the return value with leading 0s (zeros). |
||
1379 | * If places is not an integer, it is truncated. |
||
1380 | * If places is nonnumeric, DEC2HEX returns the #VALUE! error value. |
||
1381 | * If places is zero or negative, DEC2HEX returns the #NUM! error value. |
||
1382 | * |
||
1383 | * @return string |
||
1384 | */ |
||
1385 | 15 | View Code Duplication | public static function DECTOHEX($x, $places = null) |
1410 | |||
1411 | /** |
||
1412 | * DECTOOCT. |
||
1413 | * |
||
1414 | * Return an decimal value as octal. |
||
1415 | * |
||
1416 | * Excel Function: |
||
1417 | * DEC2OCT(x[,places]) |
||
1418 | * |
||
1419 | * @category Engineering Functions |
||
1420 | * |
||
1421 | * @param string $x The decimal integer you want to convert. If number is negative, |
||
1422 | * places is ignored and DEC2OCT returns a 10-character (30-bit) |
||
1423 | * octal number in which the most significant bit is the sign bit. |
||
1424 | * The remaining 29 bits are magnitude bits. Negative numbers are |
||
1425 | * represented using two's-complement notation. |
||
1426 | * If number < -536,870,912 or if number > 536,870,911, DEC2OCT |
||
1427 | * returns the #NUM! error value. |
||
1428 | * If number is nonnumeric, DEC2OCT returns the #VALUE! error value. |
||
1429 | * If DEC2OCT requires more than places characters, it returns the |
||
1430 | * #NUM! error value. |
||
1431 | * @param int $places The number of characters to use. If places is omitted, DEC2OCT uses |
||
1432 | * the minimum number of characters necessary. Places is useful for |
||
1433 | * padding the return value with leading 0s (zeros). |
||
1434 | * If places is not an integer, it is truncated. |
||
1435 | * If places is nonnumeric, DEC2OCT returns the #VALUE! error value. |
||
1436 | * If places is zero or negative, DEC2OCT returns the #NUM! error value. |
||
1437 | * |
||
1438 | * @return string |
||
1439 | */ |
||
1440 | 20 | View Code Duplication | public static function DECTOOCT($x, $places = null) |
1466 | |||
1467 | /** |
||
1468 | * HEXTOBIN. |
||
1469 | * |
||
1470 | * Return a hex value as binary. |
||
1471 | * |
||
1472 | * Excel Function: |
||
1473 | * HEX2BIN(x[,places]) |
||
1474 | * |
||
1475 | * @category Engineering Functions |
||
1476 | * |
||
1477 | * @param string $x the hexadecimal number you want to convert. |
||
1478 | * Number cannot contain more than 10 characters. |
||
1479 | * The most significant bit of number is the sign bit (40th bit from the right). |
||
1480 | * The remaining 9 bits are magnitude bits. |
||
1481 | * Negative numbers are represented using two's-complement notation. |
||
1482 | * If number is negative, HEX2BIN ignores places and returns a 10-character binary number. |
||
1483 | * If number is negative, it cannot be less than FFFFFFFE00, |
||
1484 | * and if number is positive, it cannot be greater than 1FF. |
||
1485 | * If number is not a valid hexadecimal number, HEX2BIN returns the #NUM! error value. |
||
1486 | * If HEX2BIN requires more than places characters, it returns the #NUM! error value. |
||
1487 | * @param int $places The number of characters to use. If places is omitted, |
||
1488 | * HEX2BIN uses the minimum number of characters necessary. Places |
||
1489 | * is useful for padding the return value with leading 0s (zeros). |
||
1490 | * If places is not an integer, it is truncated. |
||
1491 | * If places is nonnumeric, HEX2BIN returns the #VALUE! error value. |
||
1492 | * If places is negative, HEX2BIN returns the #NUM! error value. |
||
1493 | * |
||
1494 | * @return string |
||
1495 | */ |
||
1496 | 16 | View Code Duplication | public static function HEXTOBIN($x, $places = null) |
1511 | |||
1512 | /** |
||
1513 | * HEXTODEC. |
||
1514 | * |
||
1515 | * Return a hex value as decimal. |
||
1516 | * |
||
1517 | * Excel Function: |
||
1518 | * HEX2DEC(x) |
||
1519 | * |
||
1520 | * @category Engineering Functions |
||
1521 | * |
||
1522 | * @param string $x The hexadecimal number you want to convert. This number cannot |
||
1523 | * contain more than 10 characters (40 bits). The most significant |
||
1524 | * bit of number is the sign bit. The remaining 39 bits are magnitude |
||
1525 | * bits. Negative numbers are represented using two's-complement |
||
1526 | * notation. |
||
1527 | * If number is not a valid hexadecimal number, HEX2DEC returns the |
||
1528 | * #NUM! error value. |
||
1529 | * |
||
1530 | * @return string |
||
1531 | */ |
||
1532 | 37 | public static function HEXTODEC($x) |
|
1562 | |||
1563 | /** |
||
1564 | * HEXTOOCT. |
||
1565 | * |
||
1566 | * Return a hex value as octal. |
||
1567 | * |
||
1568 | * Excel Function: |
||
1569 | * HEX2OCT(x[,places]) |
||
1570 | * |
||
1571 | * @category Engineering Functions |
||
1572 | * |
||
1573 | * @param string $x The hexadecimal number you want to convert. Number cannot |
||
1574 | * contain more than 10 characters. The most significant bit of |
||
1575 | * number is the sign bit. The remaining 39 bits are magnitude |
||
1576 | * bits. Negative numbers are represented using two's-complement |
||
1577 | * notation. |
||
1578 | * If number is negative, HEX2OCT ignores places and returns a |
||
1579 | * 10-character octal number. |
||
1580 | * If number is negative, it cannot be less than FFE0000000, and |
||
1581 | * if number is positive, it cannot be greater than 1FFFFFFF. |
||
1582 | * If number is not a valid hexadecimal number, HEX2OCT returns |
||
1583 | * the #NUM! error value. |
||
1584 | * If HEX2OCT requires more than places characters, it returns |
||
1585 | * the #NUM! error value. |
||
1586 | * @param int $places The number of characters to use. If places is omitted, HEX2OCT |
||
1587 | * uses the minimum number of characters necessary. Places is |
||
1588 | * useful for padding the return value with leading 0s (zeros). |
||
1589 | * If places is not an integer, it is truncated. |
||
1590 | * If places is nonnumeric, HEX2OCT returns the #VALUE! error |
||
1591 | * value. |
||
1592 | * If places is negative, HEX2OCT returns the #NUM! error value. |
||
1593 | * |
||
1594 | * @return string |
||
1595 | */ |
||
1596 | 13 | public static function HEXTOOCT($x, $places = null) |
|
1616 | |||
1617 | /** |
||
1618 | * OCTTOBIN. |
||
1619 | * |
||
1620 | * Return an octal value as binary. |
||
1621 | * |
||
1622 | * Excel Function: |
||
1623 | * OCT2BIN(x[,places]) |
||
1624 | * |
||
1625 | * @category Engineering Functions |
||
1626 | * |
||
1627 | * @param string $x The octal number you want to convert. Number may not |
||
1628 | * contain more than 10 characters. The most significant |
||
1629 | * bit of number is the sign bit. The remaining 29 bits |
||
1630 | * are magnitude bits. Negative numbers are represented |
||
1631 | * using two's-complement notation. |
||
1632 | * If number is negative, OCT2BIN ignores places and returns |
||
1633 | * a 10-character binary number. |
||
1634 | * If number is negative, it cannot be less than 7777777000, |
||
1635 | * and if number is positive, it cannot be greater than 777. |
||
1636 | * If number is not a valid octal number, OCT2BIN returns |
||
1637 | * the #NUM! error value. |
||
1638 | * If OCT2BIN requires more than places characters, it |
||
1639 | * returns the #NUM! error value. |
||
1640 | * @param int $places The number of characters to use. If places is omitted, |
||
1641 | * OCT2BIN uses the minimum number of characters necessary. |
||
1642 | * Places is useful for padding the return value with |
||
1643 | * leading 0s (zeros). |
||
1644 | * If places is not an integer, it is truncated. |
||
1645 | * If places is nonnumeric, OCT2BIN returns the #VALUE! |
||
1646 | * error value. |
||
1647 | * If places is negative, OCT2BIN returns the #NUM! error |
||
1648 | * value. |
||
1649 | * |
||
1650 | * @return string |
||
1651 | */ |
||
1652 | 13 | View Code Duplication | public static function OCTTOBIN($x, $places = null) |
1667 | |||
1668 | /** |
||
1669 | * OCTTODEC. |
||
1670 | * |
||
1671 | * Return an octal value as decimal. |
||
1672 | * |
||
1673 | * Excel Function: |
||
1674 | * OCT2DEC(x) |
||
1675 | * |
||
1676 | * @category Engineering Functions |
||
1677 | * |
||
1678 | * @param string $x The octal number you want to convert. Number may not contain |
||
1679 | * more than 10 octal characters (30 bits). The most significant |
||
1680 | * bit of number is the sign bit. The remaining 29 bits are |
||
1681 | * magnitude bits. Negative numbers are represented using |
||
1682 | * two's-complement notation. |
||
1683 | * If number is not a valid octal number, OCT2DEC returns the |
||
1684 | * #NUM! error value. |
||
1685 | * |
||
1686 | * @return string |
||
1687 | */ |
||
1688 | 25 | public static function OCTTODEC($x) |
|
1713 | |||
1714 | /** |
||
1715 | * OCTTOHEX. |
||
1716 | * |
||
1717 | * Return an octal value as hex. |
||
1718 | * |
||
1719 | * Excel Function: |
||
1720 | * OCT2HEX(x[,places]) |
||
1721 | * |
||
1722 | * @category Engineering Functions |
||
1723 | * |
||
1724 | * @param string $x The octal number you want to convert. Number may not contain |
||
1725 | * more than 10 octal characters (30 bits). The most significant |
||
1726 | * bit of number is the sign bit. The remaining 29 bits are |
||
1727 | * magnitude bits. Negative numbers are represented using |
||
1728 | * two's-complement notation. |
||
1729 | * If number is negative, OCT2HEX ignores places and returns a |
||
1730 | * 10-character hexadecimal number. |
||
1731 | * If number is not a valid octal number, OCT2HEX returns the |
||
1732 | * #NUM! error value. |
||
1733 | * If OCT2HEX requires more than places characters, it returns |
||
1734 | * the #NUM! error value. |
||
1735 | * @param int $places The number of characters to use. If places is omitted, OCT2HEX |
||
1736 | * uses the minimum number of characters necessary. Places is useful |
||
1737 | * for padding the return value with leading 0s (zeros). |
||
1738 | * If places is not an integer, it is truncated. |
||
1739 | * If places is nonnumeric, OCT2HEX returns the #VALUE! error value. |
||
1740 | * If places is negative, OCT2HEX returns the #NUM! error value. |
||
1741 | * |
||
1742 | * @return string |
||
1743 | */ |
||
1744 | 9 | View Code Duplication | public static function OCTTOHEX($x, $places = null) |
1760 | |||
1761 | /** |
||
1762 | * COMPLEX. |
||
1763 | * |
||
1764 | * Converts real and imaginary coefficients into a complex number of the form x + yi or x + yj. |
||
1765 | * |
||
1766 | * Excel Function: |
||
1767 | * COMPLEX(realNumber,imaginary[,places]) |
||
1768 | * |
||
1769 | * @category Engineering Functions |
||
1770 | * |
||
1771 | * @param float $realNumber the real coefficient of the complex number |
||
1772 | * @param float $imaginary the imaginary coefficient of the complex number |
||
1773 | * @param string $suffix The suffix for the imaginary component of the complex number. |
||
1774 | * If omitted, the suffix is assumed to be "i". |
||
1775 | * |
||
1776 | * @return string |
||
1777 | */ |
||
1778 | 759 | public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i') |
|
1819 | |||
1820 | /** |
||
1821 | * IMAGINARY. |
||
1822 | * |
||
1823 | * Returns the imaginary coefficient of a complex number in x + yi or x + yj text format. |
||
1824 | * |
||
1825 | * Excel Function: |
||
1826 | * IMAGINARY(complexNumber) |
||
1827 | * |
||
1828 | * @category Engineering Functions |
||
1829 | * |
||
1830 | * @param string $complexNumber the complex number for which you want the imaginary |
||
1831 | * coefficient |
||
1832 | * |
||
1833 | * @return float |
||
1834 | */ |
||
1835 | 30 | public static function IMAGINARY($complexNumber) |
|
1843 | |||
1844 | /** |
||
1845 | * IMREAL. |
||
1846 | * |
||
1847 | * Returns the real coefficient of a complex number in x + yi or x + yj text format. |
||
1848 | * |
||
1849 | * Excel Function: |
||
1850 | * IMREAL(complexNumber) |
||
1851 | * |
||
1852 | * @category Engineering Functions |
||
1853 | * |
||
1854 | * @param string $complexNumber the complex number for which you want the real coefficient |
||
1855 | * |
||
1856 | * @return float |
||
1857 | */ |
||
1858 | 30 | public static function IMREAL($complexNumber) |
|
1866 | |||
1867 | /** |
||
1868 | * IMABS. |
||
1869 | * |
||
1870 | * Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format. |
||
1871 | * |
||
1872 | * Excel Function: |
||
1873 | * IMABS(complexNumber) |
||
1874 | * |
||
1875 | * @param string $complexNumber the complex number for which you want the absolute value |
||
1876 | * |
||
1877 | * @return float |
||
1878 | */ |
||
1879 | 27 | public static function IMABS($complexNumber) |
|
1890 | |||
1891 | /** |
||
1892 | * IMARGUMENT. |
||
1893 | * |
||
1894 | * Returns the argument theta of a complex number, i.e. the angle in radians from the real |
||
1895 | * axis to the representation of the number in polar coordinates. |
||
1896 | * |
||
1897 | * Excel Function: |
||
1898 | * IMARGUMENT(complexNumber) |
||
1899 | * |
||
1900 | * @param string $complexNumber the complex number for which you want the argument theta |
||
1901 | * |
||
1902 | * @return float |
||
1903 | */ |
||
1904 | 128 | public static function IMARGUMENT($complexNumber) |
|
1924 | |||
1925 | /** |
||
1926 | * IMCONJUGATE. |
||
1927 | * |
||
1928 | * Returns the complex conjugate of a complex number in x + yi or x + yj text format. |
||
1929 | * |
||
1930 | * Excel Function: |
||
1931 | * IMCONJUGATE(complexNumber) |
||
1932 | * |
||
1933 | * @param string $complexNumber the complex number for which you want the conjugate |
||
1934 | * |
||
1935 | * @return string |
||
1936 | */ |
||
1937 | 47 | public static function IMCONJUGATE($complexNumber) |
|
1955 | |||
1956 | /** |
||
1957 | * IMCOS. |
||
1958 | * |
||
1959 | * Returns the cosine of a complex number in x + yi or x + yj text format. |
||
1960 | * |
||
1961 | * Excel Function: |
||
1962 | * IMCOS(complexNumber) |
||
1963 | * |
||
1964 | * @param string $complexNumber the complex number for which you want the cosine |
||
1965 | * |
||
1966 | * @return string|float |
||
1967 | */ |
||
1968 | 27 | View Code Duplication | public static function IMCOS($complexNumber) |
1986 | |||
1987 | /** |
||
1988 | * IMSIN. |
||
1989 | * |
||
1990 | * Returns the sine of a complex number in x + yi or x + yj text format. |
||
1991 | * |
||
1992 | * Excel Function: |
||
1993 | * IMSIN(complexNumber) |
||
1994 | * |
||
1995 | * @param string $complexNumber the complex number for which you want the sine |
||
1996 | * |
||
1997 | * @return string|float |
||
1998 | */ |
||
1999 | 27 | View Code Duplication | public static function IMSIN($complexNumber) |
2015 | |||
2016 | /** |
||
2017 | * IMSQRT. |
||
2018 | * |
||
2019 | * Returns the square root of a complex number in x + yi or x + yj text format. |
||
2020 | * |
||
2021 | * Excel Function: |
||
2022 | * IMSQRT(complexNumber) |
||
2023 | * |
||
2024 | * @param string $complexNumber the complex number for which you want the square root |
||
2025 | * |
||
2026 | * @return string |
||
2027 | */ |
||
2028 | 28 | public static function IMSQRT($complexNumber) |
|
2049 | |||
2050 | /** |
||
2051 | * IMLN. |
||
2052 | * |
||
2053 | * Returns the natural logarithm of a complex number in x + yi or x + yj text format. |
||
2054 | * |
||
2055 | * Excel Function: |
||
2056 | * IMLN(complexNumber) |
||
2057 | * |
||
2058 | * @param string $complexNumber the complex number for which you want the natural logarithm |
||
2059 | * |
||
2060 | * @return string |
||
2061 | */ |
||
2062 | 75 | public static function IMLN($complexNumber) |
|
2081 | |||
2082 | /** |
||
2083 | * IMLOG10. |
||
2084 | * |
||
2085 | * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format. |
||
2086 | * |
||
2087 | * Excel Function: |
||
2088 | * IMLOG10(complexNumber) |
||
2089 | * |
||
2090 | * @param string $complexNumber the complex number for which you want the common logarithm |
||
2091 | * |
||
2092 | * @return string |
||
2093 | */ |
||
2094 | 27 | View Code Duplication | public static function IMLOG10($complexNumber) |
2108 | |||
2109 | /** |
||
2110 | * IMLOG2. |
||
2111 | * |
||
2112 | * Returns the base-2 logarithm of a complex number in x + yi or x + yj text format. |
||
2113 | * |
||
2114 | * Excel Function: |
||
2115 | * IMLOG2(complexNumber) |
||
2116 | * |
||
2117 | * @param string $complexNumber the complex number for which you want the base-2 logarithm |
||
2118 | * |
||
2119 | * @return string |
||
2120 | */ |
||
2121 | 27 | View Code Duplication | public static function IMLOG2($complexNumber) |
2135 | |||
2136 | /** |
||
2137 | * IMEXP. |
||
2138 | * |
||
2139 | * Returns the exponential of a complex number in x + yi or x + yj text format. |
||
2140 | * |
||
2141 | * Excel Function: |
||
2142 | * IMEXP(complexNumber) |
||
2143 | * |
||
2144 | * @param string $complexNumber the complex number for which you want the exponential |
||
2145 | * |
||
2146 | * @return string |
||
2147 | */ |
||
2148 | 27 | public static function IMEXP($complexNumber) |
|
2168 | |||
2169 | /** |
||
2170 | * IMPOWER. |
||
2171 | * |
||
2172 | * Returns a complex number in x + yi or x + yj text format raised to a power. |
||
2173 | * |
||
2174 | * Excel Function: |
||
2175 | * IMPOWER(complexNumber,realNumber) |
||
2176 | * |
||
2177 | * @param string $complexNumber the complex number you want to raise to a power |
||
2178 | * @param float $realNumber the power to which you want to raise the complex number |
||
2179 | * |
||
2180 | * @return string |
||
2181 | */ |
||
2182 | public static function IMPOWER($complexNumber, $realNumber) |
||
2204 | |||
2205 | /** |
||
2206 | * IMDIV. |
||
2207 | * |
||
2208 | * Returns the quotient of two complex numbers in x + yi or x + yj text format. |
||
2209 | * |
||
2210 | * Excel Function: |
||
2211 | * IMDIV(complexDividend,complexDivisor) |
||
2212 | * |
||
2213 | * @param string $complexDividend the complex numerator or dividend |
||
2214 | * @param string $complexDivisor the complex denominator or divisor |
||
2215 | * |
||
2216 | * @return string |
||
2217 | */ |
||
2218 | public static function IMDIV($complexDividend, $complexDivisor) |
||
2250 | |||
2251 | /** |
||
2252 | * IMSUB. |
||
2253 | * |
||
2254 | * Returns the difference of two complex numbers in x + yi or x + yj text format. |
||
2255 | * |
||
2256 | * Excel Function: |
||
2257 | * IMSUB(complexNumber1,complexNumber2) |
||
2258 | * |
||
2259 | * @param string $complexNumber1 the complex number from which to subtract complexNumber2 |
||
2260 | * @param string $complexNumber2 the complex number to subtract from complexNumber1 |
||
2261 | * |
||
2262 | * @return string |
||
2263 | */ |
||
2264 | public static function IMSUB($complexNumber1, $complexNumber2) |
||
2285 | |||
2286 | /** |
||
2287 | * IMSUM. |
||
2288 | * |
||
2289 | * Returns the sum of two or more complex numbers in x + yi or x + yj text format. |
||
2290 | * |
||
2291 | * Excel Function: |
||
2292 | * IMSUM(complexNumber[,complexNumber[,...]]) |
||
2293 | * |
||
2294 | * @param string $complexNumber,... Series of complex numbers to add |
||
2295 | * |
||
2296 | * @return string |
||
2297 | */ |
||
2298 | 10 | public static function IMSUM() |
|
2325 | |||
2326 | /** |
||
2327 | * IMPRODUCT. |
||
2328 | * |
||
2329 | * Returns the product of two or more complex numbers in x + yi or x + yj text format. |
||
2330 | * |
||
2331 | * Excel Function: |
||
2332 | * IMPRODUCT(complexNumber[,complexNumber[,...]]) |
||
2333 | * |
||
2334 | * @param string $complexNumber,... Series of complex numbers to multiply |
||
2335 | * |
||
2336 | * @return string |
||
2337 | */ |
||
2338 | 63 | public static function IMPRODUCT() |
|
2365 | |||
2366 | /** |
||
2367 | * DELTA. |
||
2368 | * |
||
2369 | * Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise. |
||
2370 | * Use this function to filter a set of values. For example, by summing several DELTA |
||
2371 | * functions you calculate the count of equal pairs. This function is also known as the |
||
2372 | * Kronecker Delta function. |
||
2373 | * |
||
2374 | * Excel Function: |
||
2375 | * DELTA(a[,b]) |
||
2376 | * |
||
2377 | * @param float $a the first number |
||
2378 | * @param float $b The second number. If omitted, b is assumed to be zero. |
||
2379 | * |
||
2380 | * @return int |
||
2381 | */ |
||
2382 | 25 | public static function DELTA($a, $b = 0) |
|
2389 | |||
2390 | /** |
||
2391 | * GESTEP. |
||
2392 | * |
||
2393 | * Excel Function: |
||
2394 | * GESTEP(number[,step]) |
||
2395 | * |
||
2396 | * Returns 1 if number >= step; returns 0 (zero) otherwise |
||
2397 | * Use this function to filter a set of values. For example, by summing several GESTEP |
||
2398 | * functions you calculate the count of values that exceed a threshold. |
||
2399 | * |
||
2400 | * @param float $number the value to test against step |
||
2401 | * @param float $step The threshold value. |
||
2402 | * If you omit a value for step, GESTEP uses zero. |
||
2403 | * |
||
2404 | * @return int |
||
2405 | */ |
||
2406 | 81 | public static function GESTEP($number, $step = 0) |
|
2413 | |||
2414 | // |
||
2415 | // Private method to calculate the erf value |
||
2416 | // |
||
2417 | private static $twoSqrtPi = 1.128379167095512574; |
||
2418 | |||
2419 | 148 | public static function erfVal($x) |
|
2441 | |||
2442 | /** |
||
2443 | * ERF. |
||
2444 | * |
||
2445 | * Returns the error function integrated between the lower and upper bound arguments. |
||
2446 | * |
||
2447 | * Note: In Excel 2007 or earlier, if you input a negative value for the upper or lower bound arguments, |
||
2448 | * the function would return a #NUM! error. However, in Excel 2010, the function algorithm was |
||
2449 | * improved, so that it can now calculate the function for both positive and negative ranges. |
||
2450 | * PhpSpreadsheet follows Excel 2010 behaviour, and accepts nagative arguments. |
||
2451 | * |
||
2452 | * Excel Function: |
||
2453 | * ERF(lower[,upper]) |
||
2454 | * |
||
2455 | * @param float $lower lower bound for integrating ERF |
||
2456 | * @param float $upper upper bound for integrating ERF. |
||
2457 | * If omitted, ERF integrates between zero and lower_limit |
||
2458 | * |
||
2459 | * @return float |
||
2460 | */ |
||
2461 | 123 | public static function ERF($lower, $upper = null) |
|
2477 | |||
2478 | // |
||
2479 | // Private method to calculate the erfc value |
||
2480 | // |
||
2481 | private static $oneSqrtPi = 0.564189583547756287; |
||
2482 | |||
2483 | 104 | private static function erfcVal($x) |
|
2510 | |||
2511 | /** |
||
2512 | * ERFC. |
||
2513 | * |
||
2514 | * Returns the complementary ERF function integrated between x and infinity |
||
2515 | * |
||
2516 | * Note: In Excel 2007 or earlier, if you input a negative value for the lower bound argument, |
||
2517 | * the function would return a #NUM! error. However, in Excel 2010, the function algorithm was |
||
2518 | * improved, so that it can now calculate the function for both positive and negative x values. |
||
2519 | * PhpSpreadsheet follows Excel 2010 behaviour, and accepts nagative arguments. |
||
2520 | * |
||
2521 | * Excel Function: |
||
2522 | * ERFC(x) |
||
2523 | * |
||
2524 | * @param float $x The lower bound for integrating ERFC |
||
2525 | * |
||
2526 | * @return float |
||
2527 | */ |
||
2528 | 41 | public static function ERFC($x) |
|
2538 | |||
2539 | /** |
||
2540 | * getConversionGroups |
||
2541 | * Returns a list of the different conversion groups for UOM conversions. |
||
2542 | * |
||
2543 | * @return array |
||
2544 | */ |
||
2545 | 1 | public static function getConversionGroups() |
|
2554 | |||
2555 | /** |
||
2556 | * getConversionGroupUnits |
||
2557 | * Returns an array of units of measure, for a specified conversion group, or for all groups. |
||
2558 | * |
||
2559 | * @param string $group The group whose units of measure you want to retrieve |
||
2560 | * |
||
2561 | * @return array |
||
2562 | */ |
||
2563 | 1 | public static function getConversionGroupUnits($group = null) |
|
2574 | |||
2575 | /** |
||
2576 | * getConversionGroupUnitDetails. |
||
2577 | * |
||
2578 | * @param string $group The group whose units of measure you want to retrieve |
||
2579 | * |
||
2580 | * @return array |
||
2581 | */ |
||
2582 | 1 | public static function getConversionGroupUnitDetails($group = null) |
|
2596 | |||
2597 | /** |
||
2598 | * getConversionMultipliers |
||
2599 | * Returns an array of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM(). |
||
2600 | * |
||
2601 | * @return array of mixed |
||
2602 | */ |
||
2603 | 1 | public static function getConversionMultipliers() |
|
2607 | |||
2608 | /** |
||
2609 | * CONVERTUOM. |
||
2610 | * |
||
2611 | * Converts a number from one measurement system to another. |
||
2612 | * For example, CONVERT can translate a table of distances in miles to a table of distances |
||
2613 | * in kilometers. |
||
2614 | * |
||
2615 | * Excel Function: |
||
2616 | * CONVERT(value,fromUOM,toUOM) |
||
2617 | * |
||
2618 | * @param float $value the value in fromUOM to convert |
||
2619 | * @param string $fromUOM the units for value |
||
2620 | * @param string $toUOM the units for the result |
||
2621 | * |
||
2622 | * @return float |
||
2623 | */ |
||
2624 | 24 | public static function CONVERTUOM($value, $fromUOM, $toUOM) |
|
2713 | } |
||
2714 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.