RPi-Distro / repo

Issue tracking for the archive.raspberrypi.org repo
37 stars 1 forks source link

atan2 fails to set floating-point exception in certain cases #310

Open JayReynoldsFreeman opened 2 years ago

JayReynoldsFreeman commented 2 years ago

I am reporting is instances in which function "atan2", provided as part of the download of the 64-bit version of bullseye, fails to set the floating-point inexact exception when it should. These instances occur repeatably when compiling and running on a Raspberry Pi 4.

I am new to dealing with Raspberry Pi bugs: I submitted this here (RPi-Distro/repo) because it has to do with a package distributed by the Raspberry Pi folks and because I couldn't find any other likely place in GitHub to put it. Perhaps it should go to whoever maintains g++.

NOTE: The attached file is a c++ source file renamed as .TXT so that I could upload it. It has many comments and will demonstrate the bug.

AtanBug.c++.TXT

popcornmix commented 2 years ago

I just tested this on Ubuntu 22.04.1 LTS (x86_64)

dom@dom-XPS-13-9370:/tmp$ uname -a
Linux dom-XPS-13-9370 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
dom@dom-XPS-13-9370:/tmp$ g++ --version
g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 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.
dom@dom-XPS-13-9370:/tmp$ /usr/bin/g++ AtanBug.c++ -o AtanBug
dom@dom-XPS-13-9370:/tmp$ ./AtanBug 
atan2( 1.0, 0.0 ) is 1.570796326794896557998981734, and fetestexcept( FE_INEXACT ) returned 0
atan2( 0.0, -1.0 ) is 3.141592653589793115997963469, and fetestexcept( FE_INEXACT ) returned 0

which I believe you are claiming is the wrong result.

If the bug is not Pi specific, it needs to be reported with g++ maintainers.