Il Java le librerie usano questo metodo:

total = total * costante + valore[x]