python / python/cpython

math.sumprod() missing one case for combined int/float inputs.

Aperta
#139,074 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@rhettinger ci sta già lavorando.

Dal 17/9/2025.

extension-modules type-bug
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Bug report

Bug description:

The sumprod function has high precision paths for int/int, int/float, and float/float inputs. However it missed a case when an int/int pair follows another pair that contained a float. In other words, it assumes that once a float is encountered, that subsequent inputs won't contain a pair of ints.

>>> import math
>>> data = [-0.01, 1, -1, 0.01]
>>> math.sumprod(data,  [1, 1, 1, 1])
-8.673617379884035e-18
>>> math.sumprod(data,  [1.0, 1.0, 1.0, 1.0])
0.0
CPython versions tested on:

3.13, 3.15, 3.14

Operating systems tested on:

macOS

Linked PRs
  • gh-139075
  • gh-139085
  • gh-139086
  • gh-139092

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.