@@ -2854,6 +2854,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
2854
2854
@overload
2855
2855
def __iadd__ (self : NDArray [signedinteger [_NBit1 ]], other : _ArrayLikeInt_co , / ) -> NDArray [signedinteger [_NBit1 ]]: ...
2856
2856
@overload
2857
+ def __iadd__ (self : NDArray [float64 ], other : _ArrayLikeFloat_co , / ) -> NDArray [float64 ]: ...
2858
+ @overload
2857
2859
def __iadd__ (self : NDArray [floating [_NBit1 ]], other : _ArrayLikeFloat_co , / ) -> NDArray [floating [_NBit1 ]]: ...
2858
2860
@overload
2859
2861
def __iadd__ (self : NDArray [complexfloating [_NBit1 , _NBit1 ]], other : _ArrayLikeComplex_co , / ) -> NDArray [complexfloating [_NBit1 , _NBit1 ]]: ...
@@ -2871,6 +2873,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
2871
2873
@overload
2872
2874
def __isub__ (self : NDArray [signedinteger [_NBit1 ]], other : _ArrayLikeInt_co , / ) -> NDArray [signedinteger [_NBit1 ]]: ...
2873
2875
@overload
2876
+ def __isub__ (self : NDArray [float64 ], other : _ArrayLikeFloat_co , / ) -> NDArray [float64 ]: ...
2877
+ @overload
2874
2878
def __isub__ (self : NDArray [floating [_NBit1 ]], other : _ArrayLikeFloat_co , / ) -> NDArray [floating [_NBit1 ]]: ...
2875
2879
@overload
2876
2880
def __isub__ (self : NDArray [complexfloating [_NBit1 , _NBit1 ]], other : _ArrayLikeComplex_co , / ) -> NDArray [complexfloating [_NBit1 , _NBit1 ]]: ...
@@ -2890,6 +2894,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
2890
2894
@overload
2891
2895
def __imul__ (self : NDArray [signedinteger [_NBit1 ]], other : _ArrayLikeInt_co , / ) -> NDArray [signedinteger [_NBit1 ]]: ...
2892
2896
@overload
2897
+ def __imul__ (self : NDArray [float64 ], other : _ArrayLikeFloat_co , / ) -> NDArray [float64 ]: ...
2898
+ @overload
2893
2899
def __imul__ (self : NDArray [floating [_NBit1 ]], other : _ArrayLikeFloat_co , / ) -> NDArray [floating [_NBit1 ]]: ...
2894
2900
@overload
2895
2901
def __imul__ (self : NDArray [complexfloating [_NBit1 , _NBit1 ]], other : _ArrayLikeComplex_co , / ) -> NDArray [complexfloating [_NBit1 , _NBit1 ]]: ...
@@ -2901,6 +2907,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
2901
2907
@overload
2902
2908
def __itruediv__ (self : NDArray [_UnknownType ], other : _ArrayLikeUnknown , / ) -> NDArray [Any ]: ...
2903
2909
@overload
2910
+ def __itruediv__ (self : NDArray [float64 ], other : _ArrayLikeFloat_co , / ) -> NDArray [float64 ]: ...
2911
+ @overload
2904
2912
def __itruediv__ (self : NDArray [floating [_NBit1 ]], other : _ArrayLikeFloat_co , / ) -> NDArray [floating [_NBit1 ]]: ...
2905
2913
@overload
2906
2914
def __itruediv__ (self : NDArray [complexfloating [_NBit1 , _NBit1 ]], other : _ArrayLikeComplex_co , / ) -> NDArray [complexfloating [_NBit1 , _NBit1 ]]: ...
@@ -2918,6 +2926,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
2918
2926
@overload
2919
2927
def __ifloordiv__ (self : NDArray [signedinteger [_NBit1 ]], other : _ArrayLikeInt_co , / ) -> NDArray [signedinteger [_NBit1 ]]: ...
2920
2928
@overload
2929
+ def __ifloordiv__ (self : NDArray [float64 ], other : _ArrayLikeFloat_co , / ) -> NDArray [float64 ]: ...
2930
+ @overload
2921
2931
def __ifloordiv__ (self : NDArray [floating [_NBit1 ]], other : _ArrayLikeFloat_co , / ) -> NDArray [floating [_NBit1 ]]: ...
2922
2932
@overload
2923
2933
def __ifloordiv__ (self : NDArray [complexfloating [_NBit1 , _NBit1 ]], other : _ArrayLikeComplex_co , / ) -> NDArray [complexfloating [_NBit1 , _NBit1 ]]: ...
@@ -2935,6 +2945,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
2935
2945
@overload
2936
2946
def __ipow__ (self : NDArray [signedinteger [_NBit1 ]], other : _ArrayLikeInt_co , / ) -> NDArray [signedinteger [_NBit1 ]]: ...
2937
2947
@overload
2948
+ def __ipow__ (self : NDArray [float64 ], other : _ArrayLikeFloat_co , / ) -> NDArray [float64 ]: ...
2949
+ @overload
2938
2950
def __ipow__ (self : NDArray [floating [_NBit1 ]], other : _ArrayLikeFloat_co , / ) -> NDArray [floating [_NBit1 ]]: ...
2939
2951
@overload
2940
2952
def __ipow__ (self : NDArray [complexfloating [_NBit1 , _NBit1 ]], other : _ArrayLikeComplex_co , / ) -> NDArray [complexfloating [_NBit1 , _NBit1 ]]: ...
@@ -2948,6 +2960,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
2948
2960
@overload
2949
2961
def __imod__ (self : NDArray [signedinteger [_NBit1 ]], other : _ArrayLikeInt_co , / ) -> NDArray [signedinteger [_NBit1 ]]: ...
2950
2962
@overload
2963
+ def __imod__ (self : NDArray [float64 ], other : _ArrayLikeFloat_co , / ) -> NDArray [float64 ]: ...
2964
+ @overload
2951
2965
def __imod__ (self : NDArray [floating [_NBit1 ]], other : _ArrayLikeFloat_co , / ) -> NDArray [floating [_NBit1 ]]: ...
2952
2966
@overload
2953
2967
def __imod__ (self : NDArray [timedelta64 ], other : _SupportsArray [_dtype [timedelta64 ]] | _NestedSequence [_SupportsArray [_dtype [timedelta64 ]]], / ) -> NDArray [timedelta64 ]: ...
@@ -3014,6 +3028,8 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType_co, _DType_co]):
3014
3028
@overload
3015
3029
def __imatmul__ (self : NDArray [signedinteger [_NBit1 ]], other : _ArrayLikeInt_co , / ) -> NDArray [signedinteger [_NBit1 ]]: ...
3016
3030
@overload
3031
+ def __imatmul__ (self : NDArray [float64 ], other : _ArrayLikeFloat_co , / ) -> NDArray [float64 ]: ...
3032
+ @overload
3017
3033
def __imatmul__ (self : NDArray [floating [_NBit1 ]], other : _ArrayLikeFloat_co , / ) -> NDArray [floating [_NBit1 ]]: ...
3018
3034
@overload
3019
3035
def __imatmul__ (self : NDArray [complexfloating [_NBit1 , _NBit1 ]], other : _ArrayLikeComplex_co , / ) -> NDArray [complexfloating [_NBit1 , _NBit1 ]]: ...
@@ -3525,21 +3541,10 @@ _IntType = TypeVar("_IntType", bound=integer[Any])
3525
3541
3526
3542
class floating (inexact [_NBit1 ]):
3527
3543
def __init__ (self , value : _FloatValue = ..., / ) -> None : ...
3528
- def item (
3529
- self , args : L [0 ] | tuple [()] | tuple [L [0 ]] = ...,
3530
- / ,
3531
- ) -> float : ...
3544
+ def item (self , args : L [0 ] | tuple [()] | tuple [L [0 ]] = ..., / ) -> float : ...
3532
3545
def tolist (self ) -> float : ...
3533
3546
def is_integer (self ) -> builtins .bool : ...
3534
- def hex (self : float64 ) -> str : ...
3535
- @classmethod
3536
- def fromhex (cls : type [float64 ], string : str , / ) -> float64 : ...
3537
3547
def as_integer_ratio (self ) -> tuple [int , int ]: ...
3538
- def __ceil__ (self : float64 ) -> int : ...
3539
- def __floor__ (self : float64 ) -> int : ...
3540
- def __trunc__ (self : float64 ) -> int : ...
3541
- def __getnewargs__ (self : float64 ) -> tuple [float ]: ...
3542
- def __getformat__ (self : float64 , typestr : L ["double" , "float" ], / ) -> str : ...
3543
3548
@overload
3544
3549
def __round__ (self , ndigits : None = ..., / ) -> int : ...
3545
3550
@overload
@@ -3563,7 +3568,107 @@ class floating(inexact[_NBit1]):
3563
3568
3564
3569
float16 : TypeAlias = floating [_16Bit ]
3565
3570
float32 : TypeAlias = floating [_32Bit ]
3566
- float64 : TypeAlias = floating [_64Bit ]
3571
+
3572
+ # NOTE: `_64Bit` is equivalent to `_64Bit | _32Bit | _16Bit | _8Bit`
3573
+ _Float64_co : TypeAlias = float | floating [_64Bit ] | integer [_64Bit ] | np .bool
3574
+
3575
+ # either a C `double`, `float`, or `longdouble`
3576
+ class float64 (floating [_64Bit ], float ): # type: ignore[misc]
3577
+ def __getformat__ (self , typestr : L ["double" , "float" ], / ) -> str : ...
3578
+ def __getnewargs__ (self , / ) -> tuple [float ]: ...
3579
+
3580
+ # overrides for `floating` and `builtins.float` compatibility
3581
+ @property
3582
+ def real (self ) -> Self : ...
3583
+ @property
3584
+ def imag (self ) -> Self : ...
3585
+ def conjugate (self ) -> Self : ...
3586
+
3587
+ # float64-specific operator overrides
3588
+ @overload
3589
+ def __add__ (self , other : _Float64_co , / ) -> float64 : ...
3590
+ @overload
3591
+ def __add__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3592
+ @overload
3593
+ def __add__ (self , other : complex , / ) -> float64 | complex128 : ...
3594
+ @overload
3595
+ def __radd__ (self , other : _Float64_co , / ) -> float64 : ...
3596
+ @overload
3597
+ def __radd__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3598
+ @overload
3599
+ def __radd__ (self , other : complex , / ) -> float64 | complex128 : ...
3600
+
3601
+ @overload
3602
+ def __sub__ (self , other : _Float64_co , / ) -> float64 : ...
3603
+ @overload
3604
+ def __sub__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3605
+ @overload
3606
+ def __sub__ (self , other : complex , / ) -> float64 | complex128 : ...
3607
+ @overload
3608
+ def __rsub__ (self , other : _Float64_co , / ) -> float64 : ...
3609
+ @overload
3610
+ def __rsub__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3611
+ @overload
3612
+ def __rsub__ (self , other : complex , / ) -> float64 | complex128 : ...
3613
+
3614
+ @overload
3615
+ def __mul__ (self , other : _Float64_co , / ) -> float64 : ...
3616
+ @overload
3617
+ def __mul__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3618
+ @overload
3619
+ def __mul__ (self , other : complex , / ) -> float64 | complex128 : ...
3620
+ @overload
3621
+ def __rmul__ (self , other : _Float64_co , / ) -> float64 : ...
3622
+ @overload
3623
+ def __rmul__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3624
+ @overload
3625
+ def __rmul__ (self , other : complex , / ) -> float64 | complex128 : ...
3626
+
3627
+ @overload
3628
+ def __truediv__ (self , other : _Float64_co , / ) -> float64 : ...
3629
+ @overload
3630
+ def __truediv__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3631
+ @overload
3632
+ def __truediv__ (self , other : complex , / ) -> float64 | complex128 : ...
3633
+ @overload
3634
+ def __rtruediv__ (self , other : _Float64_co , / ) -> float64 : ...
3635
+ @overload
3636
+ def __rtruediv__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3637
+ @overload
3638
+ def __rtruediv__ (self , other : complex , / ) -> float64 | complex128 : ...
3639
+
3640
+ @overload
3641
+ def __floordiv__ (self , other : _Float64_co , / ) -> float64 : ...
3642
+ @overload
3643
+ def __floordiv__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3644
+ @overload
3645
+ def __floordiv__ (self , other : complex , / ) -> float64 | complex128 : ...
3646
+ @overload
3647
+ def __rfloordiv__ (self , other : _Float64_co , / ) -> float64 : ...
3648
+ @overload
3649
+ def __rfloordiv__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3650
+ @overload
3651
+ def __rfloordiv__ (self , other : complex , / ) -> float64 | complex128 : ...
3652
+
3653
+ @overload
3654
+ def __pow__ (self , other : _Float64_co , / ) -> float64 : ...
3655
+ @overload
3656
+ def __pow__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3657
+ @overload
3658
+ def __pow__ (self , other : complex , / ) -> float64 | complex128 : ...
3659
+ @overload
3660
+ def __rpow__ (self , other : _Float64_co , / ) -> float64 : ...
3661
+ @overload
3662
+ def __rpow__ (self , other : complexfloating [_NBit1 , _NBit2 ], / ) -> complexfloating [_NBit1 | _64Bit , _NBit2 | _64Bit ]: ...
3663
+ @overload
3664
+ def __rpow__ (self , other : complex , / ) -> float64 | complex128 : ...
3665
+
3666
+ def __mod__ (self , other : _Float64_co , / ) -> float64 : ... # type: ignore[override]
3667
+ def __rmod__ (self , other : _Float64_co , / ) -> float64 : ... # type: ignore[override]
3668
+
3669
+ def __divmod__ (self , other : _Float64_co , / ) -> _2Tuple [float64 ]: ... # type: ignore[override]
3670
+ def __rdivmod__ (self , other : _Float64_co , / ) -> _2Tuple [float64 ]: ... # type: ignore[override]
3671
+
3567
3672
3568
3673
half : TypeAlias = floating [_NBitHalf ]
3569
3674
single : TypeAlias = floating [_NBitSingle ]
0 commit comments