Average Error: 8.4 → 2.7
Time: 2.8s
Precision: binary64
\[x0 = 1.855 \land x1 = 0.000209 \lor x0 = 2.985 \land x1 = 0.0186\]
\[\frac{x0}{1 - x1} - x0 \]
\[\begin{array}{l} \mathbf{if}\;1 - x1 \leq 0.9814:\\ \;\;\;\;\begin{array}{l} t_0 := \frac{\sqrt[3]{x0}}{1 - x1}\\ t_1 := \sqrt[3]{x0} \cdot \sqrt[3]{x0}\\ t_2 := t_0 \cdot t_0\\ \sqrt[3]{x0} \cdot \frac{\left(\sqrt{{t_0}^{3} - {\left(\sqrt[3]{x0}\right)}^{3}} \cdot {x0}^{0.16666666666666666}\right) \cdot \left({x0}^{0.16666666666666666} \cdot \sqrt{t_2 - t_1}\right)}{\sqrt{t_2 + \left(t_1 + \sqrt[3]{x0} \cdot t_0\right)} \cdot \sqrt{\sqrt[3]{x0} + t_0}} \end{array}\\ \mathbf{else}:\\ \;\;\;\;x0 \cdot \left(x1 + \left({x1}^{4} + \left({x1}^{3} + {x1}^{2}\right)\right)\right)\\ \end{array} \]
\frac{x0}{1 - x1} - x0
\begin{array}{l}
\mathbf{if}\;1 - x1 \leq 0.9814:\\
\;\;\;\;\begin{array}{l}
t_0 := \frac{\sqrt[3]{x0}}{1 - x1}\\
t_1 := \sqrt[3]{x0} \cdot \sqrt[3]{x0}\\
t_2 := t_0 \cdot t_0\\
\sqrt[3]{x0} \cdot \frac{\left(\sqrt{{t_0}^{3} - {\left(\sqrt[3]{x0}\right)}^{3}} \cdot {x0}^{0.16666666666666666}\right) \cdot \left({x0}^{0.16666666666666666} \cdot \sqrt{t_2 - t_1}\right)}{\sqrt{t_2 + \left(t_1 + \sqrt[3]{x0} \cdot t_0\right)} \cdot \sqrt{\sqrt[3]{x0} + t_0}}
\end{array}\\

\mathbf{else}:\\
\;\;\;\;x0 \cdot \left(x1 + \left({x1}^{4} + \left({x1}^{3} + {x1}^{2}\right)\right)\right)\\


\end{array}
(FPCore (x0 x1) :precision binary64 (- (/ x0 (- 1.0 x1)) x0))
(FPCore (x0 x1)
 :precision binary64
 (if (<= (- 1.0 x1) 0.9814)
   (let* ((t_0 (/ (cbrt x0) (- 1.0 x1)))
          (t_1 (* (cbrt x0) (cbrt x0)))
          (t_2 (* t_0 t_0)))
     (*
      (cbrt x0)
      (/
       (*
        (*
         (sqrt (- (pow t_0 3.0) (pow (cbrt x0) 3.0)))
         (pow x0 0.16666666666666666))
        (* (pow x0 0.16666666666666666) (sqrt (- t_2 t_1))))
       (* (sqrt (+ t_2 (+ t_1 (* (cbrt x0) t_0)))) (sqrt (+ (cbrt x0) t_0))))))
   (* x0 (+ x1 (+ (pow x1 4.0) (+ (pow x1 3.0) (pow x1 2.0)))))))
double code(double x0, double x1) {
	return (x0 / (1.0 - x1)) - x0;
}
double code(double x0, double x1) {
	double tmp;
	if ((1.0 - x1) <= 0.9814) {
		double t_0_1 = cbrt(x0) / (1.0 - x1);
		double t_1_2 = cbrt(x0) * cbrt(x0);
		double t_2_3 = t_0_1 * t_0_1;
		tmp = cbrt(x0) * (((sqrt(pow(t_0_1, 3.0) - pow(cbrt(x0), 3.0)) * pow(x0, 0.16666666666666666)) * (pow(x0, 0.16666666666666666) * sqrt(t_2_3 - t_1_2))) / (sqrt(t_2_3 + (t_1_2 + (cbrt(x0) * t_0_1))) * sqrt(cbrt(x0) + t_0_1)));
	} else {
		tmp = x0 * (x1 + (pow(x1, 4.0) + (pow(x1, 3.0) + pow(x1, 2.0))));
	}
	return tmp;
}

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.4
Target0.5
Herbie2.7
\[\frac{x0 \cdot x1}{1 - x1} \]

Derivation

  1. Split input into 2 regimes
  2. if (-.f64 1 x1) < 0.98140000000000005

    1. Initial program 5.5

      \[\frac{x0}{1 - x1} - x0 \]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary645.5

      \[\leadsto \frac{x0}{1 - x1} - \color{blue}{1 \cdot x0} \]
    4. Applied *-un-lft-identity_binary645.5

      \[\leadsto \color{blue}{1 \cdot \frac{x0}{1 - x1}} - 1 \cdot x0 \]
    5. Applied distribute-lft-out--_binary645.5

      \[\leadsto \color{blue}{1 \cdot \left(\frac{x0}{1 - x1} - x0\right)} \]
    6. Simplified4.4

      \[\leadsto 1 \cdot \color{blue}{\left(\left(\frac{1}{1 - x1} - 1\right) \cdot x0\right)} \]
    7. Using strategy rm
    8. Applied add-cube-cbrt_binary644.4

      \[\leadsto 1 \cdot \left(\left(\frac{1}{1 - x1} - 1\right) \cdot \color{blue}{\left(\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \sqrt[3]{x0}\right)}\right) \]
    9. Applied associate-*r*_binary644.5

      \[\leadsto 1 \cdot \color{blue}{\left(\left(\left(\frac{1}{1 - x1} - 1\right) \cdot \left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right)\right) \cdot \sqrt[3]{x0}\right)} \]
    10. Simplified2.6

      \[\leadsto 1 \cdot \left(\color{blue}{\left(\sqrt[3]{x0} \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}\right)\right)} \cdot \sqrt[3]{x0}\right) \]
    11. Using strategy rm
    12. Applied add-sqr-sqrt_binary642.6

      \[\leadsto 1 \cdot \left(\left(\sqrt[3]{x0} \cdot \color{blue}{\left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot \sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}}\right)}\right) \cdot \sqrt[3]{x0}\right) \]
    13. Applied add-sqr-sqrt_binary642.6

      \[\leadsto 1 \cdot \left(\left(\sqrt[3]{\color{blue}{\sqrt{x0} \cdot \sqrt{x0}}} \cdot \left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot \sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}}\right)\right) \cdot \sqrt[3]{x0}\right) \]
    14. Applied cbrt-prod_binary642.6

      \[\leadsto 1 \cdot \left(\left(\color{blue}{\left(\sqrt[3]{\sqrt{x0}} \cdot \sqrt[3]{\sqrt{x0}}\right)} \cdot \left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot \sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}}\right)\right) \cdot \sqrt[3]{x0}\right) \]
    15. Applied unswap-sqr_binary642.0

      \[\leadsto 1 \cdot \left(\color{blue}{\left(\left(\sqrt[3]{\sqrt{x0}} \cdot \sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}}\right) \cdot \left(\sqrt[3]{\sqrt{x0}} \cdot \sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}}\right)\right)} \cdot \sqrt[3]{x0}\right) \]
    16. Simplified2.0

      \[\leadsto 1 \cdot \left(\left(\color{blue}{\left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}\right)} \cdot \left(\sqrt[3]{\sqrt{x0}} \cdot \sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}}\right)\right) \cdot \sqrt[3]{x0}\right) \]
    17. Simplified2.0

      \[\leadsto 1 \cdot \left(\left(\left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}\right) \cdot \color{blue}{\left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}\right)}\right) \cdot \sqrt[3]{x0}\right) \]
    18. Using strategy rm
    19. Applied flip--_binary642.3

      \[\leadsto 1 \cdot \left(\left(\left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}\right) \cdot \left(\sqrt{\color{blue}{\frac{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0} \cdot \sqrt[3]{x0}}{\frac{\sqrt[3]{x0}}{1 - x1} + \sqrt[3]{x0}}}} \cdot {x0}^{0.16666666666666666}\right)\right) \cdot \sqrt[3]{x0}\right) \]
    20. Applied sqrt-div_binary642.3

      \[\leadsto 1 \cdot \left(\left(\left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}\right) \cdot \left(\color{blue}{\frac{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0} \cdot \sqrt[3]{x0}}}{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} + \sqrt[3]{x0}}}} \cdot {x0}^{0.16666666666666666}\right)\right) \cdot \sqrt[3]{x0}\right) \]
    21. Applied associate-*l/_binary642.3

      \[\leadsto 1 \cdot \left(\left(\left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}\right) \cdot \color{blue}{\frac{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0} \cdot \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}}{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} + \sqrt[3]{x0}}}}\right) \cdot \sqrt[3]{x0}\right) \]
    22. Applied flip3--_binary641.6

      \[\leadsto 1 \cdot \left(\left(\left(\sqrt{\color{blue}{\frac{{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}^{3} - {\left(\sqrt[3]{x0}\right)}^{3}}{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} + \left(\sqrt[3]{x0} \cdot \sqrt[3]{x0} + \frac{\sqrt[3]{x0}}{1 - x1} \cdot \sqrt[3]{x0}\right)}}} \cdot {x0}^{0.16666666666666666}\right) \cdot \frac{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0} \cdot \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}}{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} + \sqrt[3]{x0}}}\right) \cdot \sqrt[3]{x0}\right) \]
    23. Applied sqrt-div_binary641.6

      \[\leadsto 1 \cdot \left(\left(\left(\color{blue}{\frac{\sqrt{{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}^{3} - {\left(\sqrt[3]{x0}\right)}^{3}}}{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} + \left(\sqrt[3]{x0} \cdot \sqrt[3]{x0} + \frac{\sqrt[3]{x0}}{1 - x1} \cdot \sqrt[3]{x0}\right)}}} \cdot {x0}^{0.16666666666666666}\right) \cdot \frac{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0} \cdot \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}}{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} + \sqrt[3]{x0}}}\right) \cdot \sqrt[3]{x0}\right) \]
    24. Applied associate-*l/_binary641.6

      \[\leadsto 1 \cdot \left(\left(\color{blue}{\frac{\sqrt{{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}^{3} - {\left(\sqrt[3]{x0}\right)}^{3}} \cdot {x0}^{0.16666666666666666}}{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} + \left(\sqrt[3]{x0} \cdot \sqrt[3]{x0} + \frac{\sqrt[3]{x0}}{1 - x1} \cdot \sqrt[3]{x0}\right)}}} \cdot \frac{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0} \cdot \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}}{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} + \sqrt[3]{x0}}}\right) \cdot \sqrt[3]{x0}\right) \]
    25. Applied frac-times_binary641.6

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

    if 0.98140000000000005 < (-.f64 1 x1)

    1. Initial program 11.3

      \[\frac{x0}{1 - x1} - x0 \]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary6411.3

      \[\leadsto \frac{x0}{1 - x1} - \color{blue}{1 \cdot x0} \]
    4. Applied *-un-lft-identity_binary6411.3

      \[\leadsto \color{blue}{1 \cdot \frac{x0}{1 - x1}} - 1 \cdot x0 \]
    5. Applied distribute-lft-out--_binary6411.3

      \[\leadsto \color{blue}{1 \cdot \left(\frac{x0}{1 - x1} - x0\right)} \]
    6. Simplified10.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - x1 \leq 0.9814:\\ \;\;\;\;\sqrt[3]{x0} \cdot \frac{\left(\sqrt{{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}^{3} - {\left(\sqrt[3]{x0}\right)}^{3}} \cdot {x0}^{0.16666666666666666}\right) \cdot \left({x0}^{0.16666666666666666} \cdot \sqrt{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0} \cdot \sqrt[3]{x0}}\right)}{\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} \cdot \frac{\sqrt[3]{x0}}{1 - x1} + \left(\sqrt[3]{x0} \cdot \sqrt[3]{x0} + \sqrt[3]{x0} \cdot \frac{\sqrt[3]{x0}}{1 - x1}\right)} \cdot \sqrt{\sqrt[3]{x0} + \frac{\sqrt[3]{x0}}{1 - x1}}}\\ \mathbf{else}:\\ \;\;\;\;x0 \cdot \left(x1 + \left({x1}^{4} + \left({x1}^{3} + {x1}^{2}\right)\right)\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2021190 
(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))