//===================================== complex =========================================
// the code is a translation of the C++ code published on the web with some tweaks to make the results agree with Mathematica
// I also added the complex ArcTan2, complex Zeta and complex gamma functions
// the file has since vanished from the web but his revised work is available at
https://github.com/RobTillaart/Complex/tree/master//
// FILE: Complex.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.09
// PURPOSE: library for Complex math for Arduino
// URL:
http://arduino.cc/playground/Main/ComplexMath//
// Released to the public domain
I first translated the code to Free Basic on Sep 17, 2017 and presently to Free Pascal from the FB translation
functions and operators
// the following are overloaded for the non-complex decfloat type and therefore not possible for decfloatc
// operator := (r : Int16) z : decfloatc;
// operator := (r : Int32) z : decfloatc;
// operator := (r : int64) z : decfloatc;
// operator := (r : double) z : decfloatc;
// the following are implemented for decfloac , the complex type
operator := (r : decfloatc) z : ansistring;
Operator + (x, y : decfloatc) z : decfloatc;
Operator + (x : decfloatc; y : decfloat) z : decfloatc;
Operator + (x : decfloat; y : decfloatc) z : decfloatc;
Operator - (y : decfloatc) z : decfloatc; //negate
Operator - (x, y : decfloatc) z : decfloatc;
Operator - (x : decfloatc; y : Double) z : decfloatc;
Operator - (x : Double; y : decfloatc) z : decfloatc;
Operator * (x, y : decfloatc) z : decfloatc;
Operator * (x : decfloatc; y : decfloat) z : decfloatc;
Operator * (x : decfloat; y : decfloatc) z : decfloatc;
Operator / (x, y : decfloatc) z : decfloatc;
Operator / (x : decfloatc; y : Double) z : decfloatc;
Operator / (x : Double; y : decfloatc) z : decfloatc;
Operator ** (const x : decfloatc; const y : decfloatc) : decfloatc;
Operator ** (const x : Double; const y : decfloatc) : decfloatc;
Operator ** (const x : Integer; const y : decfloatc) : decfloatc;
function Str2c(const s: ansistring) : decfloatc;
Function csquare(x : decfloatc) : decfloatc;
Function reciprocal(x :decfloatc) : decfloatc;
Function cabs(x : decfloatc) : decfloatc;
Function csqrt(x : decfloatc) : decfloatc;
Function cexp(x : decfloatc) : decfloatc;
Function clog(x : decfloatc) : decfloatc;
Function cpow(Const x, c : decfloatc) : decfloatc;
Function clogn(Const x, c : decfloatc) : decfloatc;
Function clog10(Const x : decfloatc) : decfloatc;
Function csin(const z : decfloatc) : decfloatc;
Function ccos(const z : decfloatc) : decfloatc;
Function ctan(const z : decfloatc) : decfloatc;
Function cArcSin(const x : decfloatc) : decfloatc;
Function cArcCos(const x : decfloatc) : decfloatc;
Function cArcTan(const x : decfloatc) : decfloatc;
Function ccsc(const x : decfloatc) : decfloatc;
Function csec(const x : decfloatc) : decfloatc;
Function ccot(const x : decfloatc) : decfloatc;
Function cArcCsc(const x : decfloatc) : decfloatc;
Function cArcSec(const x : decfloatc) : decfloatc;
Function cArcCot(const x : decfloatc) : decfloatc;
//HYPERBOLICUS I
Function csinh(const x : decfloatc) : decfloatc;
Function ccosh(const x : decfloatc) : decfloatc;
Function ctanh(const x : decfloatc) : decfloatc;
Function cArcSinh(const x : decfloatc) : decfloatc;
Function cArcCosh(const x : decfloatc) : decfloatc;
Function cArcTanh(const x : decfloatc) : decfloatc;
//HYPERBOLICUS II
Function ccsch(const x : decfloatc) : decfloatc;
Function csech(const x : decfloatc) : decfloatc;
Function ccoth(const x : decfloatc) : decfloatc;
Function cArcCsch(const x : decfloatc) : decfloatc;
Function cArcSech(const x : decfloatc) : decfloatc;
Function cArcCoth(const x : decfloatc) : decfloatc;
Function fpsignc(const x : decfloatc) : Int32;
function toDecfloatc(const x : decfloat; const y : decfloat) : decfloatc; overload;
function toDecfloatc(const x : double; const y : decfloat) : decfloatc; overload;
function toDecfloatc(const x : decfloat; const y : double) : decfloatc; overload;
function toDecfloatc(const x : double; const y : double) : decfloatc; overload;
function toDecfloatc(const x : Int32; const y : decfloat) : decfloatc; overload;
function toDecfloatc(const x : decfloat; const y : Int32) : decfloatc; overload;
function toDecfloatc(const x : Int32; const y : Int32) : decfloatc; overload;
function cArctan2(y, x: decfloatc): decfloatc; overload;