Average Error: 8.4 → 4.6
Time: 4.5s
Precision: 64
Internal Precision: 128
\[\frac{x0}{1 - x1} - x0\]
\[\begin{array}{l} \mathbf{if}\;x1 \le 0.0009911633300781248:\\ \;\;\;\;\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.0009911633300781248

    1. Initial program 11.3

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

      \[\leadsto \color{blue}{\sqrt{\frac{x0}{1 - x1}} \cdot \sqrt{\frac{x0}{1 - x1}}} - x0\]
    4. 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))_*}\]
    5. Using strategy rm
    6. 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)}\]
    7. Using strategy rm
    8. 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)}}\]
    9. Using strategy rm
    10. 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)}\]
    11. 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)}\]
    12. 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)}}\]
    13. 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)}}\]
    14. 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)}}\]
    15. 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.0009911633300781248 < x1

    1. Initial program 5.5

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

      \[\leadsto \color{blue}{\sqrt{\frac{x0}{1 - x1}} \cdot \sqrt{\frac{x0}{1 - x1}}} - x0\]
    4. 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))_*}\]
    5. Using strategy rm
    6. 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)}\]
    7. Using strategy rm
    8. 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.0009911633300781248:\\ \;\;\;\;\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}\]

Reproduce

herbie shell --seed 2019005 +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))

Details

Time bar (total: 4.5s)Debug log

sample2.0ms

Algorithm
sampled

simplify4.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

4.0ms
(- (/ x0 (- 1 x1)) x0)

prune1.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 8.4b

localize0.0ms

Local error

Found 2 expressions with local error:

7.5b
(- (/ x0 (- 1 x1)) x0)
1.0b
(/ x0 (- 1 x1))

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
2 → 36
Calls

2 calls. Slowest were:

5.0ms
(- (/ x0 (- 1 x1)) x0)
0.0ms
(/ x0 (- 1 x1))

series48.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

24.0ms
(/ x0 (- 1 x1))
24.0ms
(- (/ x0 (- 1 x1)) x0)

simplify1.1s

Counts
15 → 42
Calls

15 calls. Slowest were:

779.0ms
(+ (* x0 (pow x1 3)) (+ (* x0 (pow x1 2)) (* x0 x1)))
113.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
56.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))

prune62.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 6.8b

localize1.0ms

Local error

Found 3 expressions with local error:

7.4b
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))
1.0b
(/ x0 (- 1 x1))
1.0b
(/ x0 (- 1 x1))

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
3 → 44
Calls

3 calls. Slowest were:

1.0ms
(/ x0 (- 1 x1))
1.0ms
(/ x0 (- 1 x1))
0.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))

series154.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

105.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))
25.0ms
(/ x0 (- 1 x1))
24.0ms
(/ x0 (- 1 x1))

simplify651.0ms

Counts
19 → 53
Calls

19 calls. Slowest were:

169.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
127.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
85.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))

prune103.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 6.0b

localize1.0ms

Local error

Found 4 expressions with local error:

7.4b
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))
6.0b
(log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))
1.0b
(/ x0 (- 1 x1))
1.0b
(/ x0 (- 1 x1))

rewrite7.0ms

Algorithm
rewrite-expression-head
Counts
4 → 62
Calls

4 calls. Slowest were:

4.0ms
(log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))
1.0ms
(/ x0 (- 1 x1))
1.0ms
(/ x0 (- 1 x1))

series210.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

103.0ms
(log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))
77.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))
15.0ms
(/ x0 (- 1 x1))
15.0ms
(/ x0 (- 1 x1))

simplify608.0ms

Counts
30 → 74
Calls

30 calls. Slowest were:

107.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
96.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
58.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))

prune151.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 4.6b

localize1.0ms

Local error

Found 4 expressions with local error:

7.4b
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))
6.0b
(log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))
1.0b
(exp (log (log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))))
1.0b
(/ x0 (- 1 x1))

rewrite10.0ms

Algorithm
rewrite-expression-head
Counts
4 → 66
Calls

4 calls. Slowest were:

4.0ms
(exp (log (log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))))
4.0ms
(log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))
1.0ms
(/ x0 (- 1 x1))

series312.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

109.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))
93.0ms
(exp (log (log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))))
85.0ms
(log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))
24.0ms
(/ x0 (- 1 x1))

simplify731.0ms

Counts
37 → 78
Calls

37 calls. Slowest were:

168.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
86.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))
85.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))

prune230.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 4.6b

regimes9.0ms

Accuracy

100% (0.0b remaining)

Error of 4.6b against oracle of 4.6b and baseline of 5.7b

bsearch36.0ms

end0.0ms

sample1.0ms

Algorithm
sampled