Skip to content
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

np.exp outputs wrong results #159

Open
Muuuh219 opened this issue Dec 13, 2021 · 1 comment
Open

np.exp outputs wrong results #159

Muuuh219 opened this issue Dec 13, 2021 · 1 comment

Comments

@Muuuh219
Copy link

Muuuh219 commented Dec 13, 2021

Hi everyone,

when I use np.exp(A) with the development version 2.0.23 where A is some matrix, the results are totally wrong.

Example:
import numpy as np
A = np.arange(9).reshape((3, 3))
print(np.exp(A))
array([[1.00000000e+00, 2.71828183e+00, 7.38905610e+00],
[2.00855369e+01, 5.45981500e+01, 1.48413159e+02],
[4.03428793e+02, 1.09663316e+03, 2.98095799e+03]])

import pnumpy as pn
print(np.exp(A))
array([[ 8.98846567e+307, inf, -2.05514945e-308],
[-5.58647539e-308, -1.51856145e-307, -4.12787801e-307],
[-1.12207358e-306, -3.05011222e-306, 2.98095799e+003]])

To me, it kind of looks like the first two entries are garbage, the last one is in this case correct (but it's not for arange(12) and reshape((4,3))), and the rest of the wrong entries should be divided by -2.78134232e-309 which is approximately e times 1e-309. I hope you can help me!

Thanks in advance!

@elliot-kulakow-ent
Copy link

this affects log as well :

alphas = np.linspace(0.001,0.999,999)
np.log(alphas)

change the length of the input, the last 3 are fine the rest of them are all garbage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants