Phyzix
Loading...
Searching...
No Matches
Math.h
1//
2// Created by shams on 8/8/24.
3//
4
5#ifndef PHYZIX_MATH_H
6#define PHYZIX_MATH_H
7
13class Math{
14public:
15 static constexpr float PI = 3.141592653589793;
23 static float pow(float base, int exponent) {
24 float result = 1;
25
26 if (exponent > 0)
27 while (exponent--)
28 result *= base;
29 else if (exponent < 0)
30 while (exponent++)
31 result /= base;
32
33 return result;
34 }
35
42 static float min(float a, float b) {
43 return a > b ? b : a;
44 }
45
52 static int min(int a, int b) {
53 return a > b ? b : a;
54 }
55
62 static float max(float a, float b) {
63 return a > b ? a : b;
64 }
65
72 static int max(int a, int b) {
73 return a > b ? a : b;
74 }
75
81 static float fabs(float n) {
82 return n < 0 ? -n : n;
83 }
84
90 static int abs(int n) {
91 return n < 0 ? -n : n;
92 }
93
99 static float sqrt(float n) {
100 if (n == 0) return 0;
101
102 double x = n;
103 double y = 1.0;
104 double epsilon = 0.000001; // Desired precision
105
106 while (fabs(x - y) > epsilon) {
107 x = (x + y) / 2;
108 y = n / x;
109 }
110
111 return x;
112 }
113
119 static float cos(float angle) {
120 angle = fabs(angle);
121 while (angle >= 2 * PI)
122 angle -= 2 * PI;
123
124// if (angle >= PI)
125// return cos(angle - PI);
126//
127// if (angle >= PI / 2)
128// return -cos(angle - PI/2);
129
130 return cosine[(int) (0.5 + 500 * angle / (2 * PI))];
131 }
132
138 static int sign(float x) {
139 return x >= 0 ? 1 : -1;
140 }
141
147 static float sin(float angle) {
148 return cos(angle - PI/2);
149 }
150
157 static float atan(float m) {
158 return sign(m) * arctan[min(int(abs(m * (500 / 10)) + 0.5), 499)];
159 }
160
168 static float atan(float y, float x) {
169 if (x == 0)
170 return PI/2;
171
172 return atan(y/x);
173 }
174
175private:
176 static constexpr float cosine[500] = {
177 1.0,
178 0.9999210442038161,
179 0.9996841892832999,
180 0.9992894726405892,
181 0.9987369566060175,
182 0.9980267284282716,
183 0.9971589002606139,
184 0.9961336091431725,
185 0.9949510169813002,
186 0.9936113105200084,
187 0.9921147013144779,
188 0.9904614256966512,
189 0.9886517447379141,
190 0.986685944207868,
191 0.9845643345292053,
192 0.9822872507286887,
193 0.9798550523842469,
194 0.9772681235681935,
195 0.9745268727865771,
196 0.971631732914674,
197 0.9685831611286311,
198 0.9653816388332739,
199 0.9620276715860859,
200 0.9585217890173758,
201 0.954864544746643,
202 0.9510565162951535,
203 0.9470983049947443,
204 0.9429905358928645,
205 0.9387338576538741,
206 0.934328942456612,
207 0.9297764858882515,
208 0.925077206834458,
209 0.9202318473658704,
210 0.9152411726209175,
211 0.9101059706849957,
212 0.9048270524660195,
213 0.8994052515663711,
214 0.8938414241512638,
215 0.8881364488135446,
216 0.8822912264349533,
217 0.8763066800438636,
218 0.8701837546695257,
219 0.8639234171928353,
220 0.8575266561936523,
221 0.850994481794692,
222 0.8443279255020151,
223 0.8375280400421418,
224 0.8305958991958127,
225 0.8235325976284275,
226 0.8163392507171839,
227 0.8090169943749475,
228 0.8015669848708766,
229 0.7939903986478354,
230 0.7862884321366189,
231 0.7784623015670235,
232 0.7705132427757893,
233 0.7624425110114479,
234 0.7542513807361038,
235 0.7459411454241821,
236 0.7375131173581739,
237 0.7289686274214116,
238 0.7203090248879069,
239 0.7115356772092855,
240 0.7026499697988492,
241 0.6936533058128049,
242 0.6845471059286886,
243 0.6753328081210245,
244 0.6660118674342517,
245 0.6565857557529564,
246 0.6470559615694443,
247 0.6374239897486896,
248 0.6276913612907006,
249 0.6178596130903344,
250 0.6079302976946055,
251 0.5979049830575189,
252 0.5877852522924731,
253 0.5775727034222676,
254 0.5672689491267565,
255 0.5568756164881881,
256 0.5463943467342691,
257 0.5358267949789965,
258 0.5251746299612957,
259 0.5144395337815064,
260 0.5036232016357609,
261 0.49272734154829156,
262 0.48175367410171516,
263 0.47070393216533274,
264 0.4595798606214879,
265 0.44838321609003245,
266 0.437115766650933,
267 0.42577929156507266,
268 0.41437558099328425,
269 0.4029064357136627,
270 0.39137366683720254,
271 0.3797790955218011,
272 0.3681245526846781,
273 0.35641187871325075,
274 0.344642923174517,
275 0.3328195445229867,
276 0.32094360980720943,
277 0.30901699437494745,
278 0.29704158157703486,
279 0.28501926246997616,
280 0.2729519355173254,
281 0.260841506289897,
282 0.24868988716485496,
283 0.23649899702372476,
284 0.22427076094938117,
285 0.21200710992205474,
286 0.199709980514407,
287 0.18738131458572474,
288 0.17502305897527604,
289 0.16263716519488372,
290 0.15022558912075706,
291 0.13779029068463797,
292 0.12533323356430426,
293 0.1128563848734816,
294 0.10036171485121491,
295 0.08785119655074332,
296 0.07532680552793275,
297 0.06279051952931353,
298 0.0502443181797696,
299 0.037690182669934694,
300 0.02513009544333753,
301 0.012566039883352776,
302 6.123233995736766e-17,
303 -0.012566039883352653,
304 -0.025130095443337407,
305 -0.037690182669934576,
306 -0.05024431817976947,
307 -0.0627905195293134,
308 -0.07532680552793262,
309 -0.0878511965507432,
310 -0.100361714851215,
311 -0.1128563848734817,
312 -0.12533323356430437,
313 -0.13779029068463805,
314 -0.15022558912075715,
315 -0.16263716519488358,
316 -0.17502305897527615,
317 -0.18738131458572482,
318 -0.1997099805144069,
319 -0.2120071099220544,
320 -0.22427076094938103,
321 -0.23649899702372443,
322 -0.24868988716485463,
323 -0.26084150628989666,
324 -0.27295193551732505,
325 -0.28501926246997605,
326 -0.29704158157703475,
327 -0.30901699437494734,
328 -0.3209436098072093,
329 -0.33281954452298657,
330 -0.3446429231745169,
331 -0.35641187871325064,
332 -0.368124552684678,
333 -0.379779095521801,
334 -0.3913736668372024,
335 -0.4029064357136626,
336 -0.41437558099328414,
337 -0.4257792915650727,
338 -0.4371157666509327,
339 -0.4483832160900321,
340 -0.4595798606214878,
341 -0.47070393216533263,
342 -0.48175367410171543,
343 -0.49272734154829145,
344 -0.5036232016357608,
345 -0.5144395337815065,
346 -0.5251746299612958,
347 -0.5358267949789969,
348 -0.546394346734269,
349 -0.5568756164881876,
350 -0.5672689491267563,
351 -0.5775727034222674,
352 -0.587785252292473,
353 -0.5979049830575185,
354 -0.6079302976946052,
355 -0.6178596130903342,
356 -0.6276913612907004,
357 -0.6374239897486897,
358 -0.647055961569444,
359 -0.6565857557529563,
360 -0.6660118674342516,
361 -0.6753328081210245,
362 -0.6845471059286887,
363 -0.6936533058128048,
364 -0.7026499697988491,
365 -0.7115356772092853,
366 -0.7203090248879069,
367 -0.7289686274214113,
368 -0.7375131173581738,
369 -0.7459411454241821,
370 -0.7542513807361039,
371 -0.762442511011448,
372 -0.7705132427757891,
373 -0.7784623015670233,
374 -0.7862884321366189,
375 -0.7939903986478354,
376 -0.8015669848708767,
377 -0.8090169943749473,
378 -0.8163392507171839,
379 -0.8235325976284275,
380 -0.8305958991958128,
381 -0.8375280400421417,
382 -0.8443279255020149,
383 -0.8509944817946917,
384 -0.8575266561936521,
385 -0.8639234171928353,
386 -0.8701837546695257,
387 -0.8763066800438634,
388 -0.8822912264349532,
389 -0.8881364488135445,
390 -0.8938414241512638,
391 -0.8994052515663711,
392 -0.9048270524660194,
393 -0.9101059706849957,
394 -0.9152411726209175,
395 -0.9202318473658704,
396 -0.9250772068344579,
397 -0.9297764858882513,
398 -0.934328942456612,
399 -0.9387338576538741,
400 -0.9429905358928645,
401 -0.9470983049947442,
402 -0.9510565162951535,
403 -0.954864544746643,
404 -0.958521789017376,
405 -0.9620276715860859,
406 -0.9653816388332739,
407 -0.9685831611286311,
408 -0.971631732914674,
409 -0.9745268727865772,
410 -0.9772681235681935,
411 -0.9798550523842469,
412 -0.9822872507286886,
413 -0.9845643345292053,
414 -0.986685944207868,
415 -0.988651744737914,
416 -0.9904614256966512,
417 -0.9921147013144778,
418 -0.9936113105200084,
419 -0.9949510169813002,
420 -0.9961336091431725,
421 -0.9971589002606139,
422 -0.9980267284282716,
423 -0.9987369566060175,
424 -0.9992894726405892,
425 -0.9996841892832999,
426 -0.9999210442038161,
427 -1.0,
428 -0.9999210442038161,
429 -0.9996841892832999,
430 -0.9992894726405892,
431 -0.9987369566060175,
432 -0.9980267284282716,
433 -0.9971589002606139,
434 -0.9961336091431725,
435 -0.9949510169813002,
436 -0.9936113105200084,
437 -0.9921147013144779,
438 -0.9904614256966512,
439 -0.9886517447379141,
440 -0.986685944207868,
441 -0.9845643345292053,
442 -0.9822872507286886,
443 -0.9798550523842469,
444 -0.9772681235681935,
445 -0.9745268727865771,
446 -0.9716317329146739,
447 -0.9685831611286311,
448 -0.9653816388332739,
449 -0.9620276715860859,
450 -0.9585217890173758,
451 -0.954864544746643,
452 -0.9510565162951535,
453 -0.9470983049947443,
454 -0.9429905358928644,
455 -0.9387338576538741,
456 -0.9343289424566119,
457 -0.9297764858882512,
458 -0.925077206834458,
459 -0.9202318473658705,
460 -0.9152411726209179,
461 -0.9101059706849959,
462 -0.9048270524660197,
463 -0.8994052515663712,
464 -0.8938414241512641,
465 -0.8881364488135448,
466 -0.8822912264349535,
467 -0.8763066800438637,
468 -0.8701837546695258,
469 -0.8639234171928356,
470 -0.8575266561936525,
471 -0.8509944817946921,
472 -0.8443279255020152,
473 -0.8375280400421418,
474 -0.8305958991958129,
475 -0.8235325976284277,
476 -0.816339250717184,
477 -0.8090169943749476,
478 -0.8015669848708769,
479 -0.7939903986478356,
480 -0.786288432136619,
481 -0.7784623015670236,
482 -0.7705132427757893,
483 -0.7624425110114481,
484 -0.754251380736104,
485 -0.7459411454241822,
486 -0.7375131173581739,
487 -0.7289686274214116,
488 -0.7203090248879072,
489 -0.7115356772092855,
490 -0.7026499697988493,
491 -0.6936533058128049,
492 -0.684547105928689,
493 -0.6753328081210246,
494 -0.6660118674342517,
495 -0.6565857557529564,
496 -0.6470559615694442,
497 -0.6374239897486895,
498 -0.6276913612907002,
499 -0.6178596130903348,
500 -0.6079302976946057,
501 -0.597904983057519,
502 -0.5877852522924732,
503 -0.5775727034222676,
504 -0.5672689491267564,
505 -0.5568756164881878,
506 -0.5463943467342689,
507 -0.5358267949789963,
508 -0.5251746299612953,
509 -0.5144395337815068,
510 -0.503623201635761,
511 -0.4927273415482917,
512 -0.48175367410171527,
513 -0.47070393216533246,
514 -0.45957986062148765,
515 -0.44838321609003196,
516 -0.4371157666509325,
517 -0.42577929156507216,
518 -0.41437558099328436,
519 -0.4029064357136628,
520 -0.3913736668372024,
521 -0.37977909552180183,
522 -0.3681245526846786,
523 -0.35641187871325125,
524 -0.3446429231745175,
525 -0.332819544522987,
526 -0.32094360980720976,
527 -0.30901699437494756,
528 -0.297041581577035,
529 -0.28501926246997694,
530 -0.27295193551732594,
531 -0.26084150628989755,
532 -0.2486898871648553,
533 -0.2364989970237251,
534 -0.2242707609493815,
535 -0.21200710992205485,
536 -0.1997099805144071,
537 -0.18738131458572463,
538 -0.17502305897527595,
539 -0.16263716519488428,
540 -0.15022558912075762,
541 -0.13779029068463852,
542 -0.1253332335643046,
543 -0.11285638487348193,
544 -0.10036171485121503,
545 -0.08785119655074321,
546 -0.07532680552793265,
547 -0.06279051952931321,
548 -0.05024431817977017,
549 -0.03769018266993504,
550 -0.025130095443337875,
551 -0.012566039883352897,
552 -1.8369701987210297e-16,
553 0.012566039883352531,
554 0.025130095443337507,
555 0.03769018266993467,
556 0.0502443181797698,
557 0.06279051952931283,
558 0.07532680552793229,
559 0.08785119655074285,
560 0.10036171485121467,
561 0.11285638487348157,
562 0.12533323356430423,
563 0.13779029068463816,
564 0.15022558912075726,
565 0.16263716519488391,
566 0.1750230589752756,
567 0.18738131458572427,
568 0.19970998051440675,
569 0.2120071099220545,
570 0.22427076094938114,
571 0.23649899702372473,
572 0.24868988716485493,
573 0.2608415062898972,
574 0.2729519355173256,
575 0.2850192624699766,
576 0.29704158157703464,
577 0.30901699437494723,
578 0.32094360980720943,
579 0.3328195445229867,
580 0.34464292317451717,
581 0.3564118787132509,
582 0.36812455268467825,
583 0.3797790955218015,
584 0.3913736668372021,
585 0.40290643571366247,
586 0.41437558099328403,
587 0.4257792915650718,
588 0.43711576665093216,
589 0.4483832160900316,
590 0.4595798606214873,
591 0.47070393216533213,
592 0.48175367410171493,
593 0.49272734154829134,
594 0.5036232016357607,
595 0.5144395337815064,
596 0.5251746299612949,
597 0.535826794978996,
598 0.5463943467342686,
599 0.5568756164881876,
600 0.5672689491267562,
601 0.5775727034222673,
602 0.5877852522924729,
603 0.5979049830575188,
604 0.6079302976946054,
605 0.6178596130903344,
606 0.6276913612906999,
607 0.6374239897486893,
608 0.647055961569444,
609 0.6565857557529562,
610 0.6660118674342514,
611 0.6753328081210244,
612 0.6845471059286886,
613 0.693653305812805,
614 0.7026499697988493,
615 0.7115356772092849,
616 0.7203090248879065,
617 0.7289686274214112,
618 0.7375131173581737,
619 0.745941145424182,
620 0.7542513807361038,
621 0.7624425110114479,
622 0.7705132427757894,
623 0.7784623015670236,
624 0.7862884321366186,
625 0.793990398647835,
626 0.8015669848708764,
627 0.8090169943749473,
628 0.8163392507171839,
629 0.8235325976284275,
630 0.8305958991958127,
631 0.8375280400421419,
632 0.8443279255020153,
633 0.8509944817946921,
634 0.8575266561936521,
635 0.8639234171928352,
636 0.8701837546695256,
637 0.8763066800438636,
638 0.8822912264349533,
639 0.8881364488135446,
640 0.8938414241512639,
641 0.8994052515663712,
642 0.9048270524660197,
643 0.9101059706849955,
644 0.9152411726209175,
645 0.9202318473658703,
646 0.9250772068344577,
647 0.9297764858882511,
648 0.9343289424566118,
649 0.9387338576538738,
650 0.9429905358928643,
651 0.9470983049947441,
652 0.9510565162951535,
653 0.954864544746643,
654 0.9585217890173756,
655 0.9620276715860857,
656 0.9653816388332737,
657 0.968583161128631,
658 0.9716317329146739,
659 0.974526872786577,
660 0.9772681235681934,
661 0.9798550523842469,
662 0.9822872507286887,
663 0.9845643345292054,
664 0.9866859442078679,
665 0.988651744737914,
666 0.9904614256966512,
667 0.9921147013144778,
668 0.9936113105200084,
669 0.9949510169813002,
670 0.9961336091431725,
671 0.9971589002606139,
672 0.9980267284282716,
673 0.9987369566060175,
674 0.9992894726405892,
675 0.9996841892832999,
676 0.9999210442038161,
677 };
679 static constexpr float arctan[500] = {
680 0.0,
681 0.019997333973150535,
682 0.039978687123290044,
683 0.05992815512120788,
684 0.07982998571223732,
685 0.09966865249116204,
686 0.11942892601833845,
687 0.13909594148207133,
688 0.1586552621864014,
689 0.17809293823119754,
690 0.19739555984988078,
691 0.21655030497608926,
692 0.23554498072086333,
693 0.25436805855326594,
694 0.2730087030867106,
695 0.2914567944778671,
696 0.3097029445424562,
697 0.3277385067805555,
698 0.34555558058171215,
699 0.36314700994617627,
700 0.3805063771123649,
701 0.39762799152212935,
702 0.4145068745847859,
703 0.43113874071878217,
704 0.44751997515716985,
705 0.4636476090008061,
706 0.4795192919925962,
707 0.49513326346840414,
708 0.5104883219167758,
709 0.5255837935516102,
710 0.5404195002705842,
711 0.5549957273385867,
712 0.5693131911006619,
713 0.583373006993856,
714 0.5971766580926776,
715 0.6107259643892087,
716 0.6240230529767569,
717 0.6370703292756835,
718 0.6498704494119476,
719 0.6624262938331512,
720 0.6747409422235527,
721 0.6868176497586453,
722 0.6986598247214633,
723 0.7102710074866861,
724 0.7216548508647612,
725 0.7328151017865066,
726 0.7437555842988598,
727 0.7544801838344056,
728 0.7649928327109102,
729 0.7752974968121263,
730 0.7853981633974483,
731 0.7952988299854369,
732 0.805003494254653,
733 0.8145161449044872,
734 0.8238407534186363,
735 0.8329812666744317,
736 0.8419416003422657,
737 0.8507256330208,
738 0.8593372010553887,
739 0.8677800939891389,
740 0.8760580505981934,
741 0.884174755465111,
742 0.8921338360465839,
743 0.8999388601941296,
744 0.9075933340888034,
745 0.9151007005533605,
746 0.9224643377076359,
747 0.9296875579351908,
748 0.9367736071314746,
749 0.9437256642058783,
750 0.9505468408120752,
751 0.9572401812829799,
752 0.9638086627484886,
753 0.970255195415889,
754 0.9765826229944627,
755 0.982793723247329,
756 0.9888912086550111,
757 0.9948777271765435,
758 1.0007558630951863,
759 1.0065281379369648,
760 1.0121970114513341,
761 1.017764882644256,
762 1.0232340908548991,
763 1.028606916868018,
764 1.033885584054851,
765 1.039072259536091,
766 1.0441690553611458,
767 1.04917802969851,
768 1.0541011880326194,
769 1.0589404843630723,
770 1.0636978224025597,
771 1.068375056770266,
772 1.0729739941778953,
773 1.0774963946058176,
774 1.0819439724671487,
775 1.0863183977578734,
776 1.0906212971913698,
777 1.0948542553159382,
778 1.0990188156141465,
779 1.103116481582997,
780 1.1071487177940904,
781 1.1111169509331238,
782 1.1150225708181911,
783 1.1188669313964847,
784 1.122651351719107,
785 1.1263771168937977,
786 1.1300454790154746,
787 1.1336576580745592,
788 1.1372148428431348,
789 1.140718191739034,
790 1.1441688336680205,
791 1.1475678688442623,
792 1.150916369589345,
793 1.1542153811101012,
794 1.1574659222555688,
795 1.1606689862534056,
796 1.1638255414261254,
797 1.16693653188752,
798 1.1700028782196619,
799 1.173025478130882,
800 1.176005207095135,
801 1.1789429189731648,
802 1.1818394466158897,
803 1.1846956024504316,
804 1.1875121790492111,
805 1.1902899496825317,
806 1.1930296688550752,
807 1.1957320728267262,
808 1.1983978801181423,
809 1.2010277920014796,
810 1.2036224929766774,
811 1.2061826512337066,
812 1.2087089191011682,
813 1.2112019334816335,
814 1.2136623162741031,
815 1.2160906747839564,
816 1.218487602120755,
817 1.220853677584258,
818 1.2231894670389947,
819 1.2254955232777356,
820 1.2277723863741932,
821 1.2300205840252765,
822 1.2322406318832124,
823 1.2344330338778424,
824 1.2365982825293933,
825 1.2387368592520112,
826 1.2408492346483417,
827 1.2429358687954335,
828 1.244997211522226,
829 1.2470337026788887,
830 1.2490457723982544,
831 1.2510338413496003,
832 1.2529983209850046,
833 1.2549396137785165,
834 1.2568581134583556,
835 1.2587542052323633,
836 1.2606282660069106,
837 1.2624806645994682,
838 1.2643117619450344,
839 1.2661219112966131,
840 1.2679114584199251,
841 1.2696807417825318,
842 1.2714300927375446,
843 1.27315983570209,
844 1.2748702883306882,
845 1.2765617616837088,
846 1.278234560391049,
847 1.279888982811188,
848 1.281525321185755,
849 1.2831438617897548,
850 1.2847448850775784,
851 1.2863286658249324,
852 1.287895473266811,
853 1.2894455712316322,
854 1.2909792182716535,
855 1.2924966677897853,
856 1.2939981681629065,
857 1.295483962861792,
858 1.2969542905677538,
859 1.2984093852860954,
860 1.299849476456476,
861 1.3012747890602787,
862 1.3026855437250695,
863 1.3040819568262398,
864 1.3054642405859118,
865 1.3068326031691921,
866 1.3081872487778505,
867 1.3095283777415028,
868 1.3108561866063686,
869 1.3121708682216804,
870 1.313472611823808,
871 1.3147616031181713,
872 1.3160380243590017,
873 1.3173020544270184,
874 1.3185538689050784,
875 1.319793640151862,
876 1.3210215373736482,
877 1.3222377266942373,
878 1.3234423712230732,
879 1.3246356311216183,
880 1.3258176636680326,
881 1.3269886233202002,
882 1.328148661777159,
883 1.3292979280389723,
884 1.330436568465089,
885 1.331564726831236,
886 1.3326825443848853,
887 1.3337901598993314,
888 1.334887709726425,
889 1.3359753278479942,
890 1.3370531459259951,
891 1.3381212933514246,
892 1.339179897292029,
893 1.3402290827388457,
894 1.3412689725516063,
895 1.3422996875030344,
896 1.343321346322069,
897 1.3443340657360414,
898 1.3453379605118367,
899 1.3463331434960633,
900 1.3473197256542637,
901 1.3482978161091863,
902 1.3492675221781487,
903 1.350228949409512,
904 1.3511822016182968,
905 1.3521273809209546,
906 1.3530645877693281,
907 1.3539939209838119,
908 1.3549154777857426,
909 1.3558293538290331,
910 1.356735643231075,
911 1.3576344386029269,
912 1.3585258310788055,
913 1.3594099103449029,
914 1.3602867646675405,
915 1.361156480920684,
916 1.3620191446128314,
917 1.3628748399132904,
918 1.363723649677865,
919 1.364565655473961,
920 1.3654009376051293,
921 1.3662295751350595,
922 1.3670516459110396,
923 1.3678672265868919,
924 1.3686763926454029,
925 1.3694792184202558,
926 1.3702757771174823,
927 1.3710661408364408,
928 1.371850380590338,
929 1.3726285663263014,
930 1.373400766945016,
931 1.3741670503199352,
932 1.3749274833160778,
933 1.3756821318084171,
934 1.3764310606998786,
935 1.3771743339389513,
936 1.377912014536922,
937 1.3786441645847451,
938 1.3793708452695534,
939 1.3800921168908202,
940 1.380808038876181,
941 1.3815186697969228,
942 1.3822240673831492,
943 1.3829242885386288,
944 1.3836193893553341,
945 1.38430942512768,
946 1.3849944503664662,
947 1.3856745188125337,
948 1.3863496834501396,
949 1.3870199965200578,
950 1.3876855095324125,
951 1.38834627327925,
952 1.389002337846855,
953 1.3896537526278188,
954 1.3903005663328614,
955 1.3909428270024184,
956 1.391580582017994,
957 1.3922138781132876,
958 1.3928427613850962,
959 1.3934672773040049,
960 1.39408747072486,
961 1.3947033858970388,
962 1.3953150664745158,
963 1.3959225555257304,
964 1.3965258955432638,
965 1.3971251284533228,
966 1.3977202956250436,
967 1.3983114378796113,
968 1.3988985954992048,
969 1.399481808235768,
970 1.4000611153196139,
971 1.4006365554678604,
972 1.4012081668927088,
973 1.401775987309561,
974 1.4023400539449837,
975 1.402900403544522,
976 1.403457072380364,
977 1.4040100962588618,
978 1.4045595105279107,
979 1.4051053500841904,
980 1.4056476493802699,
981 1.4061864424315813,
982 1.4067217628232631,
983 1.4072536437168768,
984 1.407782117856999,
985 1.4083072175776932,
986 1.4088289748088612,
987 1.4093474210824788,
988 1.4098625875387176,
989 1.4103745049319556,
990 1.4108832036366774,
991 1.4113887136532681,
992 1.4118910646137035,
993 1.412390285787136,
994 1.4128864060853812,
995 1.413379454068306,
996 1.41386945794912,
997 1.4143564455995736,
998 1.4148404445550629,
999 1.415321482019643,
1000 1.4157995848709557,
1001 1.4162747796650679,
1002 1.4167470926412258,
1003 1.4172165497265246,
1004 1.417683176540499,
1005 1.4181469983996315,
1006 1.4186080403217831,
1007 1.4190663270305468,
1008 1.419521882959527,
1009 1.419974732256543,
1010 1.4204248987877621,
1011 1.4208724061417608,
1012 1.4213172776335172,
1013 1.4217595363083344,
1014 1.4221992049456973,
1015 1.4226363060630653,
1016 1.4230708619195982,
1017 1.4235028945198223,
1018 1.4239324256172319,
1019 1.4243594767178318,
1020 1.4247840690836213,
1021 1.425206223736017,
1022 1.4256259614592224,
1023 1.4260433028035382,
1024 1.42645826808862,
1025 1.4268708774066803,
1026 1.4272811506256398,
1027 1.4276891073922249,
1028 1.4280947671350148,
1029 1.4284981490674409,
1030 1.4288992721907328,
1031 1.4292981552968214,
1032 1.429694816971191,
1033 1.4300892755956878,
1034 1.4304815493512804,
1035 1.4308716562207788,
1036 1.4312596139915073,
1037 1.4316454402579355,
1038 1.4320291524242676,
1039 1.43241076770699,
1040 1.4327903031373772,
1041 1.4331677755639607,
1042 1.4335432016549559,
1043 1.4339165979006525,
1044 1.4342879806157667,
1045 1.4346573659417559,
1046 1.4350247698490983,
1047 1.435390208139536,
1048 1.4357536964482824,
1049 1.4361152502461978,
1050 1.4364748848419282,
1051 1.4368326153840125,
1052 1.4371884568629583,
1053 1.4375424241132824,
1054 1.4378945318155236,
1055 1.4382447944982226,
1056 1.4385932265398713,
1057 1.438939842170834,
1058 1.4392846554752379,
1059 1.4396276803928356,
1060 1.4399689307208396,
1061 1.4403084201157277,
1062 1.440646162095023,
1063 1.4409821700390462,
1064 1.4413164571926413,
1065 1.4416490366668766,
1066 1.4419799214407185,
1067 1.4423091243626827,
1068 1.4426366581524586,
1069 1.442962535402511,
1070 1.4432867685796584,
1071 1.4436093700266257,
1072 1.4439303519635776,
1073 1.4442497264896257,
1074 1.444567505584317,
1075 1.4448837011090985,
1076 1.4451983248087599,
1077 1.445511388312858,
1078 1.4458229031371177,
1079 1.4461328806848144,
1080 1.446441332248135,
1081 1.4467482690095215,
1082 1.4470537020429919,
1083 1.4473576423154462,
1084 1.4476601006879497,
1085 1.4479610879170017,
1086 1.4482606146557828,
1087 1.4485586914553867,
1088 1.4488553287660337,
1089 1.4491505369382673,
1090 1.449444326224133,
1091 1.4497367067783415,
1092 1.4500276886594163,
1093 1.4503172818308223,
1094 1.4506054961620816,
1095 1.4508923414298727,
1096 1.4511778273191136,
1097 1.4514619634240304,
1098 1.4517447592492123,
1099 1.4520262242106494,
1100 1.452306367636759,
1101 1.4525851987693945,
1102 1.4528627267648446,
1103 1.4531389606948153,
1104 1.453413909547399,
1105 1.4536875822280324,
1106 1.453959987560439,
1107 1.4542311342875605,
1108 1.454501031072474,
1109 1.454769686499298,
1110 1.455037109074086,
1111 1.4553033072257069,
1112 1.455568289306716,
1113 1.4558320635942108,
1114 1.4560946382906792,
1115 1.4563560215248332,
1116 1.4566162213524332,
1117 1.4568752457571006,
1118 1.4571331026511205,
1119 1.4573897998762326,
1120 1.457645345204412,
1121 1.457899746338641,
1122 1.4581530109136678,
1123 1.458405146496759,
1124 1.4586561605884385,
1125 1.4589060606232205,
1126 1.459154853970329,
1127 1.4594025479344106,
1128 1.459649149756238,
1129 1.459894666613403,
1130 1.460139105621001,
1131 1.4603824738323072,
1132 1.460624778239444,
1133 1.460866025774039,
1134 1.461106223307875,
1135 1.4613453776535332,
1136 1.4615834955650249,
1137 1.4618205837384175,
1138 1.4620566488124533,
1139 1.4622916973691573,
1140 1.4625257359344406,
1141 1.4627587709786936,
1142 1.4629908089173735,
1143 1.463221856111584,
1144 1.4634519188686461,
1145 1.4636810034426648,
1146 1.4639091160350859,
1147 1.4641362627952463,
1148 1.4643624498209202,
1149 1.4645876831588533,
1150 1.4648119688052967,
1151 1.4650353127065279,
1152 1.4652577207593702,
1153 1.465479198811703,
1154 1.4656997526629671,
1155 1.4659193880646628,
1156 1.4661381107208424,
1157 1.4663559262885972,
1158 1.4665728403785376,
1159 1.4667888585552677,
1160 1.467003986337854,
1161 1.4672182292002884,
1162 1.4674315925719472,
1163 1.4676440818380412,
1164 1.4678557023400625,
1165 1.4680664593762272,
1166 1.4682763582019092,
1167 1.468485404030072,
1168 1.468693602031694,
1169 1.4689009573361889,
1170 1.4691074750318196,
1171 1.469313160166111,
1172 1.4695180177462535,
1173 1.4697220527395047,
1174 1.4699252700735848,
1175 1.4701276746370677,
1176 1.4703292712797684,
1177 1.4705300648131245,
1178 1.4707300600105733,
1179 1.4709292616079255,
1180 };
1181};
1182
1183
1184#endif //PHYZIX_MATH_H
A class that provides light-weight mathematical functions.
Definition Math.h:13
static float atan(float m)
get the arc tangent of a ratio if slope approaches infinity
Definition Math.h:157
static float pow(float base, int exponent)
exponentiation
Definition Math.h:23
static int sign(float x)
get the sign of number
Definition Math.h:138
static int max(int a, int b)
get maximum integer value
Definition Math.h:72
static float max(float a, float b)
get maximum float value
Definition Math.h:62
static float atan(float y, float x)
get the arc tangent of the ratio constructed by the y amount and the x amount if x is zero,...
Definition Math.h:168
static float fabs(float n)
get the floating-point absolute value
Definition Math.h:81
static float sqrt(float n)
get the square root of the number
Definition Math.h:99
static constexpr float PI
Definition Math.h:15
static float cos(float angle)
get the cosine of the angle
Definition Math.h:119
static float min(float a, float b)
get minimum float value
Definition Math.h:42
static int abs(int n)
get integer absolute value
Definition Math.h:90
static int min(int a, int b)
get minimum integer value
Definition Math.h:52
static float sin(float angle)
get the sine of the angle
Definition Math.h:147