URL: <https://savannah.gnu.org/bugs/?66862>
Summary: Bug: duplicate functions in GSL produce differing
results
Group: GNU Scientific Library
Submitter: fermelelundi
Submitted: Sun 02 Mar 2025 09:01:17 PM UTC
Category: None
Severity: 3 - Normal
Operating System:
Status: None
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Release: 2.8
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Sun 02 Mar 2025 09:01:17 PM UTC By: Fermé le Lundi <fermelelundi>
Some functions are duplicated within GSL, notably complex sine and complex
cosine:
- gsl_complex_sin() from module complex versus gsl_sf_complex_sin_e() from
specfunc
- gsl_complex_cos() from module complex versus gsl_sf_complex_cos_e() from
specfunc
Attached is a self-contained test program that calculates the results of these
functions within a square around the origin and only reports a line when the
deviation in either the real part or imaginary part exceeds a tolerance level.
The following observations can be made:
1- Results across function implementations vary: although the deviation is
mostly at machine-precision tolerance level, the implementations themselves
also vary, which may be a factor. Large deviations apparently only occur for
an imaginary part larger than pi.
2- Possibly related is the observation that the deviations are not necessarily
symmetrical: sin(-5.7 -6.2 i) prints a line, but sin(5.7 -6.2 i) does not.
3- The results are incorrect: for an even function like cos(), the following
should not occur:
gsl_complex_cos (-6.2 -5.3 i) = 98.008630 +9.833157 i
gsl_complex_cos ( 6.2 -5.3 i) = 98.283853 -6.532418 i
gsl_sf_complex_cos_e (-6.2 -5.3 i) = 98.008630 +9.833157 i
gsl_sf_complex_cos_e ( 6.2 -5.3 i) = 98.283853 -6.532418 i
Analogous examples can be found for sin().
_______________________________________________________
File Attachments:
-------------------------------------------------------
Name: test_complex.c Size: 2KiB
<https://file.savannah.gnu.org/file/test_complex.c?file_id=56965>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-513955078e56c124c506c834d031bbe09cbf4040.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?66862>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
