Skip to content

Add methods from the builtin float types to the numpy floating point types #13375

@eric-wieser

Description

@eric-wieser

Asking for methods that exist on builtin float types but not numpy types gives:

>>> set(dir(float)) - set(dir(np.float32))
{'__getformat__',
 '__getnewargs__',
 '__setformat__',
 '__trunc__',
 'as_integer_ratio',
 'fromhex',
 'hex',
 'is_integer'}

Filtering these to the ones that are not CPython implementation details, we have:

For all of these, the best approach is probably to port the CPython implementations, taking care to handle the extended precision of long doubles.

Note that we get these methods for free on np.float64 due to inheriting from float

Metadata

Metadata

Assignees

No one assigned

    Labels

    01 - EnhancementProjectPossible project, may require specific skills and long commitment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions