Open
Description
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:
-
__trunc__(self) -> int
, which will enablemath.trunc(numpy_float)
-
is_integer(self) -> bool
(done in ENH: Addis_integer
tonp.floating
&np.integer
#19803) -
as_integer_ratio(self) -> Tuple[int, int]
(done in ENH: Implementnp.floating.as_integer_ratio
#10741) -
hex(self) -> str
-
fromhex(cls: Type[FloatType], s: str) -> FloatType
For all of these, the best approach is probably to port the CPython implementations, taking care to handle the extended precision of long double
s.
Note that we get these methods for free on np.float64
due to inheriting from float
Metadata
Metadata
Assignees
Labels
Possible project, may require specific skills and long commitmentPossible project, may require specific skills and long commitment