Average Error: 8.6 → 8.5
Time: 34.8s
Precision: 64
$\left(-\left(\left(df_sum \cdot dRho + z2p \cdot \frac{1.0}{\sqrt{dist}}\right) - \left(z2 \cdot \frac{1.0}{\sqrt{dist}}\right) \cdot \frac{1.0}{\sqrt{dist}}\right)\right) \cdot recip$
$\left(-\left(\left(dRho \cdot df_sum + \left(\sqrt{\frac{1.0}{\sqrt{dist}}} \cdot z2p\right) \cdot \sqrt{\frac{1.0}{\sqrt{dist}}}\right) - 1.0 \cdot \frac{z2}{dist}\right)\right) \cdot recip$
\left(-\left(\left(df_sum \cdot dRho + z2p \cdot \frac{1.0}{\sqrt{dist}}\right) - \left(z2 \cdot \frac{1.0}{\sqrt{dist}}\right) \cdot \frac{1.0}{\sqrt{dist}}\right)\right) \cdot recip
\left(-\left(\left(dRho \cdot df_sum + \left(\sqrt{\frac{1.0}{\sqrt{dist}}} \cdot z2p\right) \cdot \sqrt{\frac{1.0}{\sqrt{dist}}}\right) - 1.0 \cdot \frac{z2}{dist}\right)\right) \cdot recip
double f(double df_sum, double dRho, double z2p, double dist, double z2, double recip) {
double r25279754 = df_sum;
double r25279755 = dRho;
double r25279756 = r25279754 * r25279755;
double r25279757 = z2p;
double r25279758 = 1.0;
double r25279759 = dist;
double r25279760 = sqrt(r25279759);
double r25279761 = r25279758 / r25279760;
double r25279762 = r25279757 * r25279761;
double r25279763 = r25279756 + r25279762;
double r25279764 = z2;
double r25279765 = r25279764 * r25279761;
double r25279766 = r25279765 * r25279761;
double r25279767 = r25279763 - r25279766;
double r25279768 = -r25279767;
double r25279769 = recip;
double r25279770 = r25279768 * r25279769;
return r25279770;
}

double f(double df_sum, double dRho, double z2p, double dist, double z2, double recip) {
double r25279771 = dRho;
double r25279772 = df_sum;
double r25279773 = r25279771 * r25279772;
double r25279774 = 1.0;
double r25279775 = dist;
double r25279776 = sqrt(r25279775);
double r25279777 = r25279774 / r25279776;
double r25279778 = sqrt(r25279777);
double r25279779 = z2p;
double r25279780 = r25279778 * r25279779;
double r25279781 = r25279780 * r25279778;
double r25279782 = r25279773 + r25279781;
double r25279783 = z2;
double r25279784 = r25279783 / r25279775;
double r25279785 = r25279774 * r25279784;
double r25279786 = r25279782 - r25279785;
double r25279787 = -r25279786;
double r25279788 = recip;
double r25279789 = r25279787 * r25279788;
return r25279789;
}

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 8.6

$\left(-\left(\left(df_sum \cdot dRho + z2p \cdot \frac{1.0}{\sqrt{dist}}\right) - \left(z2 \cdot \frac{1.0}{\sqrt{dist}}\right) \cdot \frac{1.0}{\sqrt{dist}}\right)\right) \cdot recip$
2. Taylor expanded around 0 8.4

$\leadsto \left(-\left(\left(df_sum \cdot dRho + z2p \cdot \frac{1.0}{\sqrt{dist}}\right) - \color{blue}{1.0 \cdot \frac{z2}{dist}}\right)\right) \cdot recip$
3. Using strategy rm

$\leadsto \left(-\left(\left(df_sum \cdot dRho + z2p \cdot \color{blue}{\left(\sqrt{\frac{1.0}{\sqrt{dist}}} \cdot \sqrt{\frac{1.0}{\sqrt{dist}}}\right)}\right) - 1.0 \cdot \frac{z2}{dist}\right)\right) \cdot recip$
5. Applied associate-*r*8.5

$\leadsto \left(-\left(\left(df_sum \cdot dRho + \color{blue}{\left(z2p \cdot \sqrt{\frac{1.0}{\sqrt{dist}}}\right) \cdot \sqrt{\frac{1.0}{\sqrt{dist}}}}\right) - 1.0 \cdot \frac{z2}{dist}\right)\right) \cdot recip$
6. Final simplification8.5

$\leadsto \left(-\left(\left(dRho \cdot df_sum + \left(\sqrt{\frac{1.0}{\sqrt{dist}}} \cdot z2p\right) \cdot \sqrt{\frac{1.0}{\sqrt{dist}}}\right) - 1.0 \cdot \frac{z2}{dist}\right)\right) \cdot recip$

# Reproduce

herbie shell --seed 1
(FPCore (df_sum dRho z2p dist z2 recip)
:name "-(df_sum * dRho + z2p * (1.0 / sqrt(dist))- z2 * (1.0 / sqrt(dist))* (1.0 / sqrt(dist))) * recip"
(* (- (- (+ (* df_sum dRho) (* z2p (/ 1.0 (sqrt dist)))) (* (* z2 (/ 1.0 (sqrt dist))) (/ 1.0 (sqrt dist))))) recip))