bugGNU Scientific Library - Bugs: bug #47347, Complex tangent failure for -1000i

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #47347: Complex tangent failure for -1000i

Submitter:  M Welinder <terra>
Submitted:  Sat 05 Mar 2016 10:37:23 PM UTC
   
 
Category:  Runtime error Severity:  3 - Normal
Operating System:  Linux Status:  Fixed
Assigned to:  None Open/Closed:  Closed
Release:  2.1

Thu 15 Sep 2016 05:12:18 PM UTC, comment #2: 

Patch applied in commit 6f69962d548859d8ee1624e97077bd92e7e3730a

Patrick Alken <psa>
Group administrator
Mon 12 Sep 2016 04:51:09 AM UTC, comment #1: 

Please see test_tan.c for trouble shooting process and gsl_complex_tan.diff for a proposed fix.
1. This proposed fixed is based on 7141c7adb8100207ef01ff87a94d5179103fcebc
which add a branch in  gsl_complex_tanh to handle a similar issue. In this commit, tanh was modified to have a separate branch to handle large real part in input. This is what gsl_complex_tan.diff is doing in essense. In test_tan.c, this idea is implemented in `gsl_complex_tan_2` for testing purposes.
2. glibc implementation (https://github.com/lattera/glibc/blob/a2f34833b1042d5d8eeb263b4cf4caaea138c4ad/math/s_ctan.c)
converts everything to exponential when the imagineary part is big. Is this a better implementation?


Yu Liu <yuliu>
Sat 05 Mar 2016 10:37:23 PM UTC, original submission:  

With a large negative imaginary component of the argument,
the code for complex tangent ends up doing inf/inf.

tan(-1000i) produces nan-nan*i for me.

tan(1000i) produces i just fine.

Suggestion: use tan(z)=conj(tan(conj(z))) whenever Im(z)<=-1.

M Welinder <terra>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #38480:  gsl_complex_tan.diff added by yuliu (1KiB - application/octet-stream)
file #38481:  test_tan.c added by yuliu (7KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psa (Posted a comment)
  • -email is unavailable- added by yuliu (Updated the item)
  • -email is unavailable- added by terra (Submitted the item)
  •  

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-15 psa StatusNone Fixed
        Open/ClosedOpen Closed
    2016-09-12 yuliu Attached File- Added gsl_complex_tan.diff, #38480
        Attached File- Added test_tan.c, #38481

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code