[Python] Unexpected results from imaginary exponentiation in Numpy

Discussão em 'Python' iniciado por Stack, Julho 9, 2025.

  1. Stack

    Stack Membro Participativo

    I am using numpy to prototype a FFT hw accelerator. And while I was debugging the base 2x2 case when I noticed something odd.

    Per every calculator I could find e^(-i * pi) is equal to -1.

    However when I have Numpy do np.exp(-1j*np.pi) it returns (-1-1.2246467991473532e-16j)

    I can't read this number but it doesn't look like -1 and when you add -1 to it it doesn't start looking like 0.

    Are the online calculators I am using here wrong? Or perhaps I am notating the math incorrectly?

    Continue reading...

Compartilhe esta Página