237 {
238 constexpr size_t precision = 4;
239 constexpr size_t realWidth = precision + 7;
240 constexpr size_t imagWidth = realWidth;
241 constexpr size_t width = realWidth + imagWidth + 2;
242 constexpr double epsilon = 1.0e-8;
243 std::stringstream
buff(
"");
244 buff << std::showpos << std::scientific << std::setprecision(precision);
245 if(std::abs(c.real()) < epsilon && std::abs(c.imag()) < 1.0e-8)
247 else if(std::abs(c.real()) > epsilon && std::abs(c.imag()) < epsilon) {
buff << c.real(); }
248 else if(std::abs(c.real()) < epsilon && std::abs(c.imag()) > epsilon) {
249 buff << c.imag() <<
"*i";
250 }
251 else {
buff << c.real() << c.imag() <<
"*i"; }
252 strm << std::setw(width) <<
buff.str();
253 return strm;
254 }
std::stringstream buff("")