Skip to content

TYP: specialized float_power ufunc#31995

Merged
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/ufunc-21-float_power
Jul 15, 2026
Merged

TYP: specialized float_power ufunc#31995
charris merged 1 commit into
numpy:mainfrom
jorenham:typing/ufunc-21-float_power

Conversation

@jorenham

@jorenham jorenham commented Jul 14, 2026

Copy link
Copy Markdown
Member

Here's the typing specialization of the last "simple" binary (endo-)ufunc, float_power, over float64 | complex128 | longdouble | clongdouble. There are "only" 4*4 promotions to consider, so I added overloads for each of those, even for the funky open (non-closed) ones like longdouble * complex64 -> clongdouble.

promotion table:
        b8    i8    u8   i16   u16   i32   u32   i64   u64   f16   f32   f64   f80   c64  c128  c160
b8     f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
i8     f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
u8     f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
i16    f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
u16    f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
i32    f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
u32    f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
i64    f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
u64    f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
f16    f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
f32    f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
f64    f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f64   f80  c128  c128  c160
f80    f80   f80   f80   f80   f80   f80   f80   f80   f80   f80   f80   f80   f80  c160  c160  c160
c64   c128  c128  c128  c128  c128  c128  c128  c128  c128  c128  c128  c128  c160  c128  c128  c160
c128  c128  c128  c128  c128  c128  c128  c128  c128  c128  c128  c128  c128  c160  c128  c128  c160
c160  c160  c160  c160  c160  c160  c160  c160  c160  c160  c160  c160  c160  c160  c160  c160  c160

For context; these are the remaining ufuncs:

  • fmod
  • remainder
  • floor_divide
  • power
  • matmul, matvec, vecmat, vecdot
  • subtract
  • fmax / fmin
  • maximum, minimum
  • add
  • divmod

So we're at 85/100 type-specialized ufuncs currently (after this one).


No AI.

@jorenham jorenham added this to the 2.6.0 Release milestone Jul 14, 2026
@charris charris merged commit 5528ef8 into numpy:main Jul 15, 2026
14 checks passed
@charris

charris commented Jul 15, 2026

Copy link
Copy Markdown
Member

Thanks Joren.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants