amath  1.8.5
Simple command line calculator
real.cpp
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2014-2018 Carsten Sonne Larsen <cs@innolan.net>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  * Project homepage:
26  * https://amath.innolan.net
27  *
28  */
29 
30 #include "mathr.h"
31 #include "amath.h"
32 #include "numb.h"
33 #include "real.h"
34 #include "cplex.h"
35 #include "nnumb.h"
36 
38 {
39  x = 0;
40 }
41 
43 {
44  this->x = x;
45 }
46 
47 RealNumber::RealNumber(double x, bool round) : Number(nsysreal)
48 {
49  if ((round && ((x > 0 && x < 1e-15) || (x < 0 && x > -1e-15))))
50  {
51  this->x = 0.0;
52  }
53  else if (round && x > 1e+16)
54  {
55  FloatUnion64 d;
56  d.integer = INFP;
57  this->x = d.floatingPoint;
58  }
59  else if (round && x < -1e+16)
60  {
61  FloatUnion64 d;
62  d.integer = INFN;
63  this->x = d.floatingPoint;
64  }
65  else
66  {
67  this->x = x;
68  }
69 }
70 
72 {
73  x = i * 1.0;
74 }
75 
77 {
78  x = i * 1.0;
79 }
80 
82 {
83 }
84 
86 {
87  return new RealNumber(x);
88 }
89 
91 {
92  return static_cast<int>(x);
93 }
94 
96 {
97  return x;
98 }
99 
100 void RealNumber::SetRealValue(double value)
101 {
102  x = value;
103 }
104 
106 {
107  return false;
108 }
109 
111 {
112  return (x < 0.0) ? -1 : 0;
113 }
114 
116 {
117  return 0;
118 }
119 
121 {
122  FloatUnion64 d;
123  d.floatingPoint = x;
124  return d.IsNegative();
125 }
126 
127 /**
128  * @brief Returns true if number is zero
129  */
131 {
132  FloatUnion64 d;
133  d.floatingPoint = x;
134  return d.IsZero();
135 }
136 
137 /**
138  * @brief Returns true if number is NaN
139  */
141 {
142  FloatUnion64 d;
143  d.floatingPoint = x;
144  return d.IsNaN();
145 }
146 
147 /**
148  * @brief Returns true if number is infinite
149  */
151 {
152  // Handle subnormal values
153  if ((x > 0 && x <= 1e-308) || (x < 0 && x >= -1e-308))
154  {
155  return true;
156  }
157 
158  FloatUnion64 d;
159  d.floatingPoint = x;
161 }
162 
163 /**
164  * @brief Always returns false for real numbers
165  */
167 {
168  return false;
169 }
170 
171 /**
172  * @brief Change sign of real number
173  */
175 {
176  return new RealNumber(-x);
177 }
178 
179 /**
180  * @brief Addition of two real numbers
181  */
183 {
184  if (other->IsNaN())
185  return new NonNumber(nnnan);
186 
187  if (other->system == nsysreal)
188  {
189  RealNumber *a = static_cast<RealNumber *>(other);
190  return new RealNumber(x + a->x);
191  }
192 
193  return other->Add(this);
194 }
195 
196 /**
197  * @brief Subtraction of two real numbers
198  */
200 {
201  if (other->IsNaN())
202  return new NonNumber(nnnan);
203 
204  if (other->system == nsysreal)
205  {
206  RealNumber *a = static_cast<RealNumber *>(other);
207  return new RealNumber(x - a->x);
208  }
209 
210  Number *y = other->Unary();
211  Number *q = y->Add(this);
212  delete y;
213  return q;
214 }
215 
216 /**
217  * @brief Multiplication of two real numbers
218  */
220 {
221  if (other->IsNaN())
222  return new NonNumber(nnnan);
223 
224  if (other->system == nsysreal)
225  {
226  RealNumber *a = static_cast<RealNumber *>(other);
227  return new RealNumber(x * a->x);
228  }
229 
230  return other->Mul(this);
231 }
232 
233 /**
234  * @brief Division of two real numbers
235  */
237 {
238  if (other->IsZero() || other->IsNaN())
239  return new NonNumber(nnnan);
240 
241  if (other->system == nsysreal)
242  {
243  RealNumber *a = static_cast<RealNumber *>(other);
244  return new RealNumber(x / a->x);
245  }
246 
247  Number *y = other->Reciprocal();
248  Number *q = Mul(y);
249  delete y;
250  return q;
251 }
252 
253 /**
254  * @brief Exponentiation function for real numbers
255  * @details See implementation in pow(double, double)
256  */
258 {
259  if (exponent->IsNaN())
260  return new NonNumber(nnnan);
261 
262  if (exponent->system == nsysreal)
263  return new RealNumber(pow(x, static_cast<RealNumber *>(exponent)->x));
264 
265  ComplexNumber *y = new ComplexNumber(x, 0.0);
266  Number *q = y->Raise(exponent);
267  delete y;
268  return q;
269 }
270 
271 /**
272  * @brief Mathematical sign function for real numbers
273  * @details See implementation in sgn(double)
274  */
276 {
277  return new RealNumber(sgn(x));
278 }
279 
280 /**
281  * @brief Mathematical trunc function for real numbers
282  * @details See implementation in trunc(double)
283  */
285 {
286  return new RealNumber(trunc(x));
287 }
288 
289 /**
290  * @brief Mathematical round function for real numbers
291  * @details See implementation in round(double)
292  */
294 {
295  return new RealNumber(round(x));
296 }
297 
298 /**
299  * @brief Mathematical floor function for real numbers
300  * @details See implementation in floor(double)
301  */
303 {
304  return new RealNumber(floor(x));
305 }
306 
307 /**
308  * @brief Mathematical ceiling function for real numbers
309  * @details See implementation in ceil(double)
310  */
312 {
313  return new RealNumber(ceil(x));
314 }
315 
316 /**
317  * @brief Absolute value of number for real numbers
318  * @details See implementation in fabs(double)
319  */
321 {
322  return new RealNumber(fabs(x));
323 }
324 
325 /**
326  * @brief Square root function for real numbers
327  * @details See implementation of square root in sqrt(double)
328  */
330 {
331  if (x > 0.0)
332  return new RealNumber(sqrt(x));
333 
334  Number *n = new ComplexNumber(x, 0);
335  Number *r = n->SquareRoot();
336  delete n;
337  return r;
338 }
339 
340 /**
341  * @brief Cube root function for real numbers
342  * @details See implementation of cube root in cbrt(double)
343  */
345 {
346  if (x >= 0.0)
347  return new RealNumber(cbrt(x));
348 
349  Number *n = new ComplexNumber(x, 0);
350  Number *r = n->CubeRoot();
351  delete n;
352  return r;
353 }
354 
355 /**
356  * @brief Reciprocal function for real numbers
357  */
359 {
360  if (x != 0.0)
361  return new RealNumber(1.0 / x);
362 
363  return new NonNumber(nnnan);
364 }
365 
366 /**
367  * @brief Factorial function for real numbers
368  */
370 {
371  return new NonNumber(nnnimp);
372 }
373 
374 /**
375  * @brief Binary logarithm function (base 2) for real numbers
376  * @details See implementation of natural logarithm in log(double)
377  */
379 {
380  static const double log2value = 0.69314718055994530942;
381  if (x == 0.0)
382  return new NonNumber(nnnan);
383 
384  if (x > 0.0)
385  return new RealNumber(log(x) / log2value);
386 
387  Number *n = new ComplexNumber(x, 0);
388  Number *r = n->Log2();
389  delete n;
390  return r;
391 }
392 
393 /**
394  * @brief Natural logarithm function (base e) for real numbers
395  * @details See implementation of natural logarithm in log(double)
396  */
398 {
399  if (x == 0.0)
400  return new NonNumber(nnnan);
401 
402  if (x > 0.0)
403  return new RealNumber(log(x));
404 
405  Number *n = new ComplexNumber(x, 0);
406  Number *r = n->Log();
407  delete n;
408  return r;
409 }
410 
411 /**
412  * @brief Base 10 logarithm function for real numbers
413  * @details See implementation of base 10 logarithm in log10(double)
414  */
416 {
417  if (x == 0.0)
418  return new NonNumber(nnnan);
419 
420  if (x > 0.0)
421  return new RealNumber(log10(x));
422 
423  Number *n = new ComplexNumber(x, 0);
424  Number *r = n->Log10();
425  delete n;
426  return r;
427 }
428 
429 /**
430  * @brief Trigonometric sine function for real numbers
431  * @details See implementation of sine function in sin(double)
432  */
434 {
435  return new RealNumber(sin(x), true);
436 }
437 
438 /**
439  * @brief Trigonometric cosine function for real numbers
440  * @details See implementation of cosine function in cos(double)
441  */
443 {
444  return new RealNumber(cos(x), true);
445 }
446 
447 /**
448  * @brief Trigonometric tangent function for real numbers
449  * @details See implementation of tangent function in tan(double)
450  */
452 {
453  return new RealNumber(tan(x), true);
454 }
455 
456 /**
457  * @brief Trigonometric secant function for real numbers
458  * @details See implementation of secant function in sec(double)
459  */
461 {
462  double a = sec(x);
463  return a != NAN
464  ? (Number *)new RealNumber(a, true)
465  : (Number *)new NonNumber(nnnan);
466 }
467 
468 /**
469  * @brief Trigonometric cosecant function for real numbers
470  * @details See implementation of cosecant function in csc(double)
471  */
473 {
474  double a = csc(x);
475  return a != NAN
476  ? (Number *)new RealNumber(a, true)
477  : (Number *)new NonNumber(nnnan);
478 }
479 
480 /**
481  * @brief Trigonometric cotangent function for real numbers
482  * @details See implementation of cotangent function in cot(double)
483  */
485 {
486  double a = cot(x);
487  return a != NAN
488  ? (Number *)new RealNumber(a, true)
489  : (Number *)new NonNumber(nnnan);
490 }
491 
492 /**
493  * @brief Trigonometric chord function for real numbers
494  * @details See implementation of chord function in crd(double)
495  */
497 {
498  return new RealNumber(crd(x), true);
499 }
500 
501 /**
502  * @brief Trigonometric exsecant function for real numbers
503  * @details See implementation of exsecant function in exs(double)
504  */
506 {
507  return new RealNumber(exs(x), true);
508 }
509 
510 /**
511  * @brief Trigonometric excosecant function for real numbers
512  * @details See implementation of excosecant function in exc(double)
513  */
515 {
516  return new RealNumber(exc(x), true);
517 }
518 
519 /**
520  * @brief Inverse trigonometric sine function for real numbers
521  * @details See implementation of inverse trigonometric sine in asin(double)
522  */
524 {
525  return new RealNumber(asin(x), true);
526 }
527 
528 /**
529  * @brief Inverse trigonometric cosine function for real numbers
530  * @details See implementation of inverse trigonometric cosine in acos(double)
531  */
533 {
534  return new RealNumber(acos(x), true);
535 }
536 
537 /**
538  * @brief Inverse trigonometric tangent function for real numbers
539  * @details See implementation of inverse trigonometric tangent in atan(double)
540  */
542 {
543  return new RealNumber(atan(x), true);
544 }
545 
546 /**
547  * @brief Inverse trigonometric secant function for real numbers
548  * @details See implementation of inverse trigonometric secant in asec(double)
549  */
551 {
552  double a = asec(x);
553  return a != NAN
554  ? (Number *)new RealNumber(a, true)
555  : (Number *)new NonNumber(nnnan);
556 }
557 
558 /**
559  * @brief Inverse trigonometric cosecant function for real numbers
560  * @details See implementation of inverse trigonometric cosecant in acsc(double)
561  */
563 {
564  double a = acsc(x);
565  return a != NAN
566  ? (Number *)new RealNumber(a, true)
567  : (Number *)new NonNumber(nnnan);
568 }
569 
570 /**
571  * @brief Inverse trigonometric cotangent function for real numbers
572  * @details See implementation of inverse trigonometric cotangent in acot(double)
573  */
575 {
576  double a = acot(x);
577  return a != NAN
578  ? (Number *)new RealNumber(a, true)
579  : (Number *)new NonNumber(nnnan);
580 }
581 
582 /**
583  * @brief Inverse trigonometric chord function for real numbers
584  * @details See implementation of Inverse chord function in acrd(double)
585  */
587 {
588  return new RealNumber(acrd(x), true);
589 }
590 
591 /**
592  * @brief Inverse trigonometric exsecant function for real numbers
593  * @details See implementation of Inverse exsecant function in aexs(double)
594  */
596 {
597  return new RealNumber(aexs(x), true);
598 }
599 
600 /**
601  * @brief Inverse trigonometric excosecant function for real numbers
602  * @details See implementation of Inverse excosecant function in aexc(double)
603  */
605 {
606  return new RealNumber(aexc(x), true);
607 }
608 
609 /**
610  * @brief Hyperbolic sine function for real numbers
611  * @details See implementation of hyperbolic sine function in sinh(double)
612  */
614 {
615  return new RealNumber(sinh(x), true);
616 }
617 
618 /**
619  * @brief Hyperbolic cosine function for real numbers
620  * @details See implementation of hyperbolic cosine function in cosh(double)
621  */
623 {
624  return new RealNumber(cosh(x), true);
625 }
626 
627 /**
628  * @brief Hyperbolic tangent function for real numbers
629  * @details See implementation of hyperbolic tangent function in tanh(double)
630  */
632 {
633  return new RealNumber(tanh(x), true);
634 }
635 
636 /**
637  * @brief Hyperbolic secant function for real numbers
638  * @details See implementation of hyperbolic secant function in sech(double)
639  */
641 {
642  double a = sech(x);
643  return a != NAN
644  ? (Number *)new RealNumber(a, true)
645  : (Number *)new NonNumber(nnnan);
646 }
647 
648 /**
649  * @brief Hyperbolic cosecant function for real numbers
650  * @details See implementation of hyperbolic sine function in csch(double)
651  */
653 {
654  double a = csch(x);
655  return a != NAN
656  ? (Number *)new RealNumber(a, true)
657  : (Number *)new NonNumber(nnnan);
658 }
659 
660 /**
661  * @brief Hyperbolic cotangent function for real numbers
662  * @details See implementation of hyperbolic tangent function in coth(double)
663  */
665 {
666  double a = coth(x);
667  return a != NAN
668  ? (Number *)new RealNumber(a, true)
669  : (Number *)new NonNumber(nnnan);
670 }
671 
672 /**
673  * @brief Inverse hyperbolic sine function for real numbers
674  * @details See implementation of inverse hyperbolic sine in asinh(double)
675  */
677 {
678  return new RealNumber(asinh(x), true);
679 }
680 
681 /**
682  * @brief Inverse hyperbolic cosine function for real numbers
683  * @details See implementation of inverse hyperbolic cosine in acosh(double)
684  */
686 {
687  return new RealNumber(acosh(x), true);
688 }
689 
690 /**
691  * @brief Inverse hyperbolic tangent function for real numbers
692  * @details See implementation of hyperbolic tangent in atanh(double)
693  */
695 {
696  return new RealNumber(atanh(x), true);
697 }
698 
699 /**
700  * @brief Inverse hyperbolic secant function for real numbers
701  * @details See implementation of inverse hyperbolic secant in asech(double)
702  */
704 {
705  double a = asech(x);
706  return a != NAN
707  ? (Number *)new RealNumber(a, true)
708  : (Number *)new NonNumber(nnnan);
709 }
710 
711 /**
712  * @brief Inverse hyperbolic cosecant function for real numbers
713  * @details See implementation of inverse hyperbolic cosecant in acsch(double)
714  */
716 {
717  double a = acsch(x);
718  return a != NAN
719  ? (Number *)new RealNumber(a, true)
720  : (Number *)new NonNumber(nnnan);
721 }
722 
723 /**
724  * @brief Inverse hyperbolic cotangent function for real numbers
725  * @details See implementation of hyperbolic cotangent in acoth(double)
726  */
728 {
729  double a = acoth(x);
730  return a != NAN
731  ? (Number *)new RealNumber(a, true)
732  : (Number *)new NonNumber(nnnan);
733 }
734 
735 /**
736  * @brief Versed sine function for real numbers
737  * @details See implementation of versed sine in ver(double)
738  */
740 {
741  return new RealNumber(ver(x), true);
742 }
743 
744 /**
745  * @brief Versed cosine function for real numbers
746  * @details See implementation of versed cosine in vcs(double)
747  */
749 {
750  return new RealNumber(vcs(x), true);
751 }
752 
753 /**
754  * @brief Coversed sine function for real numbers
755  * @details See implementation of coversed sine in cvs(double)
756  */
758 {
759  return new RealNumber(cvs(x), true);
760 }
761 
762 /**
763  * @brief Coversed cosine function for real numbers
764  * @details See implementation of coversed cosine in cvc(double)
765  */
767 {
768  return new RealNumber(cvc(x), true);
769 }
770 
771 /**
772  * @brief Haversed sine function for real numbers
773  * @details See implementation of haversed sine in hv(double)
774  */
776 {
777  return new RealNumber(hv(x), true);
778 }
779 
780 /**
781  * @brief Haversed cosine function for real numbers
782  * @details See implementation of haversed cosine in hvc(double)
783  */
785 {
786  return new RealNumber(hvc(x), true);
787 }
788 
789 /**
790  * @brief Hacoversed sine function for real numbers
791  * @details See implementation of hacoversed cosine in hcv(double)
792  */
794 {
795  return new RealNumber(hcv(x), true);
796 }
797 
798 /**
799  * @brief Hacoversed cosine function for real numbers
800  * @details See implementation of hacoversed cosine in hcc(double)
801  */
803 {
804  return new RealNumber(hcc(x), true);
805 }
806 
807 /**
808  * @brief Inverse versed sine function for real numbers
809  * @details See implementation of inverse versed sine in aver(double)
810  */
812 {
813  double a = aver(x);
814  return a != NAN
815  ? (Number *)new RealNumber(a, true)
816  : (Number *)new NonNumber(nnnan);
817 }
818 
819 /**
820  * @brief Inverse versed cosine function for real numbers
821  * @details See implementation of inverse versed cosine sine in avcs(double)
822  */
824 {
825  double a = avcs(x);
826  return a != NAN
827  ? (Number *)new RealNumber(a, true)
828  : (Number *)new NonNumber(nnnan);
829 }
830 
831 /**
832  * @brief Inverse coversed sine function for real numbers
833  * @details See implementation of inverse coversed sine in acvs(double)
834  */
836 {
837  double a = acvs(x);
838  return a != NAN
839  ? (Number *)new RealNumber(a, true)
840  : (Number *)new NonNumber(nnnan);
841 }
842 
843 /**
844  * @brief Inverse coversed cosine function for real numbers
845  * @details See implementation of inverse coversed cosine in acvc(double)
846  */
848 {
849  double a = acvc(x);
850  return a != NAN
851  ? (Number *)new RealNumber(a, true)
852  : (Number *)new NonNumber(nnnan);
853 }
854 
855 /**
856  * @brief Inverse haversed sine function for real numbers
857  * @details See implementation of inverse haversed sine in ahv(double)
858  */
860 {
861  double a = ahv(x);
862  return a != NAN
863  ? (Number *)new RealNumber(a, true)
864  : (Number *)new NonNumber(nnnan);
865 }
866 
867 /**
868  * @brief Inverse haversed cosine function for real numbers
869  * @details See implementation of inverse haversed cosine in ahvc(double)
870  */
872 {
873  double a = ahvc(x);
874  return a != NAN
875  ? (Number *)new RealNumber(a, true)
876  : (Number *)new NonNumber(nnnan);
877 }
878 
879 /**
880  * @brief Inverse hacoversed sine function for real numbers
881  * @details See implementation of inverse hacoversed sine in ahcv(double)
882  */
884 {
885  double a = ahcv(x);
886  return a != NAN
887  ? (Number *)new RealNumber(a, true)
888  : (Number *)new NonNumber(nnnan);
889 }
890 
891 /**
892  * @brief Inverse hacoversed cosine function for real numbers
893  * @details See implementation of inverse hacoversed cosine in ahcc(double)
894  */
896 {
897  double a = ahcc(x);
898  return a != NAN
899  ? (Number *)new RealNumber(a, true)
900  : (Number *)new NonNumber(nnnan);
901 }
double log(double x)
Natural logarithm function (base e)
Definition: log.c:109
Number * Clone()
Definition: real.cpp:85
Number * ArcChord()
Inverse trigonometric chord function for real numbers.
Definition: real.cpp:586
double sqrt(double x)
Square root function.
Definition: sqrt.c:119
double sech(double x)
Hyperbolic secant function.
Definition: sech.c:44
double cbrt(double x)
Cube root function.
Definition: cbrt.c:62
Number * Trunc()
Mathematical trunc function for real numbers.
Definition: real.cpp:284
virtual Number * Log()=0
Number * Log2()
Binary logarithm function (base 2) for real numbers.
Definition: real.cpp:378
double cos(double x)
Cosine function.
Definition: cos.c:87
Number * HypArcTangent()
Inverse hyperbolic tangent function for real numbers.
Definition: real.cpp:694
Number * ArcHaVerCosine()
Inverse haversed cosine function for real numbers.
Definition: real.cpp:871
Number * ArcExCosecant()
Inverse trigonometric excosecant function for real numbers.
Definition: real.cpp:604
Number * ArcHaCoVerCosine()
Inverse hacoversed cosine function for real numbers.
Definition: real.cpp:895
double asin(double x)
Inverse sine function.
Definition: asin.c:100
double hcc(double x)
Hacoversed cosine function.
Definition: hcc.c:44
Number * HypSine()
Hyperbolic sine function for real numbers.
Definition: real.cpp:613
double tan(double x)
Tangent function.
Definition: tan.c:87
Represent a number which does not exists.
Definition: nnumb.h:51
Number * Raise(Number *exponent)
Exponentiation function for real numbers.
Definition: real.cpp:257
bool IsNaN() const
Definition: numb.h:48
Number * Tangent()
Trigonometric tangent function for real numbers.
Definition: real.cpp:451
Number * Log()
Natural logarithm function (base e) for real numbers.
Definition: real.cpp:397
double ahcc(double x)
Inverse hacoversed cosine.
Definition: ahcc.c:40
virtual Number * Mul(Number *other)=0
Number(NumberSystem system)
Definition: numb.h:69
double cvs(double x)
Coversed sine function.
Definition: cvs.c:44
double acvs(double x)
Inverse coversed sine function.
Definition: acvs.c:40
Definition: nnumb.h:42
double trunc(double x)
Truncate function.
Definition: trunc.c:52
Number * HaCoVerCosine()
Hacoversed cosine function for real numbers.
Definition: real.cpp:802
double log10(double x)
Base 10 logarithm function.
Definition: log10.c:93
Number * Round()
Mathematical round function for real numbers.
Definition: real.cpp:293
double acot(double x)
Inverse cotangent function.
Definition: acot.c:45
double pow(double x, double y)
Expontation function.
Definition: pow.c:138
Number * SquareRoot()
Square root function for real numbers.
Definition: real.cpp:329
double ceil(double x)
Ceiling function.
Definition: ceil.c:63
Number * ArcHaCoVerSine()
Inverse hacoversed sine function for real numbers.
Definition: real.cpp:883
Number * ArcCosecant()
Inverse trigonometric cosecant function for real numbers.
Definition: real.cpp:562
NumberSystem system
Definition: numb.h:171
NonNumber(NonNumberType type)
Definition: nnumb.cpp:33
Number * ArcTangent()
Inverse trigonometric tangent function for real numbers.
Definition: real.cpp:541
virtual bool IsZero()=0
bool IsNegative()
Definition: real.cpp:120
double exc(double x)
Excosecant function.
Definition: exc.c:47
bool IsInfinite()
Returns true if number is infinite.
Definition: real.cpp:150
Number * ArcSine()
Inverse trigonometric sine function for real numbers.
Definition: real.cpp:523
double ver(double x)
Versed sine function.
Definition: ver.c:45
Number * Log10()
Base 10 logarithm function for real numbers.
Definition: real.cpp:415
double floor(double x)
Floor function.
Definition: floor.c:62
double hv(double x)
Haversed sine function.
Definition: hv.c:44
Number * HypArcSine()
Inverse hyperbolic sine function for real numbers.
Definition: real.cpp:676
Number * HypCotangent()
Hyperbolic cotangent function for real numbers.
Definition: real.cpp:664
Number * Factorial()
Factorial function for real numbers.
Definition: real.cpp:369
#define sgn(x)
Definition: mathr.h:54
double tanh(double x)
Hyperbolic tangent function.
Definition: tanh.c:81
#define INFP
Definition: mathr.h:51
Number * VerSine()
Versed sine function for real numbers.
Definition: real.cpp:739
double round(double x)
Round function.
Definition: round.c:40
double crd(double x)
Chord function.
Definition: crd.c:44
Definition: numb.h:66
double acsch(double x)
Inverse hyperbolic cosecant function.
Definition: acsch.c:49
double cot(double x)
Cotangent function.
Definition: cot.c:47
virtual Number * Unary()=0
bool IsInf() const
Definition: numb.h:47
bool IsMaxNegative() const
Definition: numb.h:50
RealNumber(unsigned int i)
Definition: real.cpp:76
double sinh(double x)
Hyperbolic sine function.
Definition: sinh.c:77
double asech(double x)
Inverse hyperbolic secant function.
Definition: asech.c:52
bool IsNegative() const
Definition: numb.h:45
Number * ArcExSecant()
Inverse trigonometric exsecant function for real numbers.
Definition: real.cpp:595
double csch(double x)
Hyperbolic cosecant function.
Definition: csch.c:44
virtual Number * CubeRoot()=0
double sec(double x)
Secant function.
Definition: sec.c:45
double ahvc(double x)
Inverse haversed cosine.
Definition: ahvc.c:40
#define INFN
Definition: mathr.h:52
Number * Secant()
Trigonometric secant function for real numbers.
Definition: real.cpp:460
double floatingPoint
Definition: numb.h:53
int GetPrecedence()
Definition: real.cpp:110
double atanh(double x)
Inverse hyperbolic tangent function.
Definition: atanh.c:72
double coth(double x)
Hyperbolic cotangent function.
Definition: coth.c:44
Number * ArcVerCosine()
Inverse versed cosine function for real numbers.
Definition: real.cpp:823
Number * ExCosecant()
Trigonometric excosecant function for real numbers.
Definition: real.cpp:514
Number * CoVerSine()
Coversed sine function for real numbers.
Definition: real.cpp:757
Number * ArcSecant()
Inverse trigonometric secant function for real numbers.
Definition: real.cpp:550
double acsc(double x)
Inverse cosecant function.
Definition: acsc.c:45
Number * CoVerCosine()
Coversed cosine function for real numbers.
Definition: real.cpp:766
virtual bool IsNaN()=0
Number * HaVerCosine()
Haversed cosine function for real numbers.
Definition: real.cpp:784
Number * HypTangent()
Hyperbolic tangent function for real numbers.
Definition: real.cpp:631
Number * Add(Number *other)
Addition of two real numbers.
Definition: real.cpp:182
#define NAN
Definition: mathr.h:53
Represent a real number with 15 significant digits.
Definition: real.h:45
Number * ArcHaVerSine()
Inverse haversed sine function for real numbers.
Definition: real.cpp:859
virtual Number * Log2()=0
double asec(double x)
Inverse secant function.
Definition: asec.c:45
RealNumber()
Definition: real.cpp:37
Number * Absolute()
Absolute value of number for real numbers.
Definition: real.cpp:320
Number * HypArcCosecant()
Inverse hyperbolic cosecant function for real numbers.
Definition: real.cpp:715
Number * Cotangent()
Trigonometric cotangent function for real numbers.
Definition: real.cpp:484
double acrd(double x)
Inverse chord function.
Definition: acrd.c:45
Number * ArcCosine()
Inverse trigonometric cosine function for real numbers.
Definition: real.cpp:532
double fabs(double x)
Returns the absolute value of x.
Definition: fabs.c:51
bool IsNotImplemented()
Always returns false for real numbers.
Definition: real.cpp:166
Number * VerCosine()
Versed cosine function for real numbers.
Definition: real.cpp:748
virtual Number * SquareRoot()=0
double aexc(double x)
Inverse excosecant function.
Definition: aexc.c:46
double x
Definition: real.h:143
Number * Cosine()
Trigonometric cosine function for real numbers.
Definition: real.cpp:442
Definition: nnumb.h:45
int GetIntegerValue()
Definition: real.cpp:90
double acoth(double x)
Inverse hyperbolic cotangent function.
Definition: acoth.c:49
double acvc(double x)
Inverse versed cosine.
Definition: acvc.c:45
Number * Mul(Number *other)
Multiplication of two real numbers.
Definition: real.cpp:219
double atan(double x)
Inverse tangent function.
Definition: atan.c:103
uint64_t integer
Definition: numb.h:54
Number * ArcVerSine()
Inverse versed sine function for real numbers.
Definition: real.cpp:811
Number * Div(Number *other)
Division of two real numbers.
Definition: real.cpp:236
Represent a complex number with 2 components of 15 significant digits.
Definition: cplex.h:46
Number * Cosecant()
Trigonometric cosecant function for real numbers.
Definition: real.cpp:472
double aexs(double x)
Inverse exsecant function.
Definition: aexs.c:47
double aver(double x)
Inverse versed sine function.
Definition: aver.c:40
RealNumber(signed int i)
Definition: real.cpp:71
bool IsMaxPositive() const
Definition: numb.h:49
Number * HypSecant()
Hyperbolic secant function for real numbers.
Definition: real.cpp:640
bool IsZero() const
Definition: numb.h:46
bool IsZero()
Returns true if number is zero.
Definition: real.cpp:130
Number * Signum()
Mathematical sign function for real numbers.
Definition: real.cpp:275
Number * HypArcCotangent()
Inverse hyperbolic cotangent function for real numbers.
Definition: real.cpp:727
Number * CubeRoot()
Cube root function for real numbers.
Definition: real.cpp:344
double cosh(double x)
Hyperbolic cosine function.
Definition: cosh.c:83
virtual Number * Add(Number *other)=0
bool IsNaN()
Returns true if number is NaN.
Definition: real.cpp:140
virtual Number * Reciprocal()=0
RealNumber(double x)
Definition: real.cpp:42
double sin(double x)
Sine function.
Definition: sin.c:86
double hvc(double x)
Haversed cosine function.
Definition: hvc.c:44
double vcs(double x)
Versed cosine function.
Definition: vcs.c:45
ComplexNumber(double real, double imag)
Definition: cplex.cpp:46
double hcv(double x)
Hacoversed sine function.
Definition: hcv.c:44
RealNumber(double x, bool round)
Definition: real.cpp:47
double avcs(double x)
Inverse versed sine.
Definition: avcs.c:44
double acosh(double x)
Inverse hyperbolic cosine function.
Definition: acosh.c:69
Number * ArcCotangent()
Inverse trigonometric cotangent function for real numbers.
Definition: real.cpp:574
void SetRealValue(double value)
Definition: real.cpp:100
Number * ExSecant()
Trigonometric exsecant function for real numbers.
Definition: real.cpp:505
double acos(double x)
Inverse cosine function.
Definition: acos.c:92
double GetRealValue()
Definition: real.cpp:95
int GetDefaultPrecedence()
Definition: real.cpp:115
Number * Reciprocal()
Reciprocal function for real numbers.
Definition: real.cpp:358
Number * ArcCoVerSine()
Inverse coversed sine function for real numbers.
Definition: real.cpp:835
Number * HaVerSine()
Haversed sine function for real numbers.
Definition: real.cpp:775
Number * Ceiling()
Mathematical ceiling function for real numbers.
Definition: real.cpp:311
double cvc(double x)
Coversed cosine function.
Definition: cvc.c:44
Number * ArcCoVerCosine()
Inverse coversed cosine function for real numbers.
Definition: real.cpp:847
Number * HypArcCosine()
Inverse hyperbolic cosine function for real numbers.
Definition: real.cpp:685
Number * HypArcSecant()
Inverse hyperbolic secant function for real numbers.
Definition: real.cpp:703
virtual Number * Log10()=0
double csc(double x)
Cosecant function.
Definition: csc.c:45
bool PureComplexValue()
Definition: real.cpp:105
double asinh(double x)
Inverse hyperbolic sine function.
Definition: asinh.c:68
Number * HaCoVerSine()
Hacoversed sine function for real numbers.
Definition: real.cpp:793
~RealNumber()
Definition: real.cpp:81
Number * Sine()
Trigonometric sine function for real numbers.
Definition: real.cpp:433
double ahv(double x)
Inverse haversed sine.
Definition: ahv.c:40
double exs(double x)
Exsecant function.
Definition: exs.c:48
Number * Floor()
Mathematical floor function for real numbers.
Definition: real.cpp:302
double ahcv(double x)
Inverse hacoversed sine.
Definition: ahcv.c:40
Number * Chord()
Trigonometric chord function for real numbers.
Definition: real.cpp:496
Number * HypCosine()
Hyperbolic cosine function for real numbers.
Definition: real.cpp:622
Number * Sub(Number *other)
Subtraction of two real numbers.
Definition: real.cpp:199
Number * Raise(Number *exponent)
Definition: cplex.cpp:250
Number * Unary()
Change sign of real number.
Definition: real.cpp:174
Number * HypCosecant()
Hyperbolic cosecant function for real numbers.
Definition: real.cpp:652
Definition: numb.h:61