Average Error: 7.8 → 0.0
Time: 22.4s
Precision: 64
$\left(-\left(\left(az - dz\right) - \frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right) - \left(bz - az\right)$
$\left(dz - \left(-\frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right) - bz$
\left(-\left(\left(az - dz\right) - \frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right) - \left(bz - az\right)
\left(dz - \left(-\frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right) - bz
double f(double az, double dz, double vz, double vx, double ax, double dx, double bz) {
double r2411767 = az;
double r2411768 = dz;
double r2411769 = r2411767 - r2411768;
double r2411770 = vz;
double r2411771 = vx;
double r2411772 = r2411770 / r2411771;
double r2411773 = ax;
double r2411774 = dx;
double r2411775 = r2411773 - r2411774;
double r2411776 = r2411772 * r2411775;
double r2411777 = r2411769 - r2411776;
double r2411778 = -r2411777;
double r2411779 = bz;
double r2411780 = r2411779 - r2411767;
double r2411781 = r2411778 - r2411780;
return r2411781;
}


double f(double __attribute__((unused)) az, double dz, double vz, double vx, double ax, double dx, double bz) {
double r2411782 = dz;
double r2411783 = vz;
double r2411784 = vx;
double r2411785 = r2411783 / r2411784;
double r2411786 = ax;
double r2411787 = dx;
double r2411788 = r2411786 - r2411787;
double r2411789 = r2411785 * r2411788;
double r2411790 = -r2411789;
double r2411791 = r2411782 - r2411790;
double r2411792 = bz;
double r2411793 = r2411791 - r2411792;
return r2411793;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 7.8

$\left(-\left(\left(az - dz\right) - \frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right) - \left(bz - az\right)$
2. Simplified5.3

$\leadsto \color{blue}{\left(az - \left(\left(az - dz\right) - \frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right) - bz}$
3. Using strategy rm
4. Applied sub-neg5.3

$\leadsto \left(az - \color{blue}{\left(\left(az - dz\right) + \left(-\frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right)}\right) - bz$
5. Applied associate--r+2.6

$\leadsto \color{blue}{\left(\left(az - \left(az - dz\right)\right) - \left(-\frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right)} - bz$
6. Simplified0.0

$\leadsto \left(\color{blue}{dz} - \left(-\frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right) - bz$
7. Final simplification0.0

$\leadsto \left(dz - \left(-\frac{vz}{vx} \cdot \left(ax - dx\right)\right)\right) - bz$

# Reproduce

herbie shell --seed 1
(FPCore (az dz vz vx ax dx bz)
:name "-((az - dz) - (vz/vx) * (ax - dx)) - (bz - az)"
:precision binary32
(- (- (- (- az dz) (* (/ vz vx) (- ax dx)))) (- bz az)))