-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Open
Labels
01 - EnhancementProjectPossible project, may require specific skills and long commitmentPossible project, may require specific skills and long commitment
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)(ENH:__trunc__for floating and integer types #28949) -
is_integer(self) -> bool(done in ENH: Addis_integertonp.floating&np.integer#19803) -
as_integer_ratio(self) -> Tuple[int, int](done in ENH: Implementnp.floating.as_integer_ratio#10741) -
hex(self) -> str(ENH:float.hexandfloat.fromhexImplementation #20083) -
fromhex(cls: Type[FloatType], s: str) -> FloatType(ENH:float.hexandfloat.fromhexImplementation #20083) -
from_number(cls:Type[FloatType], number: NumberLike:, /) -> FloatType(ENH:float.from_numberimplementation #29077)
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
01 - EnhancementProjectPossible project, may require specific skills and long commitmentPossible project, may require specific skills and long commitment