-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Blocklist MSVC ctanh? It misbehaves for large inputs. #5687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Probably was fixed in gh-5518 some time ago.
|
That particular fix is still unreleased, merged mid February 2015. |
Yep, fixed now. Closing this, but I added it to the 1.9.3 milestone just in case we make that release. |
With numpy 1.11.2+mkl and Python 3.5.2 I'm seeing this same problem still. Here's the output from my PyCharm console:
Needless to say, I see the problem with other large complex numbers too, not just mieswichts' magic number. :-) |
@CarpeCimex: where exactly are you getting numpy from? anaconda? |
I got it as a wheel from Christopher Gohlke at http://www.lfd.uci.edu/~gohlke/pythonlibs/ and installed it with pip. Here's a version check:
|
I still had the problem with numpy 1.9.1 when i checked it right now (never removed my redefinition of tanh), but when I pip upgraded to numpy 1.11.2 , it works fine now. Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)] on win32
I still vote for an inclusion of coth though. |
I had to use the "+mkl" version of numpy to work with another package. |
No, I dont use +mkl and my machine is 64-bit as is my python. |
I'm experiencing I'm dealing with relatively large numbers, at least up to 1e13 (this is what survives the overflow warning). Edit: To reproduce: |
Hi, I am in np.version 1.19.2 and this is still a thing. |
What platform? |
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
On 3. May 2021, at 16:46, Charles Harris ***@***.******@***.***>> wrote:
What platform?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#5687 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOLQHEOJUNONWJJMTFN3HPDTL2ZLBANCNFSM4A6AI35A>.
|
Hi, This bug is very much still in the wild - reproducible on win x64 in python 3.9.x and np 1.20.x Related issue: I've tested with both mkl and openblas versions via Conda and both produce overflow warnings. Cheers, |
Bug still there - I'm on a win x64 with python 3.9.x and np 1.21.x. The problem occurs when using the tanh**-1 definition of coth. However, with the same code I don't experience the warnings on my linux. I dunno. |
I'm having the same problem when using impedance.py. I'm using Python 3.10.6, Numpy 1.23.3 on a Windows PC.
|
@pililac Where did you get NumPy? |
I think MSVC has no complex support (that is basically not implementing C99 completely). I am not quite certain about newer versions. Right now, I expect we are using fallback versions on MSVC and those do not have branches to deal well with large values. |
I installed it via conda using miniforge. Here is a partial view of
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
OK, if you start something have to look it through I guess. After almost setting up windows, I realized that godbolt does the trick: Which shows that we are using the MSVC/system math version when the result is 0. The version that NumPy would be using as a fallback does return I am not sure if the right solution is to just consider this an MSVC/windows math issue or whether we should blocklist MSVC for |
@seberg We should establish if the conda version is using MKL, which may have its own libraries. Once we determine which library is failing we should file a bug upstream and use the fallback version, which should be OK since we don't have extended precision on windows. |
@charris I am not aware that MKL can replace math functions at run-time for scalars values (or even provides those)? (Unless this was patched by Intel, but those patched versions seem to not really be used much anymore.) We do have SIMD versions for Sounds like we should just blocklist. I agree that it should be filed as a bug upstream, I will try to do it. Last time, I didn't because they are very restrictive about requiring and making things public, but... |
Hmmm, I reported an issue, not sure if in the right place, since the C++ version |
Ah, interesting tidbit maybe. And something that I guess the previous comments also point to: The issue only reproduces with x86 mode on godbolt (I got lucky to pick that first...) and not x64. |
Hi,
when working with complex impedance data, i encountered an issue and narrowed it down to:
Warning (from warnings module):
File "C:\python\Test\Impedance class reduced.py", line 1
from numpy import *
RuntimeWarning: overflow encountered in tanh
Warning (from warnings module):
File "C:\python\Test\Impedance class reduced.py", line 1
from numpy import *
RuntimeWarning: invalid value encountered in tanh
When actually, it should return (1-0j), see http://tinyurl.com/nm4goq3
Then i tried
Warning (from warnings module):
File "C:\python\Test\Impedance class reduced.py", line 1
from numpy import *
RuntimeWarning: overflow encountered in cdouble_scalars
Warning (from warnings module):
File "C:\python\Test\Impedance class reduced.py", line 1
from numpy import *
RuntimeWarning: invalid value encountered in cdouble_scalars
(nan+nan*j)
However, the solution was to use numpy.divide:
This took me quite some time to figure out, so i guess it would be a good idea to include it in the next release (maybe even with with coth?).
Thanks a lot!
The text was updated successfully, but these errors were encountered: