`numpy.exp` is not raising overflow error for large values
See original GitHub issueHere is an example:
import numpy as np
np.seterr(all='raise')
np.exp(750.0)
this used to raise FloatingPointError: overflow...
in older NumPy version, but isn’t raising it as of version 1.14.2
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Overflow Error in Python's numpy.exp function
As fuglede says, the issue here is that np.float64 can't handle a number as large as exp(1234.1) . Try using np.float128 instead:
Read more >numpy.exp is not raising overflow error for large values #16
Issue: numpy.exp is not raising overflow error for large values, only in the Anaconda distribution, present in the latest version and at ...
Read more >How to Fix: RuntimeWarning: overflow encountered in exp
This warning occurs when you use the NumPy exp function, but use a value that is too large for it to handle. It's...
Read more >How to Fix: RuntimeWarning: Overflow encountered in exp
This warning occurs while using the NumPy library's exp() function upon using on a value that is too large. This function is used...
Read more >numpy.exp — NumPy v1.24 Manual
Calculate the exponential of all elements in the input array. Parameters: xarray_like ... If not provided or None, a freshly-allocated array is returned....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tadeu It will be inefficient to use Intel Math Kernel Library’s VML routines for a single entry due to an overhead cost.
I can confirm that NumPy 1.17 from intel channel does raise the FP exception:
However, NumPy in the Intel channel is compiled with Intel C Compiler, and uses Intel’s C compiler run-time, which implement scalar transcendental functions.
NumPy installed from conda-forge channel, presumably also compiled with MSVC raises the error:
Perhaps someone from Anaconda team needs to look into the problem and comment.
The answer to your question is no, this was a compilation using no linalg accelerator. Additionally, BLAS/Lapack is not involved in
np.exp
.