aleaxit / gmpy

General Multi-Precision arithmetic for Python 2.6+/3+ (GMP, MPIR, MPFR, MPC)
https://gmpy2.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
519 stars 86 forks source link

Tangens computation not finished on complex argument #298

Closed w31t1 closed 3 years ago

w31t1 commented 3 years ago

Short description

The tan computation does not finished on distinct complex arguments. Thread has to be stopped manually.

Steps for reproduce:

import numpy as np
import gmpy2
zi = np.float64(54542684160.0)
zr = np.float64(1.401298464324817e-45)
gmpy2.mpc(np.float64(zr), np.float64(zi))
Out[7]: mpc('1.4012984643248171e-45+54542684160.0j')
gmpy2.tan(gmpy2.mpc(np.float64(zr), np.float64(zi)))
^C

Expected result

mpc('0.0+1.0j')

(Result on version 2.0.8 )

Note: Wolfram Alpha returns complex infinity, MPC 1.2 returns (NaN NaN)

Affected versions

Tested on beta versions 2.1.0b5 and 2.1.0b6 and current master (e1c258c2dcaab88453d2627bd40f00875b511637).

casevh commented 3 years ago

I understand the issue. I'm working on a fix.

casevh commented 3 years ago

Fix to restore 2.0.8 behavior has been committed. Thanks for the report.