[Python] why numpy's nextafter(0,inf) will raise err when flag under(flow) enabled?

Discussão em 'Python' iniciado por Stack, Maio 18, 2025.

  1. Stack

    Stack Membro Participativo

    from numpy import nextafter,seterr
    print(nextafter(0.,1.)) #5e-324
    seterr(under="raise")
    print(nextafter(0.,1.)) #FloatingPointError: underflow encountered in nextafter


    Why is this code truggering the error below ?

    FloatingPointError: underflow encountered in nextafter.


    According to my tests, similar code works in C.

    Continue reading...

Compartilhe esta Página