Loading CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ # cmake_minimum_required (VERSION 3.14) project (cppduals VERSION 0.6.2 VERSION 0.6.3 LANGUAGES C CXX ) include (GNUInstallDirs) Loading duals/dual +23 −4 Original line number Diff line number Diff line Loading @@ -1842,11 +1842,30 @@ struct fmt::formatter<std::complex<T>,Char> : public fmt::formatter<T,Char> if (x.real() || !x.imag()) base::format(x.real(), ctx); if (x.imag()) { // The base formatter will handle the negative sign if (x.real() && x.imag() >= 0 && sign::plus != specs_.sign()) { format_to(ctx.out(), "+"); if (x.real()) { // Format imaginary to temp buffer to strip sign fmt::memory_buffer imag_buf; auto imag_ctx = fmt::format_context(fmt::appender(imag_buf), {}); base::format(x.imag(), imag_ctx); std::string_view imag_str(imag_buf.data(), imag_buf.size()); // Strip leading sign if present size_t start = 0; if (!imag_str.empty() && (imag_str[0] == '+' || imag_str[0] == '-')) { start = 1; } // Add our own sign if (x.imag() >= 0) format_to(ctx.out(), "+"); else format_to(ctx.out(), "-"); // Output number without sign format_to(ctx.out(), "{}", imag_str.substr(start)); } else { base::format(x.imag(), ctx); } if (style_ == style::star) format_to(ctx.out(), "*i"); else Loading Loading
CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ # cmake_minimum_required (VERSION 3.14) project (cppduals VERSION 0.6.2 VERSION 0.6.3 LANGUAGES C CXX ) include (GNUInstallDirs) Loading
duals/dual +23 −4 Original line number Diff line number Diff line Loading @@ -1842,11 +1842,30 @@ struct fmt::formatter<std::complex<T>,Char> : public fmt::formatter<T,Char> if (x.real() || !x.imag()) base::format(x.real(), ctx); if (x.imag()) { // The base formatter will handle the negative sign if (x.real() && x.imag() >= 0 && sign::plus != specs_.sign()) { format_to(ctx.out(), "+"); if (x.real()) { // Format imaginary to temp buffer to strip sign fmt::memory_buffer imag_buf; auto imag_ctx = fmt::format_context(fmt::appender(imag_buf), {}); base::format(x.imag(), imag_ctx); std::string_view imag_str(imag_buf.data(), imag_buf.size()); // Strip leading sign if present size_t start = 0; if (!imag_str.empty() && (imag_str[0] == '+' || imag_str[0] == '-')) { start = 1; } // Add our own sign if (x.imag() >= 0) format_to(ctx.out(), "+"); else format_to(ctx.out(), "-"); // Output number without sign format_to(ctx.out(), "{}", imag_str.substr(start)); } else { base::format(x.imag(), ctx); } if (style_ == style::star) format_to(ctx.out(), "*i"); else Loading