Average Error: 8.4 → 4.6
Time: 4.5s
Precision: 64
Internal Precision: 576
\[\frac{x0}{1 - x1} - x0\]
\[\begin{array}{l} \mathbf{if}\;x1 \le 0.007025717773437499:\\ \;\;\;\;\sqrt{\frac{x0}{1 - x1} - x0} \cdot e^{\log \left(\log \left(e^{\sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\log \left(e^{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}\right)\right)}\\ \end{array}\]

Error

Bits error versus x0

Bits error versus x1

Target

Original8.4
Target0.5
Herbie4.6
\[\frac{x0 \cdot x1}{1 - x1}\]

Derivation

  1. Split input into 2 regimes
  2. if x1 < 0.007025717773437499

    1. Initial program 11.3

      \[\frac{x0}{1 - x1} - x0\]
    2. Initial simplification11.3

      \[\leadsto \frac{x0}{1 - x1} - x0\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt10.7

      \[\leadsto \color{blue}{\sqrt{\frac{x0}{1 - x1}} \cdot \sqrt{\frac{x0}{1 - x1}}} - x0\]
    5. Applied fma-neg11.6

      \[\leadsto \color{blue}{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}\]
    6. Using strategy rm
    7. Applied add-log-exp10.4

      \[\leadsto \color{blue}{\log \left(e^{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}\right)}\]
    8. Using strategy rm
    9. Applied add-exp-log10.4

      \[\leadsto \color{blue}{e^{\log \left(\log \left(e^{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}\right)\right)}}\]
    10. Using strategy rm
    11. Applied add-sqr-sqrt10.4

      \[\leadsto e^{\log \left(\log \left(e^{\color{blue}{\sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*} \cdot \sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}}}\right)\right)}\]
    12. Applied exp-prod10.4

      \[\leadsto e^{\log \left(\log \color{blue}{\left({\left(e^{\sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}}\right)}^{\left(\sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}\right)}\right)}\right)}\]
    13. Applied log-pow11.6

      \[\leadsto e^{\log \color{blue}{\left(\sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*} \cdot \log \left(e^{\sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}}\right)\right)}}\]
    14. Applied log-prod11.6

      \[\leadsto e^{\color{blue}{\log \left(\sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}\right) + \log \left(\log \left(e^{\sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}}\right)\right)}}\]
    15. Applied exp-sum11.6

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

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

    if 0.007025717773437499 < x1

    1. Initial program 5.5

      \[\frac{x0}{1 - x1} - x0\]
    2. Initial simplification5.5

      \[\leadsto \frac{x0}{1 - x1} - x0\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt4.4

      \[\leadsto \color{blue}{\sqrt{\frac{x0}{1 - x1}} \cdot \sqrt{\frac{x0}{1 - x1}}} - x0\]
    5. Applied fma-neg3.2

      \[\leadsto \color{blue}{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}\]
    6. Using strategy rm
    7. Applied add-log-exp1.6

      \[\leadsto \color{blue}{\log \left(e^{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}\right)}\]
    8. Using strategy rm
    9. Applied add-exp-log1.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \le 0.007025717773437499:\\ \;\;\;\;\sqrt{\frac{x0}{1 - x1} - x0} \cdot e^{\log \left(\log \left(e^{\sqrt{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\log \left(e^{(\left(\sqrt{\frac{x0}{1 - x1}}\right) \cdot \left(\sqrt{\frac{x0}{1 - x1}}\right) + \left(-x0\right))_*}\right)\right)}\\ \end{array}\]

Runtime

Time bar (total: 4.5s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes5.74.64.61.1100%
herbie shell --seed 2018340 +o rules:numerics
(FPCore (x0 x1)
  :name "(- (/ x0 (- 1 x1)) x0)"
  :pre (or (and (== x0 1.855) (== x1 0.000209)) (and (== x0 2.985) (== x1 0.0186)))

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

  (- (/ x0 (- 1 x1)) x0))