8000 BUG: `__floordiv__` gives NaN and invalid warning for `1//0` · Issue #14900 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
BUG: __floordiv__ gives NaN and invalid warning for 1//0 #14900
Closed
@DevinShanahan

Description

@DevinShanahan

The __floordiv__ and __mod__ operators do not raise an exception for zero division with np.errstate(divide='raise'), instead replacing those instances with nan as if errstate is in the default state.

import numpy as np
x = np.ones((3, 3))
y = np.zeros((3, 3))

with np.errstate(divide='raise'):
    fdiv = x // y # expecting exception
    mod = x % y # expecting exception

Numpy: 1.17.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0