amath/src/lib/cplex.h

145 lines
3.9 KiB
C
Raw Normal View History

2017-02-27 22:23:06 +00:00
/*-
2018-08-04 18:44:35 +00:00
* Copyright (c) 2014-2018 Carsten Sonne Larsen <cs@innolan.net>
2015-03-08 22:14:50 +00:00
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
2017-02-27 22:23:06 +00:00
* Project homepage:
2017-07-14 09:30:24 +00:00
* https://amath.innolan.net
2017-02-27 22:23:06 +00:00
*
2015-03-08 22:14:50 +00:00
*/
2017-02-27 22:23:06 +00:00
#ifndef AMATH_COMPLEX_NUMBER_H
#define AMATH_COMPLEX_NUMBER_H
2015-03-08 22:14:50 +00:00
/**
* @file cplex.h
2017-04-12 22:50:51 +00:00
* @brief Class based handling of complex numbers
2015-03-08 22:14:50 +00:00
*/
2017-02-27 22:23:06 +00:00
#include "numb.h"
2017-04-12 22:50:51 +00:00
#include "mathi.h"
2015-03-08 22:14:50 +00:00
/**
2017-04-12 22:50:51 +00:00
* @brief Represent a complex number with 2 components of 15 significant digits
2017-02-27 22:23:06 +00:00
* @details
2015-03-08 22:14:50 +00:00
* Calculations are done using 64 bit IEEE 754 arithmetics.
*/
2017-02-27 22:23:06 +00:00
struct ComplexNumber : public Number
{
2015-03-08 22:14:50 +00:00
public:
ComplexNumber();
2017-02-27 22:23:06 +00:00
explicit ComplexNumber(complex z);
2015-03-08 22:14:50 +00:00
ComplexNumber(double real, double imag);
~ComplexNumber();
Number* Clone();
int GetIntegerValue();
double GetRealValue();
2017-02-27 22:23:06 +00:00
double GetImagValue() const;
complex GetComplexValue() const;
2015-03-08 22:14:50 +00:00
bool PureComplexValue();
int GetPrecedence();
int GetDefaultPrecedence();
2017-04-12 22:50:51 +00:00
bool IsNegative();
2017-02-27 22:23:06 +00:00
bool IsZero();
bool IsNaN();
2017-04-12 22:50:51 +00:00
bool IsInfinite();
2017-02-27 22:23:06 +00:00
bool IsNotImplemented();
2017-03-11 22:37:45 +00:00
2015-03-08 22:14:50 +00:00
Number* Unary();
2017-02-27 22:23:06 +00:00
Number* Add(Number* other);
Number* Sub(Number* other);
Number* Mul(Number* other);
Number* Div(Number* other);
Number* Raise(Number* exponent);
2015-03-08 22:14:50 +00:00
Number* Signum();
Number* Trunc();
Number* Round();
Number* Floor();
Number* Ceiling();
Number* Absolute();
Number* SquareRoot();
Number* CubeRoot();
Number* Reciprocal();
2017-02-27 22:23:06 +00:00
Number* Factorial();
2015-03-08 22:14:50 +00:00
Number* Log();
Number* Log2();
Number* Log10();
Number* Sine();
Number* Cosine();
Number* Tangent();
Number* Cosecant();
Number* Secant();
Number* Cotangent();
2017-04-12 22:50:51 +00:00
Number* Chord();
Number* ExSecant();
Number* ExCosecant();
2015-03-08 22:14:50 +00:00
Number* ArcSine();
Number* ArcCosine();
Number* ArcTangent();
Number* ArcCosecant();
Number* ArcSecant();
Number* ArcCotangent();
2017-04-12 22:50:51 +00:00
Number* ArcExSecant();
Number* ArcExCosecant();
Number* ArcChord();
2015-03-08 22:14:50 +00:00
Number* HypSine();
Number* HypCosine();
Number* HypTangent();
Number* HypCosecant();
Number* HypSecant();
Number* HypCotangent();
Number* HypArcSine();
Number* HypArcCosine();
Number* HypArcTangent();
Number* HypArcCosecant();
Number* HypArcSecant();
Number* HypArcCotangent();
2017-02-27 22:23:06 +00:00
Number* VerSine();
Number* VerCosine();
Number* CoVerSine();
Number* CoVerCosine();
Number* HaVerSine();
Number* HaVerCosine();
Number* HaCoVerSine();
Number* HaCoVerCosine();
2017-03-11 22:37:45 +00:00
2017-02-27 22:23:06 +00:00
Number* ArcVerSine();
Number* ArcVerCosine();
Number* ArcCoVerSine();
Number* ArcCoVerCosine();
Number* ArcHaVerSine();
Number* ArcHaVerCosine();
Number* ArcHaCoVerSine();
Number* ArcHaCoVerCosine();
2017-03-11 22:37:45 +00:00
2015-03-08 22:14:50 +00:00
private:
complex z;
};
#endif