amath  1.8.5
Simple command line calculator
nnumb.h
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 #ifndef AMATH_NON_NUMBER_H
31 #define AMATH_NON_NUMBER_H
32 
33 /**
34  * @file nnumb.h
35  * @brief Class based handling of Infinity and Not A Number
36  */
37 
38 #include "numb.h"
39 
40 typedef enum
41 {
46 } NonNumberType;
47 
48 /**
49  * @brief Represent a number which does not exists
50  */
51 struct NonNumber : public Number
52 {
53 public:
54  explicit NonNumber(NonNumberType type);
55  ~NonNumber();
56 
57  Number* Clone();
58  int GetIntegerValue();
59  double GetRealValue();
60  bool PureComplexValue();
61  int GetPrecedence();
63  bool IsNegative();
64  bool IsZero();
65  bool IsNaN();
66  bool IsInfinite();
67  bool IsNotImplemented();
68 
69  Number* Unary();
70  Number* Add(Number* other);
71  Number* Sub(Number* other);
72  Number* Mul(Number* other);
73  Number* Div(Number* other);
74  Number* Raise(Number* exponent);
75 
76  Number* Signum();
77  Number* Trunc();
78  Number* Round();
79  Number* Floor();
80  Number* Ceiling();
81  Number* Absolute();
82  Number* SquareRoot();
83  Number* CubeRoot();
84  Number* Reciprocal();
85  Number* Factorial();
86 
87  Number* Log();
88  Number* Log2();
89  Number* Log10();
90 
91  Number* Sine();
92  Number* Cosine();
93  Number* Tangent();
94  Number* Cosecant();
95  Number* Secant();
96  Number* Cotangent();
97  Number* Chord();
98  Number* ExSecant();
99  Number* ExCosecant();
100  Number* ArcSine();
101  Number* ArcCosine();
102  Number* ArcTangent();
103  Number* ArcCosecant();
104  Number* ArcSecant();
105  Number* ArcCotangent();
106  Number* ArcExSecant();
108  Number* ArcChord();
109 
110  Number* HypSine();
111  Number* HypCosine();
112  Number* HypTangent();
113  Number* HypCosecant();
114  Number* HypSecant();
115  Number* HypCotangent();
116  Number* HypArcSine();
117  Number* HypArcCosine();
120  Number* HypArcSecant();
122 
123  Number* VerSine();
124  Number* VerCosine();
125  Number* CoVerSine();
126  Number* CoVerCosine();
127  Number* HaVerSine();
128  Number* HaVerCosine();
129  Number* HaCoVerSine();
131 
132  Number* ArcVerSine();
133  Number* ArcVerCosine();
134  Number* ArcCoVerSine();
136  Number* ArcHaVerSine();
140 
141 private:
142  NonNumberType type;
143 };
144 
145 #endif
Number * Cotangent()
Definition: nnumb.cpp:217
Number * HypCosecant()
Definition: nnumb.cpp:232
Number * ArcTangent()
Definition: nnumb.cpp:277
Number * Round()
Definition: nnumb.cpp:138
Number * ArcVerSine()
Definition: nnumb.cpp:372
Definition: nnumb.h:44
Number * Trunc()
Definition: nnumb.cpp:133
Represent a number which does not exists.
Definition: nnumb.h:51
Number * ArcHaVerCosine()
Definition: nnumb.cpp:397
Number * Reciprocal()
Definition: nnumb.cpp:168
Number * ArcCoVerCosine()
Definition: nnumb.cpp:387
Definition: nnumb.h:43
int GetIntegerValue()
Definition: nnumb.cpp:48
Number * ArcCosecant()
Definition: nnumb.cpp:292
Definition: nnumb.h:42
Number * ArcHaCoVerSine()
Definition: nnumb.cpp:402
Number * HypCosine()
Definition: nnumb.cpp:237
Number * Absolute()
Definition: nnumb.cpp:153
Number * CoVerSine()
Definition: nnumb.cpp:342
Number * Div(Number *other)
Definition: nnumb.cpp:118
Number * Cosine()
Definition: nnumb.cpp:193
NonNumber(NonNumberType type)
Definition: nnumb.cpp:33
bool IsNotImplemented()
Definition: nnumb.cpp:93
Number * Sine()
Definition: nnumb.cpp:257
Number * Log2()
Definition: nnumb.cpp:178
bool IsInfinite()
Definition: nnumb.cpp:88
Number * CubeRoot()
Definition: nnumb.cpp:163
Number * ExCosecant()
Definition: nnumb.cpp:417
Number * CoVerCosine()
Definition: nnumb.cpp:347
Number * Tangent()
Trigonometric tangent function.
Definition: nnumb.cpp:212
Number * ArcCosine()
Definition: nnumb.cpp:267
Number * ExSecant()
Definition: nnumb.cpp:412
NonNumberType type
Definition: nnumb.h:142
Number * Log()
Definition: nnumb.cpp:183
Number * Cosecant()
Definition: nnumb.cpp:262
Number * Signum()
Definition: nnumb.cpp:128
Number * ArcExCosecant()
Definition: nnumb.cpp:427
bool IsNaN()
Definition: nnumb.cpp:83
Definition: numb.h:66
Number * ArcCoVerSine()
Definition: nnumb.cpp:382
Number * VerSine()
Definition: nnumb.cpp:332
bool IsNegative()
Definition: nnumb.cpp:73
Number * VerCosine()
Definition: nnumb.cpp:337
Number * Raise(Number *exponent)
Definition: nnumb.cpp:123
Number * ArcHaVerSine()
Definition: nnumb.cpp:392
Number * ArcVerCosine()
Definition: nnumb.cpp:377
Number * HypArcCotangent()
Definition: nnumb.cpp:327
bool PureComplexValue()
Definition: nnumb.cpp:58
Number * HypTangent()
Definition: nnumb.cpp:247
Number * Secant()
Definition: nnumb.cpp:198
bool IsZero()
Definition: nnumb.cpp:78
Number * Floor()
Definition: nnumb.cpp:143
Number * Sub(Number *other)
Definition: nnumb.cpp:108
Number * HypArcCosecant()
Definition: nnumb.cpp:317
Number * ArcSine()
Definition: nnumb.cpp:287
Number * ArcCotangent()
Definition: nnumb.cpp:282
Number * HypCotangent()
Definition: nnumb.cpp:252
Number * ArcChord()
Definition: nnumb.cpp:297
Number * HaCoVerSine()
Definition: nnumb.cpp:362
Number * Ceiling()
Definition: nnumb.cpp:148
double GetRealValue()
Definition: nnumb.cpp:53
Number * HypArcTangent()
Definition: nnumb.cpp:322
~NonNumber()
Definition: nnumb.cpp:39
Number * Chord()
Definition: nnumb.cpp:222
Number * HaVerCosine()
Definition: nnumb.cpp:357
int GetPrecedence()
Definition: nnumb.cpp:63
Number * HypArcSecant()
Definition: nnumb.cpp:307
Number * ArcHaCoVerCosine()
Definition: nnumb.cpp:407
Number * SquareRoot()
Definition: nnumb.cpp:158
Definition: nnumb.h:45
Number * ArcSecant()
Definition: nnumb.cpp:272
Number * Mul(Number *other)
Definition: nnumb.cpp:113
Number * HypSine()
Definition: nnumb.cpp:227
Number * Unary()
Definition: nnumb.cpp:98
int GetDefaultPrecedence()
Definition: nnumb.cpp:68
Number * Add(Number *other)
Definition: nnumb.cpp:103
Number * Log10()
Definition: nnumb.cpp:188
Number * ArcExSecant()
Definition: nnumb.cpp:422
Number * HypSecant()
Definition: nnumb.cpp:242
Number * HypArcCosine()
Definition: nnumb.cpp:302
Number * Clone()
Definition: nnumb.cpp:43
Number * HaVerSine()
Definition: nnumb.cpp:352
Number * HaCoVerCosine()
Definition: nnumb.cpp:367
Number * HypArcSine()
Definition: nnumb.cpp:312
Number * Factorial()
Definition: nnumb.cpp:173