… | |
… | |
445 | { |
445 | { |
446 | while (op) |
446 | while (op) |
447 | { |
447 | { |
448 | // adjust by actual difference to account for rounding errors |
448 | // adjust by actual difference to account for rounding errors |
449 | // i.e. (w2 - w1) / f != w2 / f - w1 / f and the latter is correct |
449 | // i.e. (w2 - w1) / f != w2 / f - w1 / f and the latter is correct |
450 | weight = weight_adjust_for (op, op->carrying) |
450 | weight = weight_adjust_for (op, op->carrying + weight) |
451 | - weight_adjust_for (op, op->carrying - weight); |
451 | - weight_adjust_for (op, op->carrying); |
452 | |
452 | |
453 | if (!weight) |
453 | if (!weight) |
454 | return; |
454 | return; |
455 | |
455 | |
456 | op->carrying += weight; |
456 | op->carrying += weight; |