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

Submitted by:  M Welinder <terra>
Submitted on:  Sat 05 Mar 2016 10:37:23 PM UTC  
 
Category: Runtime errorSeverity: 3 - Normal
Operating System: LinuxStatus: Fixed
Assigned to: NoneOpen/Closed: Closed
Release: 2.1

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

Patch applied in commit 6f69962d548859d8ee1624e97077bd92e7e3730a

Patrick Alken <psa>
Project 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>

 

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
  • -unavailable- added by psa (Posted a comment)
  • -unavailable- added by yuliu (Updated the item)
  • -unavailable- added by terra (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 15 Sep 2016 05:12:18 PM UTCpsaStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Mon 12 Sep 2016 04:45:55 AM UTCyuliuAttached File-=>Added gsl_complex_tan.diff, #38480
      Attached File-=>Added test_tan.c, #38481

    Back to the top


    Powered by Savane 3.1-cleanup1