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

            Bug ID: 85524
           Summary: Strange cbrt() result on linux in C
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: toto852 at courriel dot fr.nf
  Target Milestone: ---

This behavior strange. It meets on different version of gcc linux.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main() {
    double nb = 56623104;
    double v1 = cbrt(nb);
    printf("v1 -> %.15f\n",v1);

    double v2 = cbrt((double) 56623104);
    printf("v2 -> %.15f\n",v2);
}


Compilation :

gcc test.c -o test -lm && ./test

Result :

v1 -> 384.000000000000057
v2 -> 384.000000000000000

Reply via email to