Average Error: 8.3 → 2.4
Time: 2.9s
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 := \sqrt[3]{{x0}^{0.16666666666666666}}\\ t_1 := \sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}}\\ \sqrt[3]{x0} \cdot \left(\left(t_0 \cdot \left(t_1 \cdot \left(t_0 \cdot t_0\right)\right)\right) \cdot \left(t_1 \cdot {x0}^{0.16666666666666666}\right)\right) \end{array}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{x0} \cdot \left(\sqrt[3]{x0} \cdot \left(x1 \cdot {x0}^{0.3333333333333333} + \left({x0}^{0.3333333333333333} \cdot {x1}^{4} + \left({x0}^{0.3333333333333333} \cdot {x1}^{2} + {x0}^{0.3333333333333333} \cdot {x1}^{3}\right)\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 := \sqrt[3]{{x0}^{0.16666666666666666}}\\
t_1 := \sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}}\\
\sqrt[3]{x0} \cdot \left(\left(t_0 \cdot \left(t_1 \cdot \left(t_0 \cdot t_0\right)\right)\right) \cdot \left(t_1 \cdot {x0}^{0.16666666666666666}\right)\right)
\end{array}\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{x0} \cdot \left(\sqrt[3]{x0} \cdot \left(x1 \cdot {x0}^{0.3333333333333333} + \left({x0}^{0.3333333333333333} \cdot {x1}^{4} + \left({x0}^{0.3333333333333333} \cdot {x1}^{2} + {x0}^{0.3333333333333333} \cdot {x1}^{3}\right)\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 (pow x0 0.16666666666666666)))
          (t_1 (sqrt (- (/ (cbrt x0) (- 1.0 x1)) (cbrt x0)))))
     (*
      (cbrt x0)
      (* (* t_0 (* t_1 (* t_0 t_0))) (* t_1 (pow x0 0.16666666666666666)))))
   (*
    (cbrt x0)
    (*
     (cbrt x0)
     (+
      (* x1 (pow x0 0.3333333333333333))
      (+
       (* (pow x0 0.3333333333333333) (pow x1 4.0))
       (+
        (* (pow x0 0.3333333333333333) (pow x1 2.0))
        (* (pow x0 0.3333333333333333) (pow x1 3.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(pow(x0, 0.16666666666666666));
		double t_1_2 = sqrt((cbrt(x0) / (1.0 - x1)) - cbrt(x0));
		tmp = cbrt(x0) * ((t_0_1 * (t_1_2 * (t_0_1 * t_0_1))) * (t_1_2 * pow(x0, 0.16666666666666666)));
	} else {
		tmp = cbrt(x0) * (cbrt(x0) * ((x1 * pow(x0, 0.3333333333333333)) + ((pow(x0, 0.3333333333333333) * pow(x1, 4.0)) + ((pow(x0, 0.3333333333333333) * pow(x1, 2.0)) + (pow(x0, 0.3333333333333333) * pow(x1, 3.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.3
Target0.5
Herbie2.4
\[\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 add-cube-cbrt_binary641.0

      \[\leadsto 1 \cdot \left(\left(\left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot \color{blue}{\left(\left(\sqrt[3]{{x0}^{0.16666666666666666}} \cdot \sqrt[3]{{x0}^{0.16666666666666666}}\right) \cdot \sqrt[3]{{x0}^{0.16666666666666666}}\right)}\right) \cdot \left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}\right)\right) \cdot \sqrt[3]{x0}\right) \]
    20. Applied associate-*r*_binary641.0

      \[\leadsto 1 \cdot \left(\left(\color{blue}{\left(\left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot \left(\sqrt[3]{{x0}^{0.16666666666666666}} \cdot \sqrt[3]{{x0}^{0.16666666666666666}}\right)\right) \cdot \sqrt[3]{{x0}^{0.16666666666666666}}\right)} \cdot \left(\sqrt{\frac{\sqrt[3]{x0}}{1 - x1} - \sqrt[3]{x0}} \cdot {x0}^{0.16666666666666666}\right)\right) \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. Using strategy rm
    8. Applied add-cube-cbrt_binary6410.5

      \[\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*_binary6410.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. Simplified10.2

      \[\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. Taylor expanded around 0 3.8

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

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

Reproduce

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