public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/107538] New: std::pow(10, std::complex(NaN, 1)) aborts with -D_GLIBCXX_ASSERTIONS
@ 2022-11-05 21:37 redi at gcc dot gnu.org
  2022-11-05 21:37 ` [Bug libstdc++/107538] " redi at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-05 21:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107538

            Bug ID: 107538
           Summary: std::pow(10, std::complex(NaN, 1)) aborts with
                    -D_GLIBCXX_ASSERTIONS
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#define _GLIBCXX_ASSERTIONS
#include <complex>
#include <limits>

int main()
{
  double nan = std::numeric_limits<double>::quiet_NaN();
  std::pow(10, std::complex<double>(nan, 1));
}


/usr/include/c++/12/complex:703: std::complex<_Tp> std::polar(const _Tp&, const
_Tp&) [with _Tp = double]: Assertion '__rho >= 0' failed.
Aborted (core dumped)


The standard says that pow(x,y) should be exp(y * log(x)) so by using
std::polar we introduce a precondition that shouldn't be there.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-05-21  9:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-05 21:37 [Bug libstdc++/107538] New: std::pow(10, std::complex(NaN, 1)) aborts with -D_GLIBCXX_ASSERTIONS redi at gcc dot gnu.org
2022-11-05 21:37 ` [Bug libstdc++/107538] " redi at gcc dot gnu.org
2022-11-05 21:45 ` redi at gcc dot gnu.org
2022-11-09  4:38 ` redi at gcc dot gnu.org
2022-11-09 13:29 ` redi at gcc dot gnu.org
2023-04-26  6:56 ` rguenth at gcc dot gnu.org
2023-07-27  9:24 ` rguenth at gcc dot gnu.org
2024-02-13  4:11 ` orion at nwra dot com
2024-05-21  9:12 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).