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

            Bug ID: 111646
           Summary: cos function giving different result for the same
                    input value
           Product: gcc
           Version: 9.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vishwambhar.rathi at puresoftware dot com
  Target Milestone: ---

Hi,

Below are my platform details:

ubuntu@ubuntu:~/code$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ubuntu@ubuntu:~/code$ uname -m
aarch64
ubuntu@ubuntu:~/code$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

I am running ubuntu on windows using Qemu emulator. I tried the fowlloing
simple code:

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void main()
{
    double x = -9311848.013224;
    printf("x %.6lf cosx_1 %.6f\n",x, cos(x));
    printf("x %.6lf cosx_2 %.6f\n",x, cos(x));
}

I got different values as output. The output is:

x -9311848.013224 cosx_1 -0.634393
x -9311848.013224 cosx_2 -0.999992

Any thoughts, what is going on?

Thanks,
Vish.

Reply via email to