Average Error: 8.3 → 3.3
Time: 5.3s
Precision: binary64
\[x0 = 1.855 \land x1 = 2.09000000000000012 \cdot 10^{-4} \lor x0 = 2.98499999999999988 \land x1 = 0.018599999999999998\]
\[\frac{x0}{1 - x1} - x0\]
\[\begin{array}{l} \mathbf{if}\;x1 \le 2.12089080810546861 \cdot 10^{-4}:\\ \;\;\;\;\frac{x0 \cdot \left(2 \cdot \log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right) + \log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right)\right)}{\frac{x0}{1 - x1} + x0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x0 \cdot \log \left(e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}\right)}{\frac{1}{\frac{1 - x1}{x0}} + x0}\\ \end{array}\]
\frac{x0}{1 - x1} - x0
\begin{array}{l}
\mathbf{if}\;x1 \le 2.12089080810546861 \cdot 10^{-4}:\\
\;\;\;\;\frac{x0 \cdot \left(2 \cdot \log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right) + \log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right)\right)}{\frac{x0}{1 - x1} + x0}\\

\mathbf{else}:\\
\;\;\;\;\frac{x0 \cdot \log \left(e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}\right)}{\frac{1}{\frac{1 - x1}{x0}} + x0}\\

\end{array}
double code(double x0, double x1) {
	return ((double) ((x0 / ((double) (1.0 - x1))) - x0));
}
double code(double x0, double x1) {
	double VAR;
	if ((x1 <= 0.00021208908081054686)) {
		VAR = (((double) (x0 * ((double) (((double) (2.0 * ((double) log(((double) cbrt(((double) exp(((double) ((x0 / ((double) (((double) (x1 * ((double) (x1 - 2.0)))) + 1.0))) - x0)))))))))) + ((double) log(((double) cbrt(((double) exp(((double) ((x0 / ((double) (((double) (x1 * ((double) (x1 - 2.0)))) + 1.0))) - x0)))))))))))) / ((double) ((x0 / ((double) (1.0 - x1))) + x0)));
	} else {
		VAR = (((double) (x0 * ((double) log(((double) exp(((double) ((x0 / ((double) (((double) (x1 * ((double) (x1 - 2.0)))) + 1.0))) - x0)))))))) / ((double) ((1.0 / (((double) (1.0 - x1)) / x0)) + x0)));
	}
	return VAR;
}

Error

Bits error versus x0

Bits error versus x1

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original8.3
Target0.5
Herbie3.3
\[\frac{x0 \cdot x1}{1 - x1}\]

Derivation

  1. Split input into 2 regimes
  2. if x1 < 2.12089080810546861e-4

    1. Initial program 11.3

      \[\frac{x0}{1 - x1} - x0\]
    2. Using strategy rm
    3. Applied flip--11.4

      \[\leadsto \color{blue}{\frac{\frac{x0}{1 - x1} \cdot \frac{x0}{1 - x1} - x0 \cdot x0}{\frac{x0}{1 - x1} + x0}}\]
    4. Simplified9.1

      \[\leadsto \frac{\color{blue}{x0 \cdot \left(\frac{x0}{\left(1 - x1\right) \cdot \left(1 - x1\right)} - x0\right)}}{\frac{x0}{1 - x1} + x0}\]
    5. Taylor expanded around 0 11.3

      \[\leadsto \frac{x0 \cdot \left(\frac{x0}{\color{blue}{\left(1 + {x1}^{2}\right) - 2 \cdot x1}} - x0\right)}{\frac{x0}{1 - x1} + x0}\]
    6. Simplified9.1

      \[\leadsto \frac{x0 \cdot \left(\frac{x0}{\color{blue}{x1 \cdot \left(x1 - 2\right) + 1}} - x0\right)}{\frac{x0}{1 - x1} + x0}\]
    7. Using strategy rm
    8. Applied add-log-exp9.1

      \[\leadsto \frac{x0 \cdot \left(\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - \color{blue}{\log \left(e^{x0}\right)}\right)}{\frac{x0}{1 - x1} + x0}\]
    9. Applied add-log-exp9.1

      \[\leadsto \frac{x0 \cdot \left(\color{blue}{\log \left(e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1}}\right)} - \log \left(e^{x0}\right)\right)}{\frac{x0}{1 - x1} + x0}\]
    10. Applied diff-log8.9

      \[\leadsto \frac{x0 \cdot \color{blue}{\log \left(\frac{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1}}}{e^{x0}}\right)}}{\frac{x0}{1 - x1} + x0}\]
    11. Simplified8.9

      \[\leadsto \frac{x0 \cdot \log \color{blue}{\left(e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}\right)}}{\frac{x0}{1 - x1} + x0}\]
    12. Using strategy rm
    13. Applied add-cube-cbrt10.6

      \[\leadsto \frac{x0 \cdot \log \color{blue}{\left(\left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}} \cdot \sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right) \cdot \sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right)}}{\frac{x0}{1 - x1} + x0}\]
    14. Applied log-prod9.9

      \[\leadsto \frac{x0 \cdot \color{blue}{\left(\log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}} \cdot \sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right) + \log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right)\right)}}{\frac{x0}{1 - x1} + x0}\]
    15. Simplified6.6

      \[\leadsto \frac{x0 \cdot \left(\color{blue}{2 \cdot \log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right)} + \log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right)\right)}{\frac{x0}{1 - x1} + x0}\]

    if 2.12089080810546861e-4 < x1

    1. Initial program 5.5

      \[\frac{x0}{1 - x1} - x0\]
    2. Using strategy rm
    3. Applied flip--4.0

      \[\leadsto \color{blue}{\frac{\frac{x0}{1 - x1} \cdot \frac{x0}{1 - x1} - x0 \cdot x0}{\frac{x0}{1 - x1} + x0}}\]
    4. Simplified4.7

      \[\leadsto \frac{\color{blue}{x0 \cdot \left(\frac{x0}{\left(1 - x1\right) \cdot \left(1 - x1\right)} - x0\right)}}{\frac{x0}{1 - x1} + x0}\]
    5. Taylor expanded around 0 2.8

      \[\leadsto \frac{x0 \cdot \left(\frac{x0}{\color{blue}{\left(1 + {x1}^{2}\right) - 2 \cdot x1}} - x0\right)}{\frac{x0}{1 - x1} + x0}\]
    6. Simplified2.8

      \[\leadsto \frac{x0 \cdot \left(\frac{x0}{\color{blue}{x1 \cdot \left(x1 - 2\right) + 1}} - x0\right)}{\frac{x0}{1 - x1} + x0}\]
    7. Using strategy rm
    8. Applied add-log-exp2.8

      \[\leadsto \frac{x0 \cdot \left(\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - \color{blue}{\log \left(e^{x0}\right)}\right)}{\frac{x0}{1 - x1} + x0}\]
    9. Applied add-log-exp2.8

      \[\leadsto \frac{x0 \cdot \left(\color{blue}{\log \left(e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1}}\right)} - \log \left(e^{x0}\right)\right)}{\frac{x0}{1 - x1} + x0}\]
    10. Applied diff-log3.9

      \[\leadsto \frac{x0 \cdot \color{blue}{\log \left(\frac{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1}}}{e^{x0}}\right)}}{\frac{x0}{1 - x1} + x0}\]
    11. Simplified1.0

      \[\leadsto \frac{x0 \cdot \log \color{blue}{\left(e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}\right)}}{\frac{x0}{1 - x1} + x0}\]
    12. Using strategy rm
    13. Applied clear-num0

      \[\leadsto \frac{x0 \cdot \log \left(e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}\right)}{\color{blue}{\frac{1}{\frac{1 - x1}{x0}}} + x0}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \le 2.12089080810546861 \cdot 10^{-4}:\\ \;\;\;\;\frac{x0 \cdot \left(2 \cdot \log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right) + \log \left(\sqrt[3]{e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}}\right)\right)}{\frac{x0}{1 - x1} + x0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x0 \cdot \log \left(e^{\frac{x0}{x1 \cdot \left(x1 - 2\right) + 1} - x0}\right)}{\frac{1}{\frac{1 - x1}{x0}} + x0}\\ \end{array}\]

Reproduce

herbie shell --seed 2020182 
(FPCore (x0 x1)
  :name "(- (/ x0 (- 1 x1)) x0)"
  :precision binary64
  :pre (or (and (== x0 1.855) (== x1 0.000209)) (and (== x0 2.985) (== x1 0.0186)))

  :herbie-target
  (/ (* x0 x1) (- 1.0 x1))

  (- (/ x0 (- 1.0 x1)) x0))