35 #include <itpp/itexports.h>
42 std::ostream& operator<<(std::ostream &os, const std::complex<T> &x)
45 ios::fmtflags saved_format = os.setf(ios::showpos);
47 os.setf(saved_format, ios::showpos);
53 std::istream&
operator>>(std::istream &is, std::complex<T> &x)
63 x = complex<T>(re, im);
66 is.setstate(ios_base::failbit);
70 x = complex<T>(re, T(0));
73 is.setstate(ios_base::failbit);
79 if (!is.eof() && ((c =
static_cast<char>(is.peek())) ==
'+' || c ==
'-')) {
82 x = complex<T>(re, im);
85 is.setstate(ios_base::failbit);
89 x = complex<T>(re, T(0));
103 const double pi = 3.14159265358979323846;
109 const double eps = std::numeric_limits<double>::epsilon();
118 return (modf(x, &dummy) == 0.0);
122 inline bool is_even(
int x) {
return ((x&1) == 0); }
138 #endif // #ifndef MISC_H