Qucs-core  0.0.19
real.h
Go to the documentation of this file.
00001 /*
00002  * real.h - some real valued function definitions
00003  *
00004  * Copyright (C) 2008 Stefan Jahn <stefan@lkcc.org>
00005  * Copyright (C) 2014 Guilheme Brondani Torri <guitorri@gmail.com>
00006  *
00007  * This is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  *
00012  * This software is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this package; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
00021  *
00022  * $Id$
00023  *
00024  */
00025 
00026 #ifndef __REAL_H__
00027 #define __REAL_H__
00028 
00029 #include <cmath>
00030 
00031 #include <constants.h>
00032 
00039 namespace qucs {
00040 
00041 //
00042 // trigonometric
00043 //
00044 nr_double_t    cos (const nr_double_t);
00045 nr_double_t    sin (const nr_double_t);
00046 nr_double_t    tan (const nr_double_t);
00047 nr_double_t   acos (const nr_double_t);
00048 nr_double_t   asin (const nr_double_t);
00049 nr_double_t   atan (const nr_double_t);
00050 nr_double_t  atan2 (const nr_double_t, const nr_double_t); //not used?, only for complex
00051 
00052 
00053 //
00054 // hyperbolic
00055 //
00056 nr_double_t   cosh (const nr_double_t);
00057 nr_double_t   sinh (const nr_double_t);
00058 nr_double_t   tanh (const nr_double_t);
00059 nr_double_t  acosh (const nr_double_t); // c++11
00060 nr_double_t  asinh (const nr_double_t); // c++11
00061 nr_double_t  atanh (const nr_double_t); // c++11, not used?, only for complex
00062 
00063 
00064 //
00065 // exponential and logarithmic functions
00066 //
00067 nr_double_t exp (const nr_double_t);
00068 nr_double_t log (const nr_double_t);
00069 nr_double_t log10 (const nr_double_t);
00070 
00071 
00072 //
00073 // power functions
00074 //
00075 nr_double_t pow (const nr_double_t, const nr_double_t );
00076 nr_double_t sqrt (const nr_double_t );
00077 nr_double_t xhypot (const nr_double_t, const nr_double_t ); // same hypot in c++11?
00078 
00079 
00080 //
00081 // error functions
00082 //
00083 nr_double_t erf(const nr_double_t );
00084 
00085 
00086 //
00087 // rounding and remainder functions
00088 //
00089 nr_double_t ceil(const nr_double_t );
00090 nr_double_t floor(const nr_double_t );
00091 nr_double_t fmod(const nr_double_t ); //FIXME
00092 nr_double_t trunc(const nr_double_t ); // c++11
00093 nr_double_t round(const nr_double_t ); // c++11
00094 
00095 //
00096 // Qucs extra trigonometric helper
00097 //
00098 nr_double_t coth (const nr_double_t );
00099 nr_double_t sech (const nr_double_t );
00100 nr_double_t cosech (const nr_double_t );
00101 
00102 
00103 //
00104 // Qucs extra math functions
00105 //
00106 nr_double_t  sqr (const nr_double_t );
00107 unsigned int sqr (unsigned int);
00108 nr_double_t  quadr (const nr_double_t );
00109 
00110 nr_double_t rad2deg (const nr_double_t );
00111 nr_double_t deg2rad (const nr_double_t x );
00112 
00114 static inline nr_double_t cubic (const nr_double_t x)  { return (x * x * x); }
00115 
00117 static inline nr_double_t celsius2kelvin (const nr_double_t x)  { return (x - K); }
00118 
00120 static inline nr_double_t kelvin2celsius (const nr_double_t x)  { return (x + K); }
00121 
00122 
00123 //
00124 // extra math functions
00125 //
00126 nr_double_t limexp (const nr_double_t);
00127 nr_double_t signum (const nr_double_t);
00128 nr_double_t   sign (const nr_double_t);
00129 nr_double_t   sinc (const nr_double_t);
00130 nr_double_t    fix (const nr_double_t);
00131 nr_double_t   step (const nr_double_t);
00132 unsigned int factorial (unsigned int);
00133 
00134 
00135 //
00136 // overload complex manipulations on reals
00137 //
00138 nr_double_t   real (const nr_double_t);
00139 nr_double_t   imag (const nr_double_t);
00140 nr_double_t   norm (const nr_double_t);
00141 nr_double_t   conj (const nr_double_t);
00142 nr_double_t   abs (const nr_double_t);
00143 
00144 } // namespace qucs
00145 
00146 #endif /* __REAL_H__ */