Skip to content

np.exp outputs wrong results #159

Open
@Muuuh219

Description

@Muuuh219

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions