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

            Bug ID: 83331
           Summary: Compile time evaluation of cbrt does not match library
                    evaluation
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matt at ookypooky dot com
  Target Milestone: ---

The following code:
--
#include <cmath>
#include <iostream>

int main ()
{
    double x = 123.456;
    std::cout << std::cbrt (x) - std::cbrt (123.456) << '\n';
}
--
Prints 8.88178e-16 with -O0. Once -O1 is turned on, it prints 0 (presumably due
to constant propagation).

Tested on coliru gcc-7.2.0 http://coliru.stacked-crooked.com/a/4b727cb1c55121d2

Reply via email to