Average Error: 3.1 → 2.9
Time: 27.7s
Precision: 64
$\left(-\left(df_sum \cdot dRho + \left(z2p \cdot \frac{1.0}{\sqrt{dist}} - \left(z2 \cdot \frac{1.0}{\sqrt{dist}}\right) \cdot \frac{1.0}{\sqrt{dist}}\right)\right)\right) \cdot \frac{1.0}{\sqrt{dist}}$
$\frac{\left(-\left(dRho \cdot df_sum + \left(z2p \cdot \frac{1.0}{\sqrt{dist}} - 1.0 \cdot \frac{z2}{dist}\right)\right)\right) \cdot 1.0}{\sqrt{dist}}$
\left(-\left(df_sum \cdot dRho + \left(z2p \cdot \frac{1.0}{\sqrt{dist}} - \left(z2 \cdot \frac{1.0}{\sqrt{dist}}\right) \cdot \frac{1.0}{\sqrt{dist}}\right)\right)\right) \cdot \frac{1.0}{\sqrt{dist}}
\frac{\left(-\left(dRho \cdot df_sum + \left(z2p \cdot \frac{1.0}{\sqrt{dist}} - 1.0 \cdot \frac{z2}{dist}\right)\right)\right) \cdot 1.0}{\sqrt{dist}}
double f(double df_sum, double dRho, double z2p, double dist, double z2) {
double r25776842 = df_sum;
double r25776843 = dRho;
double r25776844 = r25776842 * r25776843;
double r25776845 = z2p;
double r25776846 = 1.0;
double r25776847 = dist;
double r25776848 = sqrt(r25776847);
double r25776849 = r25776846 / r25776848;
double r25776850 = r25776845 * r25776849;
double r25776851 = z2;
double r25776852 = r25776851 * r25776849;
double r25776853 = r25776852 * r25776849;
double r25776854 = r25776850 - r25776853;
double r25776855 = r25776844 + r25776854;
double r25776856 = -r25776855;
double r25776857 = r25776856 * r25776849;
return r25776857;
}


double f(double df_sum, double dRho, double z2p, double dist, double z2) {
double r25776858 = dRho;
double r25776859 = df_sum;
double r25776860 = r25776858 * r25776859;
double r25776861 = z2p;
double r25776862 = 1.0;
double r25776863 = dist;
double r25776864 = sqrt(r25776863);
double r25776865 = r25776862 / r25776864;
double r25776866 = r25776861 * r25776865;
double r25776867 = z2;
double r25776868 = r25776867 / r25776863;
double r25776869 = r25776862 * r25776868;
double r25776870 = r25776866 - r25776869;
double r25776871 = r25776860 + r25776870;
double r25776872 = -r25776871;
double r25776873 = r25776872 * r25776862;
double r25776874 = r25776873 / r25776864;
return r25776874;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 3.1

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

$\leadsto \left(-\left(df_sum \cdot dRho + \left(z2p \cdot \frac{1.0}{\sqrt{dist}} - \color{blue}{1.0 \cdot \frac{z2}{dist}}\right)\right)\right) \cdot \frac{1.0}{\sqrt{dist}}$
3. Using strategy rm
4. Applied associate-*r/2.9

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

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

# Reproduce

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