Skip to content

dtype(int) is int64 not python int #12322

@ra1u

Description

@ra1u

np.dtype(int) is int64, not python int as expected.

>>> import numpy as np
>>> a = np.array([2],dtype = np.dtype(int))
>>> a.dtype
dtype('int64')
>>> a**63
array([-9223372036854775808])
>>> np.version.version
'1.14.3'

np.dtype(int) is expected to be Python compatible integer.
Specifically Python integers have unlimited precision, but numpy is limited to only 63 binary digits.

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