26 #if ! defined (octave_oct_cmplx_h)
27 #define octave_oct_cmplx_h 1
29 #include "octave-config.h"
48 #if ! defined (__APPLE__)
51 # define DEF_COMPLEXR_COMP(OP, OPS) \
52 template <typename T> \
53 inline bool operator OP (const std::complex<T>& a, \
54 const std::complex<T>& b) \
56 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \
57 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \
60 OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \
61 OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \
62 if (ay == static_cast<T> (-M_PI)) \
64 if (by != static_cast<T> (-M_PI)) \
65 return static_cast<T> (M_PI) OP by; \
67 else if (by == static_cast<T> (-M_PI)) \
69 return ay OP static_cast<T> (M_PI); \
76 template <typename T> \
77 inline bool operator OP (const std::complex<T>& a, T b) \
79 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \
80 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \
83 OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \
84 if (ay == static_cast<T> (-M_PI)) \
85 return static_cast<T> (M_PI) OP 0; \
91 template <typename T> \
92 inline bool operator OP (T a, const std::complex<T>& b) \
94 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \
95 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \
98 OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \
99 if (by == static_cast<T> (-M_PI)) \
100 return 0 OP static_cast<T> (M_PI); \
119 # define A_PI 3.1415925025939941f
121 # define DEF_COMPLEXR_COMP(OP, OPS) \
122 template <typename T> \
123 inline bool operator OP (const std::complex<T>& a, \
124 const std::complex<T>& b) \
126 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \
127 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \
130 OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \
131 OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \
132 if (ay == static_cast<T> (-M_PI)) \
134 if (by != static_cast<T> (-M_PI)) \
135 return static_cast<T> (M_PI) OP by; \
137 else if (by == static_cast<T> (-M_PI)) \
139 return ay OP static_cast<T> (M_PI); \
146 template <typename T> \
147 inline bool operator OP (const std::complex<T>& a, T b) \
149 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \
150 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \
153 OCTAVE_FLOAT_TRUNCATE const T ay = std::arg (a); \
154 if (ay == static_cast<T> (-M_PI)) \
155 return static_cast<T> (M_PI) OP 0; \
161 template <typename T> \
162 inline bool operator OP (T a, const std::complex<T>& b) \
164 OCTAVE_FLOAT_TRUNCATE const T ax = std::abs (a); \
165 OCTAVE_FLOAT_TRUNCATE const T bx = std::abs (b); \
168 OCTAVE_FLOAT_TRUNCATE const T by = std::arg (b); \
169 if (by == static_cast<T> (-M_PI)) \
170 return 0 OP static_cast<T> (M_PI); \
177 inline bool operator OP<float> (const std::complex<float>& a, \
178 const std::complex<float>& b) \
180 OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \
181 OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \
184 OCTAVE_FLOAT_TRUNCATE const float ay = std::arg (a); \
185 OCTAVE_FLOAT_TRUNCATE const float by = std::arg (b); \
189 return static_cast<float> (M_PI) OP by; \
191 else if (by == -A_PI) \
193 return ay OP static_cast<float> (M_PI); \
201 inline bool operator OP<float> (const std::complex<float>& a, float b) \
203 OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \
204 OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \
207 OCTAVE_FLOAT_TRUNCATE const float ay = std::arg (a); \
209 return static_cast<float> (M_PI) OP 0; \
216 inline bool operator OP<float> (float a, const std::complex<float>& b) \
218 OCTAVE_FLOAT_TRUNCATE const float ax = std::abs (a); \
219 OCTAVE_FLOAT_TRUNCATE const float bx = std::abs (b); \
222 OCTAVE_FLOAT_TRUNCATE const float by = std::arg (b); \
224 return 0 OP static_cast<float> (M_PI); \
std::complex< double > Complex
#define DEF_COMPLEXR_COMP(OP, OPS)
std::complex< float > FloatComplex