amath  1.8.5
Simple command line calculator
nnumb.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 "numb.h"
31 #include "nnumb.h"
32 
33 NonNumber::NonNumber(NonNumberType type) :
35 {
36  this->type = type;
37 }
38 
40 {
41 }
42 
44 {
45  return new NonNumber(type);
46 }
47 
49 {
50  return 0;
51 }
52 
54 {
55  return 0.0;
56 }
57 
59 {
60  return false;
61 }
62 
64 {
65  return 0;
66 }
67 
69 {
70  return 0;
71 }
72 
74 {
75  return false;
76 }
77 
79 {
80  return false;
81 }
82 
84 {
85  return type == nnnan;
86 }
87 
89 {
90  return type == nnninf;
91 }
92 
94 {
95  return type == nnnimp;
96 }
97 
99 {
100  return new NonNumber(type);
101 }
102 
104 {
105  return new NonNumber(type);
106 }
107 
109 {
110  return new NonNumber(type);
111 }
112 
114 {
115  return new NonNumber(type);
116 }
117 
119 {
120  return new NonNumber(type);
121 }
122 
124 {
125  return new NonNumber(type);
126 }
127 
129 {
130  return new NonNumber(type);
131 }
132 
134 {
135  return new NonNumber(type);
136 }
137 
139 {
140  return new NonNumber(type);
141 }
142 
144 {
145  return new NonNumber(type);
146 }
147 
149 {
150  return new NonNumber(type);
151 }
152 
154 {
155  return new NonNumber(type);
156 }
157 
159 {
160  return new NonNumber(type);
161 }
162 
164 {
165  return new NonNumber(type);
166 }
167 
169 {
170  return new NonNumber(type);
171 }
172 
174 {
175  return new NonNumber(type);
176 }
177 
179 {
180  return new NonNumber(type);
181 }
182 
184 {
185  return new NonNumber(type);
186 }
187 
189 {
190  return new NonNumber(type);
191 }
192 
194 {
195  return new NonNumber(type);
196 }
197 
199 {
200  return new NonNumber(type);
201 }
202 
203 /**
204  * @brief Trigonometric tangent function
205  *
206  * Tangent of +INF and -INF is NaN (with signals).
207  * Tangent of NaN is NaN.
208  *
209  * Signals are not implemented.
210  *
211  */
213 {
214  return new NonNumber(nnnan);
215 }
216 
218 {
219  return new NonNumber(type);
220 }
221 
223 {
224  return new NonNumber(type);
225 }
226 
228 {
229  return new NonNumber(type);
230 }
231 
233 {
234  return new NonNumber(type);
235 }
236 
238 {
239  return new NonNumber(type);
240 }
241 
243 {
244  return new NonNumber(type);
245 }
246 
248 {
249  return new NonNumber(type);
250 }
251 
253 {
254  return new NonNumber(type);
255 }
256 
258 {
259  return new NonNumber(type);
260 }
261 
263 {
264  return new NonNumber(type);
265 }
266 
268 {
269  return new NonNumber(type);
270 }
271 
273 {
274  return new NonNumber(type);
275 }
276 
278 {
279  return new NonNumber(type);
280 }
281 
283 {
284  return new NonNumber(type);
285 }
286 
288 {
289  return new NonNumber(type);
290 }
291 
293 {
294  return new NonNumber(type);
295 }
296 
298 {
299  return new NonNumber(type);
300 }
301 
303 {
304  return new NonNumber(type);
305 }
306 
308 {
309  return new NonNumber(type);
310 }
311 
313 {
314  return new NonNumber(type);
315 }
316 
318 {
319  return new NonNumber(type);
320 }
321 
323 {
324  return new NonNumber(type);
325 }
326 
328 {
329  return new NonNumber(type);
330 }
331 
333 {
334  return new NonNumber(type);
335 }
336 
338 {
339  return new NonNumber(type);
340 }
341 
343 {
344  return new NonNumber(type);
345 }
346 
348 {
349  return new NonNumber(type);
350 }
351 
353 {
354  return new NonNumber(type);
355 }
356 
358 {
359  return new NonNumber(type);
360 }
361 
363 {
364  return new NonNumber(type);
365 }
366 
368 {
369  return new NonNumber(type);
370 }
371 
373 {
374  return new NonNumber(type);
375 }
376 
378 {
379  return new NonNumber(type);
380 }
381 
383 {
384  return new NonNumber(type);
385 }
386 
388 {
389  return new NonNumber(type);
390 }
391 
393 {
394  return new NonNumber(type);
395 }
396 
398 {
399  return new NonNumber(type);
400 }
401 
403 {
404  return new NonNumber(type);
405 }
406 
408 {
409  return new NonNumber(type);
410 }
411 
413 {
414  return new NonNumber(type);
415 }
416 
418 {
419  return new NonNumber(type);
420 }
421 
423 {
424  return new NonNumber(type);
425 }
426 
428 {
429  return new NonNumber(type);
430 }
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
Number(NumberSystem system)
Definition: numb.h:69
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
Definition: numb.h:61