amath  1.8.5
Simple command line calculator
RealNumber Struct Reference

Represent a real number with 15 significant digits. More...

#include <real.h>

Inheritance diagram for RealNumber:
Collaboration diagram for RealNumber:

Public Member Functions

 RealNumber ()
 
 RealNumber (double x)
 
 RealNumber (signed int i)
 
 RealNumber (unsigned int i)
 
 RealNumber (double x, bool round)
 
 ~RealNumber ()
 
NumberClone ()
 
int GetIntegerValue ()
 
double GetRealValue ()
 
void SetRealValue (double value)
 
bool PureComplexValue ()
 
int GetPrecedence ()
 
int GetDefaultPrecedence ()
 
bool IsNegative ()
 
bool IsZero ()
 Returns true if number is zero. More...
 
bool IsNaN ()
 Returns true if number is NaN. More...
 
bool IsInfinite ()
 Returns true if number is infinite. More...
 
bool IsNotImplemented ()
 Always returns false for real numbers. More...
 
NumberUnary ()
 Change sign of real number. More...
 
NumberAdd (Number *other)
 Addition of two real numbers. More...
 
NumberSub (Number *other)
 Subtraction of two real numbers. More...
 
NumberMul (Number *other)
 Multiplication of two real numbers. More...
 
NumberDiv (Number *other)
 Division of two real numbers. More...
 
NumberRaise (Number *exponent)
 Exponentiation function for real numbers. More...
 
NumberSignum ()
 Mathematical sign function for real numbers. More...
 
NumberTrunc ()
 Mathematical trunc function for real numbers. More...
 
NumberRound ()
 Mathematical round function for real numbers. More...
 
NumberFloor ()
 Mathematical floor function for real numbers. More...
 
NumberCeiling ()
 Mathematical ceiling function for real numbers. More...
 
NumberAbsolute ()
 Absolute value of number for real numbers. More...
 
NumberSquareRoot ()
 Square root function for real numbers. More...
 
NumberCubeRoot ()
 Cube root function for real numbers. More...
 
NumberReciprocal ()
 Reciprocal function for real numbers. More...
 
NumberFactorial ()
 Factorial function for real numbers. More...
 
NumberLog ()
 Natural logarithm function (base e) for real numbers. More...
 
NumberLog2 ()
 Binary logarithm function (base 2) for real numbers. More...
 
NumberLog10 ()
 Base 10 logarithm function for real numbers. More...
 
NumberSine ()
 Trigonometric sine function for real numbers. More...
 
NumberCosine ()
 Trigonometric cosine function for real numbers. More...
 
NumberTangent ()
 Trigonometric tangent function for real numbers. More...
 
NumberCosecant ()
 Trigonometric cosecant function for real numbers. More...
 
NumberSecant ()
 Trigonometric secant function for real numbers. More...
 
NumberCotangent ()
 Trigonometric cotangent function for real numbers. More...
 
NumberChord ()
 Trigonometric chord function for real numbers. More...
 
NumberExSecant ()
 Trigonometric exsecant function for real numbers. More...
 
NumberExCosecant ()
 Trigonometric excosecant function for real numbers. More...
 
NumberArcSine ()
 Inverse trigonometric sine function for real numbers. More...
 
NumberArcCosine ()
 Inverse trigonometric cosine function for real numbers. More...
 
NumberArcTangent ()
 Inverse trigonometric tangent function for real numbers. More...
 
NumberArcCosecant ()
 Inverse trigonometric cosecant function for real numbers. More...
 
NumberArcCotangent ()
 Inverse trigonometric cotangent function for real numbers. More...
 
NumberArcSecant ()
 Inverse trigonometric secant function for real numbers. More...
 
NumberArcChord ()
 Inverse trigonometric chord function for real numbers. More...
 
NumberArcExSecant ()
 Inverse trigonometric exsecant function for real numbers. More...
 
NumberArcExCosecant ()
 Inverse trigonometric excosecant function for real numbers. More...
 
NumberHypSine ()
 Hyperbolic sine function for real numbers. More...
 
NumberHypCosine ()
 Hyperbolic cosine function for real numbers. More...
 
NumberHypTangent ()
 Hyperbolic tangent function for real numbers. More...
 
NumberHypCosecant ()
 Hyperbolic cosecant function for real numbers. More...
 
NumberHypSecant ()
 Hyperbolic secant function for real numbers. More...
 
NumberHypCotangent ()
 Hyperbolic cotangent function for real numbers. More...
 
NumberHypArcSine ()
 Inverse hyperbolic sine function for real numbers. More...
 
NumberHypArcCosine ()
 Inverse hyperbolic cosine function for real numbers. More...
 
NumberHypArcTangent ()
 Inverse hyperbolic tangent function for real numbers. More...
 
NumberHypArcCosecant ()
 Inverse hyperbolic cosecant function for real numbers. More...
 
NumberHypArcSecant ()
 Inverse hyperbolic secant function for real numbers. More...
 
NumberHypArcCotangent ()
 Inverse hyperbolic cotangent function for real numbers. More...
 
NumberVerSine ()
 Versed sine function for real numbers. More...
 
NumberVerCosine ()
 Versed cosine function for real numbers. More...
 
NumberCoVerSine ()
 Coversed sine function for real numbers. More...
 
NumberCoVerCosine ()
 Coversed cosine function for real numbers. More...
 
NumberHaVerSine ()
 Haversed sine function for real numbers. More...
 
NumberHaVerCosine ()
 Haversed cosine function for real numbers. More...
 
NumberHaCoVerSine ()
 Hacoversed sine function for real numbers. More...
 
NumberHaCoVerCosine ()
 Hacoversed cosine function for real numbers. More...
 
NumberArcVerSine ()
 Inverse versed sine function for real numbers. More...
 
NumberArcVerCosine ()
 Inverse versed cosine function for real numbers. More...
 
NumberArcCoVerSine ()
 Inverse coversed sine function for real numbers. More...
 
NumberArcCoVerCosine ()
 Inverse coversed cosine function for real numbers. More...
 
NumberArcHaVerSine ()
 Inverse haversed sine function for real numbers. More...
 
NumberArcHaVerCosine ()
 Inverse haversed cosine function for real numbers. More...
 
NumberArcHaCoVerSine ()
 Inverse hacoversed sine function for real numbers. More...
 
NumberArcHaCoVerCosine ()
 Inverse hacoversed cosine function for real numbers. More...
 
- Public Member Functions inherited from Number
 Number (NumberSystem system)
 
virtual ~Number ()
 

Private Attributes

double x
 

Friends

struct ComplexNumber
 

Additional Inherited Members

- Protected Attributes inherited from Number
NumberSystem system
 

Detailed Description

Represent a real number with 15 significant digits.

Calculations are done using 64 bit IEEE 754 arithmetics.

Definition at line 45 of file real.h.

Constructor & Destructor Documentation

◆ RealNumber() [1/5]

RealNumber::RealNumber ( )

Definition at line 37 of file real.cpp.

References nsysreal, Number::Number(), and x.

Referenced by PlotStatement::Execute(), Grid::Grid(), NumericValueNode::NumericValueNode(), PositionalNumeralSystem::Parse(), and Program::Program().

37  : Number(nsysreal)
38 {
39  x = 0;
40 }
Number(NumberSystem system)
Definition: numb.h:69
double x
Definition: real.h:143
Definition: numb.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RealNumber() [2/5]

RealNumber::RealNumber ( double  x)
explicit

Definition at line 42 of file real.cpp.

References nsysreal, Number::Number(), and x.

Referenced by ComplexNumber::Absolute(), Absolute(), Add(), Ceiling(), Clone(), CubeRoot(), Div(), EulersNumberNode::EulersNumberNode(), Floor(), Log(), Log10(), Log2(), Mul(), PositionalNumeralSystem::Parse(), PiNode::PiNode(), Raise(), Reciprocal(), Round(), ComplexNumber::Signum(), SquareRoot(), Sub(), Trunc(), and Unary().

42  : Number(nsysreal)
43 {
44  this->x = x;
45 }
Number(NumberSystem system)
Definition: numb.h:69
double x
Definition: real.h:143
Definition: numb.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RealNumber() [3/5]

RealNumber::RealNumber ( signed int  i)
explicit

Definition at line 71 of file real.cpp.

References nsysreal, Number::Number(), and x.

Referenced by MemoryStatement::Execute(), PreferencesBase::GetDescription(), and Signum().

71  : Number(nsysreal)
72 {
73  x = i * 1.0;
74 }
Number(NumberSystem system)
Definition: numb.h:69
double x
Definition: real.h:143
Definition: numb.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RealNumber() [4/5]

RealNumber::RealNumber ( unsigned int  i)
explicit

Definition at line 76 of file real.cpp.

References nsysreal, Number::Number(), and x.

Referenced by DigitsStatement::Execute(), and PositionalNumeralSystem::GetName().

76  : Number(nsysreal)
77 {
78  x = i * 1.0;
79 }
Number(NumberSystem system)
Definition: numb.h:69
double x
Definition: real.h:143
Definition: numb.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RealNumber() [5/5]

RealNumber::RealNumber ( double  x,
bool  round 
)

Definition at line 47 of file real.cpp.

References FloatUnion64::floatingPoint, FloatUnion64::integer, nsysreal, Number::Number(), and x.

Referenced by ArcChord(), ArcCosecant(), ArcCosine(), ArcCotangent(), ArcCoVerCosine(), ArcCoVerSine(), ArcExCosecant(), ArcExSecant(), ArcHaCoVerCosine(), ArcHaCoVerSine(), ArcHaVerCosine(), ArcHaVerSine(), ArcSecant(), ArcSine(), ArcTangent(), ArcVerCosine(), ArcVerSine(), Chord(), Cosecant(), Cosine(), Cotangent(), CoVerCosine(), CoVerSine(), ExCosecant(), ExSecant(), HaCoVerCosine(), HaCoVerSine(), HaVerCosine(), HaVerSine(), HypArcCosecant(), HypArcCosine(), HypArcCotangent(), HypArcSecant(), HypArcSine(), HypArcTangent(), HypCosecant(), HypCosine(), HypCotangent(), HypSecant(), HypSine(), HypTangent(), Secant(), Sine(), Tangent(), VerCosine(), and VerSine().

47  : 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 }
Number(NumberSystem system)
Definition: numb.h:69
#define INFP
Definition: mathr.h:51
#define INFN
Definition: mathr.h:52
double floatingPoint
Definition: numb.h:53
double x
Definition: real.h:143
uint64_t integer
Definition: numb.h:54
double round(double x)
Round function.
Definition: round.c:40
Definition: numb.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~RealNumber()

RealNumber::~RealNumber ( )

Definition at line 81 of file real.cpp.

82 {
83 }

Member Function Documentation

◆ Absolute()

Number * RealNumber::Absolute ( )
virtual

Absolute value of number for real numbers.

See implementation in fabs(double)

Implements Number.

Definition at line 320 of file real.cpp.

References fabs(), RealNumber(), and x.

321 {
322  return new RealNumber(fabs(x));
323 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double fabs(double x)
Returns the absolute value of x.
Definition: fabs.c:51
Here is the call graph for this function:

◆ Add()

Number * RealNumber::Add ( Number other)
virtual

Addition of two real numbers.

Implements Number.

Definition at line 182 of file real.cpp.

References Number::Add(), Number::IsNaN(), nnnan, NonNumber::NonNumber(), nsysreal, RealNumber(), Number::system, and x.

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 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
NumberSystem system
Definition: numb.h:171
virtual bool IsNaN()=0
Represent a real number with 15 significant digits.
Definition: real.h:45
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
virtual Number * Add(Number *other)=0
Definition: numb.h:61
Here is the call graph for this function:

◆ ArcChord()

Number * RealNumber::ArcChord ( )
virtual

Inverse trigonometric chord function for real numbers.

See implementation of Inverse chord function in acrd(double)

Implements Number.

Definition at line 586 of file real.cpp.

References acrd(), RealNumber(), and x.

587 {
588  return new RealNumber(acrd(x), true);
589 }
double acrd(double x)
Inverse chord function.
Definition: acrd.c:45
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcCosecant()

Number * RealNumber::ArcCosecant ( )
virtual

Inverse trigonometric cosecant function for real numbers.

See implementation of inverse trigonometric cosecant in acsc(double)

Implements Number.

Definition at line 562 of file real.cpp.

References acsc(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

563 {
564  double a = acsc(x);
565  return a != NAN
566  ? (Number *)new RealNumber(a, true)
567  : (Number *)new NonNumber(nnnan);
568 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
double acsc(double x)
Inverse cosecant function.
Definition: acsc.c:45
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcCosine()

Number * RealNumber::ArcCosine ( )
virtual

Inverse trigonometric cosine function for real numbers.

See implementation of inverse trigonometric cosine in acos(double)

Implements Number.

Definition at line 532 of file real.cpp.

References acos(), RealNumber(), and x.

533 {
534  return new RealNumber(acos(x), true);
535 }
double acos(double x)
Inverse cosine function.
Definition: acos.c:92
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcCotangent()

Number * RealNumber::ArcCotangent ( )
virtual

Inverse trigonometric cotangent function for real numbers.

See implementation of inverse trigonometric cotangent in acot(double)

Implements Number.

Definition at line 574 of file real.cpp.

References acot(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

575 {
576  double a = acot(x);
577  return a != NAN
578  ? (Number *)new RealNumber(a, true)
579  : (Number *)new NonNumber(nnnan);
580 }
Represent a number which does not exists.
Definition: nnumb.h:51
double acot(double x)
Inverse cotangent function.
Definition: acot.c:45
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcCoVerCosine()

Number * RealNumber::ArcCoVerCosine ( )
virtual

Inverse coversed cosine function for real numbers.

See implementation of inverse coversed cosine in acvc(double)

Implements Number.

Definition at line 847 of file real.cpp.

References acvc(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

848 {
849  double a = acvc(x);
850  return a != NAN
851  ? (Number *)new RealNumber(a, true)
852  : (Number *)new NonNumber(nnnan);
853 }
double acvc(double x)
Inverse versed cosine.
Definition: acvc.c:45
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcCoVerSine()

Number * RealNumber::ArcCoVerSine ( )
virtual

Inverse coversed sine function for real numbers.

See implementation of inverse coversed sine in acvs(double)

Implements Number.

Definition at line 835 of file real.cpp.

References acvs(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

836 {
837  double a = acvs(x);
838  return a != NAN
839  ? (Number *)new RealNumber(a, true)
840  : (Number *)new NonNumber(nnnan);
841 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double acvs(double x)
Inverse coversed sine function.
Definition: acvs.c:40
Here is the call graph for this function:

◆ ArcExCosecant()

Number * RealNumber::ArcExCosecant ( )
virtual

Inverse trigonometric excosecant function for real numbers.

See implementation of Inverse excosecant function in aexc(double)

Implements Number.

Definition at line 604 of file real.cpp.

References aexc(), RealNumber(), and x.

605 {
606  return new RealNumber(aexc(x), true);
607 }
double aexc(double x)
Inverse excosecant function.
Definition: aexc.c:46
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcExSecant()

Number * RealNumber::ArcExSecant ( )
virtual

Inverse trigonometric exsecant function for real numbers.

See implementation of Inverse exsecant function in aexs(double)

Implements Number.

Definition at line 595 of file real.cpp.

References aexs(), RealNumber(), and x.

596 {
597  return new RealNumber(aexs(x), true);
598 }
double aexs(double x)
Inverse exsecant function.
Definition: aexs.c:47
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcHaCoVerCosine()

Number * RealNumber::ArcHaCoVerCosine ( )
virtual

Inverse hacoversed cosine function for real numbers.

See implementation of inverse hacoversed cosine in ahcc(double)

Implements Number.

Definition at line 895 of file real.cpp.

References ahcc(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

896 {
897  double a = ahcc(x);
898  return a != NAN
899  ? (Number *)new RealNumber(a, true)
900  : (Number *)new NonNumber(nnnan);
901 }
Represent a number which does not exists.
Definition: nnumb.h:51
double ahcc(double x)
Inverse hacoversed cosine.
Definition: ahcc.c:40
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcHaCoVerSine()

Number * RealNumber::ArcHaCoVerSine ( )
virtual

Inverse hacoversed sine function for real numbers.

See implementation of inverse hacoversed sine in ahcv(double)

Implements Number.

Definition at line 883 of file real.cpp.

References ahcv(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

884 {
885  double a = ahcv(x);
886  return a != NAN
887  ? (Number *)new RealNumber(a, true)
888  : (Number *)new NonNumber(nnnan);
889 }
double ahcv(double x)
Inverse hacoversed sine.
Definition: ahcv.c:40
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcHaVerCosine()

Number * RealNumber::ArcHaVerCosine ( )
virtual

Inverse haversed cosine function for real numbers.

See implementation of inverse haversed cosine in ahvc(double)

Implements Number.

Definition at line 871 of file real.cpp.

References ahvc(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

872 {
873  double a = ahvc(x);
874  return a != NAN
875  ? (Number *)new RealNumber(a, true)
876  : (Number *)new NonNumber(nnnan);
877 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
double ahvc(double x)
Inverse haversed cosine.
Definition: ahvc.c:40
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcHaVerSine()

Number * RealNumber::ArcHaVerSine ( )
virtual

Inverse haversed sine function for real numbers.

See implementation of inverse haversed sine in ahv(double)

Implements Number.

Definition at line 859 of file real.cpp.

References ahv(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

860 {
861  double a = ahv(x);
862  return a != NAN
863  ? (Number *)new RealNumber(a, true)
864  : (Number *)new NonNumber(nnnan);
865 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double ahv(double x)
Inverse haversed sine.
Definition: ahv.c:40
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcSecant()

Number * RealNumber::ArcSecant ( )
virtual

Inverse trigonometric secant function for real numbers.

See implementation of inverse trigonometric secant in asec(double)

Implements Number.

Definition at line 550 of file real.cpp.

References asec(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

551 {
552  double a = asec(x);
553  return a != NAN
554  ? (Number *)new RealNumber(a, true)
555  : (Number *)new NonNumber(nnnan);
556 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double asec(double x)
Inverse secant function.
Definition: asec.c:45
Here is the call graph for this function:

◆ ArcSine()

Number * RealNumber::ArcSine ( )
virtual

Inverse trigonometric sine function for real numbers.

See implementation of inverse trigonometric sine in asin(double)

Implements Number.

Definition at line 523 of file real.cpp.

References asin(), RealNumber(), and x.

524 {
525  return new RealNumber(asin(x), true);
526 }
double asin(double x)
Inverse sine function.
Definition: asin.c:100
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcTangent()

Number * RealNumber::ArcTangent ( )
virtual

Inverse trigonometric tangent function for real numbers.

See implementation of inverse trigonometric tangent in atan(double)

Implements Number.

Definition at line 541 of file real.cpp.

References atan(), RealNumber(), and x.

542 {
543  return new RealNumber(atan(x), true);
544 }
double atan(double x)
Inverse tangent function.
Definition: atan.c:103
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcVerCosine()

Number * RealNumber::ArcVerCosine ( )
virtual

Inverse versed cosine function for real numbers.

See implementation of inverse versed cosine sine in avcs(double)

Implements Number.

Definition at line 823 of file real.cpp.

References avcs(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

824 {
825  double a = avcs(x);
826  return a != NAN
827  ? (Number *)new RealNumber(a, true)
828  : (Number *)new NonNumber(nnnan);
829 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
double avcs(double x)
Inverse versed sine.
Definition: avcs.c:44
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ArcVerSine()

Number * RealNumber::ArcVerSine ( )
virtual

Inverse versed sine function for real numbers.

See implementation of inverse versed sine in aver(double)

Implements Number.

Definition at line 811 of file real.cpp.

References aver(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

812 {
813  double a = aver(x);
814  return a != NAN
815  ? (Number *)new RealNumber(a, true)
816  : (Number *)new NonNumber(nnnan);
817 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
double aver(double x)
Inverse versed sine function.
Definition: aver.c:40
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ Ceiling()

Number * RealNumber::Ceiling ( )
virtual

Mathematical ceiling function for real numbers.

See implementation in ceil(double)

Implements Number.

Definition at line 311 of file real.cpp.

References ceil(), RealNumber(), and x.

312 {
313  return new RealNumber(ceil(x));
314 }
double ceil(double x)
Ceiling function.
Definition: ceil.c:63
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ Chord()

Number * RealNumber::Chord ( )
virtual

Trigonometric chord function for real numbers.

See implementation of chord function in crd(double)

Implements Number.

Definition at line 496 of file real.cpp.

References crd(), RealNumber(), and x.

497 {
498  return new RealNumber(crd(x), true);
499 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double crd(double x)
Chord function.
Definition: crd.c:44
Here is the call graph for this function:

◆ Clone()

Number * RealNumber::Clone ( )
virtual

Implements Number.

Definition at line 85 of file real.cpp.

References RealNumber(), and x.

86 {
87  return new RealNumber(x);
88 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ Cosecant()

Number * RealNumber::Cosecant ( )
virtual

Trigonometric cosecant function for real numbers.

See implementation of cosecant function in csc(double)

Implements Number.

Definition at line 472 of file real.cpp.

References csc(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

473 {
474  double a = csc(x);
475  return a != NAN
476  ? (Number *)new RealNumber(a, true)
477  : (Number *)new NonNumber(nnnan);
478 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
double csc(double x)
Cosecant function.
Definition: csc.c:45
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ Cosine()

Number * RealNumber::Cosine ( )
virtual

Trigonometric cosine function for real numbers.

See implementation of cosine function in cos(double)

Implements Number.

Definition at line 442 of file real.cpp.

References cos(), RealNumber(), and x.

443 {
444  return new RealNumber(cos(x), true);
445 }
double cos(double x)
Cosine function.
Definition: cos.c:87
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ Cotangent()

Number * RealNumber::Cotangent ( )
virtual

Trigonometric cotangent function for real numbers.

See implementation of cotangent function in cot(double)

Implements Number.

Definition at line 484 of file real.cpp.

References cot(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

485 {
486  double a = cot(x);
487  return a != NAN
488  ? (Number *)new RealNumber(a, true)
489  : (Number *)new NonNumber(nnnan);
490 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
double cot(double x)
Cotangent function.
Definition: cot.c:47
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ CoVerCosine()

Number * RealNumber::CoVerCosine ( )
virtual

Coversed cosine function for real numbers.

See implementation of coversed cosine in cvc(double)

Implements Number.

Definition at line 766 of file real.cpp.

References cvc(), RealNumber(), and x.

767 {
768  return new RealNumber(cvc(x), true);
769 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double cvc(double x)
Coversed cosine function.
Definition: cvc.c:44
Here is the call graph for this function:

◆ CoVerSine()

Number * RealNumber::CoVerSine ( )
virtual

Coversed sine function for real numbers.

See implementation of coversed sine in cvs(double)

Implements Number.

Definition at line 757 of file real.cpp.

References cvs(), RealNumber(), and x.

758 {
759  return new RealNumber(cvs(x), true);
760 }
double cvs(double x)
Coversed sine function.
Definition: cvs.c:44
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ CubeRoot()

Number * RealNumber::CubeRoot ( )
virtual

Cube root function for real numbers.

See implementation of cube root in cbrt(double)

Implements Number.

Definition at line 344 of file real.cpp.

References cbrt(), ComplexNumber::ComplexNumber(), Number::CubeRoot(), RealNumber(), and x.

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 }
friend struct ComplexNumber
Definition: real.h:140
Definition: numb.h:66
virtual Number * CubeRoot()=0
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double cbrt(double x)
Cube root function.
Definition: cbrt.c:62
Here is the call graph for this function:

◆ Div()

Number * RealNumber::Div ( Number other)
virtual

Division of two real numbers.

Implements Number.

Definition at line 236 of file real.cpp.

References Number::IsNaN(), Number::IsZero(), Mul(), nnnan, NonNumber::NonNumber(), nsysreal, RealNumber(), Number::Reciprocal(), Number::system, and x.

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 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
NumberSystem system
Definition: numb.h:171
virtual bool IsZero()=0
Definition: numb.h:66
virtual bool IsNaN()=0
Represent a real number with 15 significant digits.
Definition: real.h:45
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Number * Mul(Number *other)
Multiplication of two real numbers.
Definition: real.cpp:219
virtual Number * Reciprocal()=0
Definition: numb.h:61
Here is the call graph for this function:

◆ ExCosecant()

Number * RealNumber::ExCosecant ( )
virtual

Trigonometric excosecant function for real numbers.

See implementation of excosecant function in exc(double)

Implements Number.

Definition at line 514 of file real.cpp.

References exc(), RealNumber(), and x.

515 {
516  return new RealNumber(exc(x), true);
517 }
double exc(double x)
Excosecant function.
Definition: exc.c:47
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ ExSecant()

Number * RealNumber::ExSecant ( )
virtual

Trigonometric exsecant function for real numbers.

See implementation of exsecant function in exs(double)

Implements Number.

Definition at line 505 of file real.cpp.

References exs(), RealNumber(), and x.

506 {
507  return new RealNumber(exs(x), true);
508 }
double exs(double x)
Exsecant function.
Definition: exs.c:48
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ Factorial()

Number * RealNumber::Factorial ( )
virtual

Factorial function for real numbers.

Implements Number.

Definition at line 369 of file real.cpp.

References nnnimp, and NonNumber::NonNumber().

370 {
371  return new NonNumber(nnnimp);
372 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:45
Here is the call graph for this function:

◆ Floor()

Number * RealNumber::Floor ( )
virtual

Mathematical floor function for real numbers.

See implementation in floor(double)

Implements Number.

Definition at line 302 of file real.cpp.

References floor(), RealNumber(), and x.

303 {
304  return new RealNumber(floor(x));
305 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double floor(double x)
Floor function.
Definition: floor.c:62
Here is the call graph for this function:

◆ GetDefaultPrecedence()

int RealNumber::GetDefaultPrecedence ( )
virtual

Implements Number.

Definition at line 115 of file real.cpp.

116 {
117  return 0;
118 }

◆ GetIntegerValue()

int RealNumber::GetIntegerValue ( )
virtual

Implements Number.

Definition at line 90 of file real.cpp.

References x.

91 {
92  return static_cast<int>(x);
93 }
double x
Definition: real.h:143

◆ GetPrecedence()

int RealNumber::GetPrecedence ( )
virtual

Implements Number.

Definition at line 110 of file real.cpp.

References x.

111 {
112  return (x < 0.0) ? -1 : 0;
113 }
double x
Definition: real.h:143

◆ GetRealValue()

double RealNumber::GetRealValue ( )
virtual

Implements Number.

Definition at line 95 of file real.cpp.

References x.

96 {
97  return x;
98 }
double x
Definition: real.h:143

◆ HaCoVerCosine()

Number * RealNumber::HaCoVerCosine ( )
virtual

Hacoversed cosine function for real numbers.

See implementation of hacoversed cosine in hcc(double)

Implements Number.

Definition at line 802 of file real.cpp.

References hcc(), RealNumber(), and x.

803 {
804  return new RealNumber(hcc(x), true);
805 }
double hcc(double x)
Hacoversed cosine function.
Definition: hcc.c:44
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HaCoVerSine()

Number * RealNumber::HaCoVerSine ( )
virtual

Hacoversed sine function for real numbers.

See implementation of hacoversed cosine in hcv(double)

Implements Number.

Definition at line 793 of file real.cpp.

References hcv(), RealNumber(), and x.

794 {
795  return new RealNumber(hcv(x), true);
796 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double hcv(double x)
Hacoversed sine function.
Definition: hcv.c:44
Here is the call graph for this function:

◆ HaVerCosine()

Number * RealNumber::HaVerCosine ( )
virtual

Haversed cosine function for real numbers.

See implementation of haversed cosine in hvc(double)

Implements Number.

Definition at line 784 of file real.cpp.

References hvc(), RealNumber(), and x.

785 {
786  return new RealNumber(hvc(x), true);
787 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double hvc(double x)
Haversed cosine function.
Definition: hvc.c:44
Here is the call graph for this function:

◆ HaVerSine()

Number * RealNumber::HaVerSine ( )
virtual

Haversed sine function for real numbers.

See implementation of haversed sine in hv(double)

Implements Number.

Definition at line 775 of file real.cpp.

References hv(), RealNumber(), and x.

776 {
777  return new RealNumber(hv(x), true);
778 }
double hv(double x)
Haversed sine function.
Definition: hv.c:44
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypArcCosecant()

Number * RealNumber::HypArcCosecant ( )
virtual

Inverse hyperbolic cosecant function for real numbers.

See implementation of inverse hyperbolic cosecant in acsch(double)

Implements Number.

Definition at line 715 of file real.cpp.

References acsch(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

716 {
717  double a = acsch(x);
718  return a != NAN
719  ? (Number *)new RealNumber(a, true)
720  : (Number *)new NonNumber(nnnan);
721 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
double acsch(double x)
Inverse hyperbolic cosecant function.
Definition: acsch.c:49
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypArcCosine()

Number * RealNumber::HypArcCosine ( )
virtual

Inverse hyperbolic cosine function for real numbers.

See implementation of inverse hyperbolic cosine in acosh(double)

Implements Number.

Definition at line 685 of file real.cpp.

References acosh(), RealNumber(), and x.

686 {
687  return new RealNumber(acosh(x), true);
688 }
double acosh(double x)
Inverse hyperbolic cosine function.
Definition: acosh.c:69
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypArcCotangent()

Number * RealNumber::HypArcCotangent ( )
virtual

Inverse hyperbolic cotangent function for real numbers.

See implementation of hyperbolic cotangent in acoth(double)

Implements Number.

Definition at line 727 of file real.cpp.

References acoth(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

728 {
729  double a = acoth(x);
730  return a != NAN
731  ? (Number *)new RealNumber(a, true)
732  : (Number *)new NonNumber(nnnan);
733 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double acoth(double x)
Inverse hyperbolic cotangent function.
Definition: acoth.c:49
Here is the call graph for this function:

◆ HypArcSecant()

Number * RealNumber::HypArcSecant ( )
virtual

Inverse hyperbolic secant function for real numbers.

See implementation of inverse hyperbolic secant in asech(double)

Implements Number.

Definition at line 703 of file real.cpp.

References asech(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

704 {
705  double a = asech(x);
706  return a != NAN
707  ? (Number *)new RealNumber(a, true)
708  : (Number *)new NonNumber(nnnan);
709 }
double asech(double x)
Inverse hyperbolic secant function.
Definition: asech.c:52
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypArcSine()

Number * RealNumber::HypArcSine ( )
virtual

Inverse hyperbolic sine function for real numbers.

See implementation of inverse hyperbolic sine in asinh(double)

Implements Number.

Definition at line 676 of file real.cpp.

References asinh(), RealNumber(), and x.

677 {
678  return new RealNumber(asinh(x), true);
679 }
double asinh(double x)
Inverse hyperbolic sine function.
Definition: asinh.c:68
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypArcTangent()

Number * RealNumber::HypArcTangent ( )
virtual

Inverse hyperbolic tangent function for real numbers.

See implementation of hyperbolic tangent in atanh(double)

Implements Number.

Definition at line 694 of file real.cpp.

References atanh(), RealNumber(), and x.

695 {
696  return new RealNumber(atanh(x), true);
697 }
double atanh(double x)
Inverse hyperbolic tangent function.
Definition: atanh.c:72
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypCosecant()

Number * RealNumber::HypCosecant ( )
virtual

Hyperbolic cosecant function for real numbers.

See implementation of hyperbolic sine function in csch(double)

Implements Number.

Definition at line 652 of file real.cpp.

References csch(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

653 {
654  double a = csch(x);
655  return a != NAN
656  ? (Number *)new RealNumber(a, true)
657  : (Number *)new NonNumber(nnnan);
658 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
double csch(double x)
Hyperbolic cosecant function.
Definition: csch.c:44
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypCosine()

Number * RealNumber::HypCosine ( )
virtual

Hyperbolic cosine function for real numbers.

See implementation of hyperbolic cosine function in cosh(double)

Implements Number.

Definition at line 622 of file real.cpp.

References cosh(), RealNumber(), and x.

623 {
624  return new RealNumber(cosh(x), true);
625 }
double cosh(double x)
Hyperbolic cosine function.
Definition: cosh.c:83
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypCotangent()

Number * RealNumber::HypCotangent ( )
virtual

Hyperbolic cotangent function for real numbers.

See implementation of hyperbolic tangent function in coth(double)

Implements Number.

Definition at line 664 of file real.cpp.

References coth(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

665 {
666  double a = coth(x);
667  return a != NAN
668  ? (Number *)new RealNumber(a, true)
669  : (Number *)new NonNumber(nnnan);
670 }
double coth(double x)
Hyperbolic cotangent function.
Definition: coth.c:44
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypSecant()

Number * RealNumber::HypSecant ( )
virtual

Hyperbolic secant function for real numbers.

See implementation of hyperbolic secant function in sech(double)

Implements Number.

Definition at line 640 of file real.cpp.

References nnnan, NonNumber::NonNumber(), RealNumber(), sech(), and x.

641 {
642  double a = sech(x);
643  return a != NAN
644  ? (Number *)new RealNumber(a, true)
645  : (Number *)new NonNumber(nnnan);
646 }
double sech(double x)
Hyperbolic secant function.
Definition: sech.c:44
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypSine()

Number * RealNumber::HypSine ( )
virtual

Hyperbolic sine function for real numbers.

See implementation of hyperbolic sine function in sinh(double)

Implements Number.

Definition at line 613 of file real.cpp.

References RealNumber(), sinh(), and x.

614 {
615  return new RealNumber(sinh(x), true);
616 }
double sinh(double x)
Hyperbolic sine function.
Definition: sinh.c:77
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ HypTangent()

Number * RealNumber::HypTangent ( )
virtual

Hyperbolic tangent function for real numbers.

See implementation of hyperbolic tangent function in tanh(double)

Implements Number.

Definition at line 631 of file real.cpp.

References RealNumber(), tanh(), and x.

632 {
633  return new RealNumber(tanh(x), true);
634 }
double tanh(double x)
Hyperbolic tangent function.
Definition: tanh.c:81
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ IsInfinite()

bool RealNumber::IsInfinite ( )
virtual

Returns true if number is infinite.

Implements Number.

Definition at line 150 of file real.cpp.

References FloatUnion64::floatingPoint, FloatUnion64::IsInf(), FloatUnion64::IsMaxNegative(), FloatUnion64::IsMaxPositive(), and x.

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;
160  return d.IsInf() || d.IsMaxPositive() || d.IsMaxNegative();
161 }
bool IsInf() const
Definition: numb.h:47
bool IsMaxNegative() const
Definition: numb.h:50
double floatingPoint
Definition: numb.h:53
double x
Definition: real.h:143
bool IsMaxPositive() const
Definition: numb.h:49
Here is the call graph for this function:

◆ IsNaN()

bool RealNumber::IsNaN ( )
virtual

Returns true if number is NaN.

Implements Number.

Definition at line 140 of file real.cpp.

References FloatUnion64::floatingPoint, FloatUnion64::IsNaN(), and x.

141 {
142  FloatUnion64 d;
143  d.floatingPoint = x;
144  return d.IsNaN();
145 }
bool IsNaN() const
Definition: numb.h:48
double floatingPoint
Definition: numb.h:53
double x
Definition: real.h:143
Here is the call graph for this function:

◆ IsNegative()

bool RealNumber::IsNegative ( )
virtual

Implements Number.

Definition at line 120 of file real.cpp.

References FloatUnion64::floatingPoint, FloatUnion64::IsNegative(), and x.

121 {
122  FloatUnion64 d;
123  d.floatingPoint = x;
124  return d.IsNegative();
125 }
bool IsNegative() const
Definition: numb.h:45
double floatingPoint
Definition: numb.h:53
double x
Definition: real.h:143
Here is the call graph for this function:

◆ IsNotImplemented()

bool RealNumber::IsNotImplemented ( )
virtual

Always returns false for real numbers.

Implements Number.

Definition at line 166 of file real.cpp.

167 {
168  return false;
169 }

◆ IsZero()

bool RealNumber::IsZero ( )
virtual

Returns true if number is zero.

Implements Number.

Definition at line 130 of file real.cpp.

References FloatUnion64::floatingPoint, FloatUnion64::IsZero(), and x.

131 {
132  FloatUnion64 d;
133  d.floatingPoint = x;
134  return d.IsZero();
135 }
double floatingPoint
Definition: numb.h:53
double x
Definition: real.h:143
bool IsZero() const
Definition: numb.h:46
Here is the call graph for this function:

◆ Log()

Number * RealNumber::Log ( )
virtual

Natural logarithm function (base e) for real numbers.

See implementation of natural logarithm in log(double)

Implements Number.

Definition at line 397 of file real.cpp.

References ComplexNumber::ComplexNumber(), Number::Log(), log(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

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 }
virtual Number * Log()=0
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
friend struct ComplexNumber
Definition: real.h:140
Definition: numb.h:66
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double log(double x)
Natural logarithm function (base e)
Definition: log.c:109
Here is the call graph for this function:

◆ Log10()

Number * RealNumber::Log10 ( )
virtual

Base 10 logarithm function for real numbers.

See implementation of base 10 logarithm in log10(double)

Implements Number.

Definition at line 415 of file real.cpp.

References ComplexNumber::ComplexNumber(), log10(), Number::Log10(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

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 }
Represent a number which does not exists.
Definition: nnumb.h:51
double log10(double x)
Base 10 logarithm function.
Definition: log10.c:93
Definition: nnumb.h:42
friend struct ComplexNumber
Definition: real.h:140
Definition: numb.h:66
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
virtual Number * Log10()=0
Here is the call graph for this function:

◆ Log2()

Number * RealNumber::Log2 ( )
virtual

Binary logarithm function (base 2) for real numbers.

See implementation of natural logarithm in log(double)

Implements Number.

Definition at line 378 of file real.cpp.

References ComplexNumber::ComplexNumber(), log(), Number::Log2(), nnnan, NonNumber::NonNumber(), RealNumber(), and x.

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 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
friend struct ComplexNumber
Definition: real.h:140
Definition: numb.h:66
virtual Number * Log2()=0
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double log(double x)
Natural logarithm function (base e)
Definition: log.c:109
Here is the call graph for this function:

◆ Mul()

Number * RealNumber::Mul ( Number other)
virtual

Multiplication of two real numbers.

Implements Number.

Definition at line 219 of file real.cpp.

References Number::IsNaN(), Number::Mul(), nnnan, NonNumber::NonNumber(), nsysreal, RealNumber(), Number::system, and x.

Referenced by Div().

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 }
Represent a number which does not exists.
Definition: nnumb.h:51
virtual Number * Mul(Number *other)=0
Definition: nnumb.h:42
NumberSystem system
Definition: numb.h:171
virtual bool IsNaN()=0
Represent a real number with 15 significant digits.
Definition: real.h:45
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Definition: numb.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PureComplexValue()

bool RealNumber::PureComplexValue ( )
virtual

Implements Number.

Definition at line 105 of file real.cpp.

106 {
107  return false;
108 }

◆ Raise()

Number * RealNumber::Raise ( Number exponent)
virtual

Exponentiation function for real numbers.

See implementation in pow(double, double)

Implements Number.

Definition at line 257 of file real.cpp.

References ComplexNumber::ComplexNumber(), Number::IsNaN(), nnnan, NonNumber::NonNumber(), nsysreal, pow(), ComplexNumber::Raise(), RealNumber(), Number::system, and x.

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 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
NumberSystem system
Definition: numb.h:171
friend struct ComplexNumber
Definition: real.h:140
Definition: numb.h:66
double pow(double x, double y)
Expontation function.
Definition: pow.c:138
virtual bool IsNaN()=0
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Represent a complex number with 2 components of 15 significant digits.
Definition: cplex.h:46
Number * Raise(Number *exponent)
Definition: cplex.cpp:250
Definition: numb.h:61
Here is the call graph for this function:

◆ Reciprocal()

Number * RealNumber::Reciprocal ( )
virtual

Reciprocal function for real numbers.

Implements Number.

Definition at line 358 of file real.cpp.

References nnnan, NonNumber::NonNumber(), RealNumber(), and x.

359 {
360  if (x != 0.0)
361  return new RealNumber(1.0 / x);
362 
363  return new NonNumber(nnnan);
364 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ Round()

Number * RealNumber::Round ( )
virtual

Mathematical round function for real numbers.

See implementation in round(double)

Implements Number.

Definition at line 293 of file real.cpp.

References RealNumber(), round(), and x.

294 {
295  return new RealNumber(round(x));
296 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double round(double x)
Round function.
Definition: round.c:40
Here is the call graph for this function:

◆ Secant()

Number * RealNumber::Secant ( )
virtual

Trigonometric secant function for real numbers.

See implementation of secant function in sec(double)

Implements Number.

Definition at line 460 of file real.cpp.

References nnnan, NonNumber::NonNumber(), RealNumber(), sec(), and x.

461 {
462  double a = sec(x);
463  return a != NAN
464  ? (Number *)new RealNumber(a, true)
465  : (Number *)new NonNumber(nnnan);
466 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
Definition: numb.h:66
#define NAN
Definition: mathr.h:53
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double sec(double x)
Secant function.
Definition: sec.c:45
Here is the call graph for this function:

◆ SetRealValue()

void RealNumber::SetRealValue ( double  value)

Definition at line 100 of file real.cpp.

References x.

Referenced by PlotStatement::Execute(), and Grid::FunctionValue().

101 {
102  x = value;
103 }
double x
Definition: real.h:143
Here is the caller graph for this function:

◆ Signum()

Number * RealNumber::Signum ( )
virtual

Mathematical sign function for real numbers.

See implementation in sgn(double)

Implements Number.

Definition at line 275 of file real.cpp.

References RealNumber(), and x.

276 {
277  return new RealNumber(sgn(x));
278 }
#define sgn(x)
Definition: mathr.h:54
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ Sine()

Number * RealNumber::Sine ( )
virtual

Trigonometric sine function for real numbers.

See implementation of sine function in sin(double)

Implements Number.

Definition at line 433 of file real.cpp.

References RealNumber(), sin(), and x.

434 {
435  return new RealNumber(sin(x), true);
436 }
double sin(double x)
Sine function.
Definition: sin.c:86
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ SquareRoot()

Number * RealNumber::SquareRoot ( )
virtual

Square root function for real numbers.

See implementation of square root in sqrt(double)

Implements Number.

Definition at line 329 of file real.cpp.

References ComplexNumber::ComplexNumber(), RealNumber(), sqrt(), Number::SquareRoot(), and x.

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 }
friend struct ComplexNumber
Definition: real.h:140
Definition: numb.h:66
RealNumber()
Definition: real.cpp:37
virtual Number * SquareRoot()=0
double x
Definition: real.h:143
double sqrt(double x)
Square root function.
Definition: sqrt.c:119
Here is the call graph for this function:

◆ Sub()

Number * RealNumber::Sub ( Number other)
virtual

Subtraction of two real numbers.

Implements Number.

Definition at line 199 of file real.cpp.

References Number::Add(), Number::IsNaN(), nnnan, NonNumber::NonNumber(), nsysreal, RealNumber(), Number::system, Number::Unary(), and x.

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 }
Represent a number which does not exists.
Definition: nnumb.h:51
Definition: nnumb.h:42
NumberSystem system
Definition: numb.h:171
Definition: numb.h:66
virtual Number * Unary()=0
virtual bool IsNaN()=0
Represent a real number with 15 significant digits.
Definition: real.h:45
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
virtual Number * Add(Number *other)=0
Definition: numb.h:61
Here is the call graph for this function:

◆ Tangent()

Number * RealNumber::Tangent ( )
virtual

Trigonometric tangent function for real numbers.

See implementation of tangent function in tan(double)

Implements Number.

Definition at line 451 of file real.cpp.

References RealNumber(), tan(), and x.

452 {
453  return new RealNumber(tan(x), true);
454 }
double tan(double x)
Tangent function.
Definition: tan.c:87
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ Trunc()

Number * RealNumber::Trunc ( )
virtual

Mathematical trunc function for real numbers.

See implementation in trunc(double)

Implements Number.

Definition at line 284 of file real.cpp.

References RealNumber(), trunc(), and x.

285 {
286  return new RealNumber(trunc(x));
287 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
double trunc(double x)
Truncate function.
Definition: trunc.c:52
Here is the call graph for this function:

◆ Unary()

Number * RealNumber::Unary ( )
virtual

Change sign of real number.

Implements Number.

Definition at line 174 of file real.cpp.

References RealNumber(), and x.

175 {
176  return new RealNumber(-x);
177 }
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ VerCosine()

Number * RealNumber::VerCosine ( )
virtual

Versed cosine function for real numbers.

See implementation of versed cosine in vcs(double)

Implements Number.

Definition at line 748 of file real.cpp.

References RealNumber(), vcs(), and x.

749 {
750  return new RealNumber(vcs(x), true);
751 }
double vcs(double x)
Versed cosine function.
Definition: vcs.c:45
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

◆ VerSine()

Number * RealNumber::VerSine ( )
virtual

Versed sine function for real numbers.

See implementation of versed sine in ver(double)

Implements Number.

Definition at line 739 of file real.cpp.

References RealNumber(), ver(), and x.

740 {
741  return new RealNumber(ver(x), true);
742 }
double ver(double x)
Versed sine function.
Definition: ver.c:45
RealNumber()
Definition: real.cpp:37
double x
Definition: real.h:143
Here is the call graph for this function:

Friends And Related Function Documentation

◆ ComplexNumber

friend struct ComplexNumber
friend

Definition at line 140 of file real.h.

Member Data Documentation

◆ x


The documentation for this struct was generated from the following files: