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.00023680172729492185:\\ \;\;\;\;\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.00023680172729492185

    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.00023680172729492185 < 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.00023680172729492185:\\ \;\;\;\;\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 2019010 +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

sample4.0ms

Algorithm
sampled

simplify8.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
8.0ms
(- (/ x0 (- 1 x1)) x0)

prune2.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))

rewrite12.0ms

Algorithm
rewrite-expression-head
Rules
fma-neg
add-cube-cbrt
associate-/r/
*-un-lft-identity
add-sqr-sqrt
flip--
flip3--
associate-/r*
add-log-exp
div-inv
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
frac-2neg
sub-neg
clear-num
Counts
2 → 36
Calls
2 calls:
Slowest
10.0ms
(- (/ x0 (- 1 x1)) x0)
1.0ms
(/ x0 (- 1 x1))

series61.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
37.0ms
(- (/ x0 (- 1 x1)) x0)
24.0ms
(/ x0 (- 1 x1))

simplify1.3s

Counts
15 → 42
Calls
15 calls:
Slowest
806.0ms
(+ (* x0 (pow x1 3)) (+ (* x0 (pow x1 2)) (* x0 x1)))
176.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
59.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))
50.0ms
(- (+ x0 (+ (/ x0 x1) (/ x0 (pow x1 2)))))
49.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))

prune37.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
Rules
associate-/r*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-/r/
add-log-exp
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
flip--
div-inv
flip3--
frac-2neg
clear-num
fma-udef
Counts
3 → 44
Calls
3 calls:
Slowest
1.0ms
(/ x0 (- 1 x1))
1.0ms
(/ x0 (- 1 x1))
0.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))

series143.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
93.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))
26.0ms
(/ x0 (- 1 x1))
24.0ms
(/ x0 (- 1 x1))

simplify652.0ms

Counts
19 → 53
Calls
19 calls:
Slowest
173.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
154.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
80.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))
72.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))
52.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))

prune79.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 6.0b

localize0.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))

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-/r*
pow1
add-log-exp
log1p-expm1-u
log-pow
associate-/r/
add-exp-log
add-cbrt-cube
log-prod
expm1-log1p-u
exp-prod
flip--
div-inv
fma-udef
flip3--
frac-2neg
clear-num
exp-sum
rem-log-exp
Counts
4 → 62
Calls
4 calls:
Slowest
2.0ms
(log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))
0.0ms
(/ x0 (- 1 x1))
0.0ms
(/ x0 (- 1 x1))
0.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))

series217.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
87.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))
78.0ms
(log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))
27.0ms
(/ x0 (- 1 x1))
25.0ms
(/ x0 (- 1 x1))

simplify690.0ms

Counts
30 → 74
Calls
30 calls:
Slowest
165.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
135.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
83.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))
55.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))
46.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))

prune125.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))

rewrite9.0ms

Algorithm
rewrite-expression-head
Rules
11×log-prod
10×add-cube-cbrt
10×*-un-lft-identity
10×exp-prod
10×add-sqr-sqrt
log-pow
exp-sum
pow1
add-log-exp
log1p-expm1-u
add-exp-log
add-cbrt-cube
expm1-log1p-u
associate-/r*
fma-udef
associate-/r/
rem-exp-log
flip--
div-inv
rem-log-exp
flip3--
frac-2neg
clear-num
Counts
4 → 66
Calls
4 calls:
Slowest
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))))
0.0ms
(/ x0 (- 1 x1))
0.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))

series306.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
112.0ms
(exp (log (log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))))
86.0ms
(log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))
84.0ms
(fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))
24.0ms
(/ x0 (- 1 x1))

simplify608.0ms

Counts
37 → 78
Calls
37 calls:
Slowest
129.0ms
(+ x0 (+ (* x0 x1) (* x0 (pow x1 2))))
82.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))
56.0ms
(- (+ (/ x0 (pow x1 3)) (+ (/ x0 (pow x1 2)) (/ x0 x1))))
54.0ms
(exp (sqrt (log (log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0)))))))
47.0ms
(exp (* (cbrt (log (log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0)))))) (cbrt (log (log (exp (fma (sqrt (/ x0 (- 1 x1))) (sqrt (/ x0 (- 1 x1))) (- x0))))))))

prune202.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 4.6b

regimes14.0ms

Accuracy

100% (0.0b remaining)

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

bsearch51.0ms

end0.0ms

sample1.0ms

Algorithm
sampled