Average Error: 30.1 → 30.0
Time: 15.7s
Precision: 64
Internal Precision: 128
\[\sqrt{x + 1} - \sqrt{x}\]
\[e^{\log \left((\left(\left|\sqrt[3]{x + 1}\right|\right) \cdot \left(\sqrt{\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{x + 1}} \cdot \sqrt[3]{\sqrt[3]{x + 1}}} \cdot \left(\sqrt[3]{\sqrt[3]{\sqrt[3]{x + 1}} \cdot \sqrt[3]{\sqrt[3]{x + 1}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{x + 1}} \cdot \sqrt[3]{\sqrt[3]{x + 1}}}\right)\right) \cdot \sqrt[3]{\sqrt[3]{x + 1}}}\right) + \left(-\sqrt{x}\right))_*\right)}\]

Error

Bits error versus x

Target

Original30.1
Target0.2
Herbie30.0
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]

Derivation

  1. Initial program 30.1

    \[\sqrt{x + 1} - \sqrt{x}\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt30.2

    \[\leadsto \sqrt{x + 1} - \color{blue}{\sqrt{\sqrt{x}} \cdot \sqrt{\sqrt{x}}}\]
  4. Applied add-cube-cbrt30.1

    \[\leadsto \sqrt{\color{blue}{\left(\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right) \cdot \sqrt[3]{x + 1}}} - \sqrt{\sqrt{x}} \cdot \sqrt{\sqrt{x}}\]
  5. Applied sqrt-prod30.1

    \[\leadsto \color{blue}{\sqrt{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \cdot \sqrt{\sqrt[3]{x + 1}}} - \sqrt{\sqrt{x}} \cdot \sqrt{\sqrt{x}}\]
  6. Applied prod-diff30.1

    \[\leadsto \color{blue}{(\left(\sqrt{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}\right) \cdot \left(\sqrt{\sqrt[3]{x + 1}}\right) + \left(-\sqrt{\sqrt{x}} \cdot \sqrt{\sqrt{x}}\right))_* + (\left(-\sqrt{\sqrt{x}}\right) \cdot \left(\sqrt{\sqrt{x}}\right) + \left(\sqrt{\sqrt{x}} \cdot \sqrt{\sqrt{x}}\right))_*}\]
  7. Simplified30.1

    \[\leadsto \color{blue}{(\left(\left|\sqrt[3]{1 + x}\right|\right) \cdot \left(\sqrt{\sqrt[3]{1 + x}}\right) + \left(-\sqrt{x}\right))_*} + (\left(-\sqrt{\sqrt{x}}\right) \cdot \left(\sqrt{\sqrt{x}}\right) + \left(\sqrt{\sqrt{x}} \cdot \sqrt{\sqrt{x}}\right))_*\]
  8. Simplified30.1

    \[\leadsto (\left(\left|\sqrt[3]{1 + x}\right|\right) \cdot \left(\sqrt{\sqrt[3]{1 + x}}\right) + \left(-\sqrt{x}\right))_* + \color{blue}{0}\]
  9. Using strategy rm
  10. Applied add-exp-log30.0

    \[\leadsto \color{blue}{e^{\log \left((\left(\left|\sqrt[3]{1 + x}\right|\right) \cdot \left(\sqrt{\sqrt[3]{1 + x}}\right) + \left(-\sqrt{x}\right))_*\right)}} + 0\]
  11. Using strategy rm
  12. Applied add-cube-cbrt30.0

    \[\leadsto e^{\log \left((\left(\left|\sqrt[3]{1 + x}\right|\right) \cdot \left(\sqrt{\color{blue}{\left(\sqrt[3]{\sqrt[3]{1 + x}} \cdot \sqrt[3]{\sqrt[3]{1 + x}}\right) \cdot \sqrt[3]{\sqrt[3]{1 + x}}}}\right) + \left(-\sqrt{x}\right))_*\right)} + 0\]
  13. Using strategy rm
  14. Applied add-cube-cbrt30.0

    \[\leadsto e^{\log \left((\left(\left|\sqrt[3]{1 + x}\right|\right) \cdot \left(\sqrt{\color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{1 + x}} \cdot \sqrt[3]{\sqrt[3]{1 + x}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{1 + x}} \cdot \sqrt[3]{\sqrt[3]{1 + x}}}\right) \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{1 + x}} \cdot \sqrt[3]{\sqrt[3]{1 + x}}}\right)} \cdot \sqrt[3]{\sqrt[3]{1 + x}}}\right) + \left(-\sqrt{x}\right))_*\right)} + 0\]
  15. Final simplification30.0

    \[\leadsto e^{\log \left((\left(\left|\sqrt[3]{x + 1}\right|\right) \cdot \left(\sqrt{\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{x + 1}} \cdot \sqrt[3]{\sqrt[3]{x + 1}}} \cdot \left(\sqrt[3]{\sqrt[3]{\sqrt[3]{x + 1}} \cdot \sqrt[3]{\sqrt[3]{x + 1}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{x + 1}} \cdot \sqrt[3]{\sqrt[3]{x + 1}}}\right)\right) \cdot \sqrt[3]{\sqrt[3]{x + 1}}}\right) + \left(-\sqrt{x}\right))_*\right)}\]

Reproduce

herbie shell --seed 2019010 +o rules:numerics
(FPCore (x)
  :name "2sqrt (example 3.1)"

  :herbie-target
  (/ 1 (+ (sqrt (+ x 1)) (sqrt x)))

  (- (sqrt (+ x 1)) (sqrt x)))

Details

Time bar (total: 11.6s)Debug log

sample89.0ms

Algorithm
intervals

simplify8.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
8.0ms
(- (sqrt (+ x 1)) (sqrt x))

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 25.9b

localize21.0ms

Local error

Found 2 expressions with local error:

3.3b
(- (sqrt (+ x 1)) (sqrt x))
0.0b
(sqrt (+ x 1))

rewrite14.0ms

Algorithm
rewrite-expression-head
Rules
22×add-sqr-sqrt
19×*-un-lft-identity
18×prod-diff
17×add-cube-cbrt
16×sqrt-prod
fma-neg
add-log-exp
difference-of-squares
log1p-expm1-u
add-exp-log
sqrt-div
add-cbrt-cube
pow1
expm1-log1p-u
distribute-lft-out--
flip--
flip-+
diff-log
pow1/2
flip3--
flip3-+
sub-neg
rem-sqrt-square
Counts
2 → 57
Calls
2 calls:
Slowest
11.0ms
(- (sqrt (+ x 1)) (sqrt x))
1.0ms
(sqrt (+ x 1))

series72.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
53.0ms
(- (sqrt (+ x 1)) (sqrt x))
19.0ms
(sqrt (+ x 1))

simplify893.0ms

Counts
59 → 63
Calls
59 calls:
Slowest
72.0ms
(- (+ (* 1/2 x) 1) (* 1/8 (pow x 2)))
41.0ms
(fma (sqrt (sqrt (+ x 1))) (sqrt (sqrt (+ x 1))) (- (* (sqrt (sqrt x)) (sqrt (sqrt x)))))
38.0ms
(fma (sqrt (sqrt (+ x 1))) (sqrt (sqrt (+ x 1))) (- (* (sqrt (sqrt x)) (sqrt (sqrt x)))))
30.0ms
(fma (- (cbrt (sqrt x))) (* (cbrt (sqrt x)) (cbrt (sqrt x))) (* (cbrt (sqrt x)) (* (cbrt (sqrt x)) (cbrt (sqrt x)))))
30.0ms
(fma (- (cbrt (sqrt x))) (* (cbrt (sqrt x)) (cbrt (sqrt x))) (* (cbrt (sqrt x)) (* (cbrt (sqrt x)) (cbrt (sqrt x)))))

prune582.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 25.3b

localize35.0ms

Local error

Found 4 expressions with local error:

25.9b
(fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))
0.2b
(cbrt (+ 1 x))
0.2b
(cbrt (+ 1 x))
0.1b
(sqrt (cbrt (+ 1 x)))

rewrite6.0ms

Algorithm
rewrite-expression-head
Rules
10×add-sqr-sqrt
10×cbrt-prod
add-cube-cbrt
*-un-lft-identity
sqrt-prod
cbrt-div
add-log-exp
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
flip-+
flip3-+
sqrt-div
pow1/3
rem-sqrt-square
fma-udef
pow1/2
Counts
4 → 60
Calls
4 calls:
Slowest
2.0ms
(sqrt (cbrt (+ 1 x)))
1.0ms
(cbrt (+ 1 x))
1.0ms
(cbrt (+ 1 x))
0.0ms
(fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))

series184.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
57.0ms
(fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))
46.0ms
(cbrt (+ 1 x))
42.0ms
(sqrt (cbrt (+ 1 x)))
40.0ms
(cbrt (+ 1 x))

simplify1.3s

Counts
32 → 72
Calls
32 calls:
Slowest
255.0ms
(- (+ (exp (* 1/3 (- (log -1) (log (/ -1 x))))) (* 1/3 (/ (exp (* 1/3 (- (log -1) (log (/ -1 x))))) x))) (* 1/9 (/ (exp (* 1/3 (- (log -1) (log (/ -1 x))))) (pow x 2))))
226.0ms
(- (+ (exp (* 1/3 (- (log -1) (log (/ -1 x))))) (* 1/3 (/ (exp (* 1/3 (- (log -1) (log (/ -1 x))))) x))) (* 1/9 (/ (exp (* 1/3 (- (log -1) (log (/ -1 x))))) (pow x 2))))
173.0ms
(- (+ (exp (* 1/6 (- (log -1) (log (/ -1 x))))) (* 1/6 (/ (exp (* 1/6 (- (log -1) (log (/ -1 x))))) x))) (* 5/72 (/ (exp (* 1/6 (- (log -1) (log (/ -1 x))))) (pow x 2))))
103.0ms
(- (+ (* 1/6 x) 1) (* 5/72 (pow x 2)))
103.0ms
(- (+ (* 1/3 x) 1) (* 1/9 (pow x 2)))

prune944.0ms

Pruning

22 alts after pruning (22 fresh and 0 done)

Merged error: 25.3b

localize11.0ms

Local error

Found 4 expressions with local error:

25.9b
(fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))
6.7b
(log (fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x))))
0.5b
(exp (log (fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))))
0.2b
(cbrt (+ 1 x))

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
log-prod
pow1
add-exp-log
add-log-exp
log1p-expm1-u
add-cbrt-cube
exp-prod
expm1-log1p-u
exp-sum
cbrt-prod
log-pow
cbrt-div
rem-exp-log
fma-udef
flip-+
rem-log-exp
pow1/3
flip3-+
Counts
4 → 56
Calls
4 calls:
Slowest
2.0ms
(exp (log (fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))))
1.0ms
(log (fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x))))
1.0ms
(cbrt (+ 1 x))
0.0ms
(fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))

series286.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
93.0ms
(log (fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x))))
88.0ms
(fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))
64.0ms
(exp (log (fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))))
41.0ms
(cbrt (+ 1 x))

simplify563.0ms

Counts
29 → 68
Calls
29 calls:
Slowest
263.0ms
(- (+ (exp (* 1/3 (- (log -1) (log (/ -1 x))))) (* 1/3 (/ (exp (* 1/3 (- (log -1) (log (/ -1 x))))) x))) (* 1/9 (/ (exp (* 1/3 (- (log -1) (log (/ -1 x))))) (pow x 2))))
95.0ms
(- (+ (* 1/3 x) 1) (* 1/9 (pow x 2)))
65.0ms
(- (+ (* 1/3 (pow (/ 1 (pow x 2)) 1/3)) (pow (/ 1 x) -1/3)) (* 1/9 (pow (/ 1 (pow x 5)) 1/3)))
22.0ms
(exp (* (cbrt (log (fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x))))) (cbrt (log (fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))))))
18.0ms
(log (sqrt (fma (fabs (cbrt (+ 1 x))) (sqrt (cbrt (+ 1 x))) (- (sqrt x)))))

prune910.0ms

Pruning

26 alts after pruning (26 fresh and 0 done)

Merged error: 25.3b

localize32.0ms

Local error

Found 4 expressions with local error:

25.9b
(fma (fabs (cbrt (+ 1 x))) (sqrt (* (* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x)))) (cbrt (cbrt (+ 1 x))))) (- (sqrt x)))
6.7b
(log (fma (fabs (cbrt (+ 1 x))) (sqrt (* (* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x)))) (cbrt (cbrt (+ 1 x))))) (- (sqrt x))))
0.4b
(exp (log (fma (fabs (cbrt (+ 1 x))) (sqrt (* (* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x)))) (cbrt (cbrt (+ 1 x))))) (- (sqrt x)))))
0.2b
(* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x))))

rewrite27.0ms

Algorithm
rewrite-expression-head
Rules
24×cbrt-div
18×cbrt-prod
13×add-cube-cbrt
13×*-un-lft-identity
13×add-sqr-sqrt
11×pow1
associate-*l*
associate-*r*
add-exp-log
flip-+
flip3-+
log-prod
add-log-exp
log1p-expm1-u
pow1/3
add-cbrt-cube
exp-prod
frac-times
expm1-log1p-u
exp-sum
pow-prod-up
log-pow
associate-*r/
associate-*l/
pow-prod-down
rem-exp-log
fma-udef
cbrt-unprod
*-commutative
prod-exp
rem-log-exp
pow-plus
pow2
Counts
4 → 85
Calls
4 calls:
Slowest
19.0ms
(* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x))))
4.0ms
(exp (log (fma (fabs (cbrt (+ 1 x))) (sqrt (* (* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x)))) (cbrt (cbrt (+ 1 x))))) (- (sqrt x)))))
2.0ms
(log (fma (fabs (cbrt (+ 1 x))) (sqrt (* (* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x)))) (cbrt (cbrt (+ 1 x))))) (- (sqrt x))))
0.0ms
(fma (fabs (cbrt (+ 1 x))) (sqrt (* (* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x)))) (cbrt (cbrt (+ 1 x))))) (- (sqrt x)))

series265.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
97.0ms
(log (fma (fabs (cbrt (+ 1 x))) (sqrt (* (* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x)))) (cbrt (cbrt (+ 1 x))))) (- (sqrt x))))
68.0ms
(fma (fabs (cbrt (+ 1 x))) (sqrt (* (* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x)))) (cbrt (cbrt (+ 1 x))))) (- (sqrt x)))
63.0ms
(exp (log (fma (fabs (cbrt (+ 1 x))) (sqrt (* (* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x)))) (cbrt (cbrt (+ 1 x))))) (- (sqrt x)))))
36.0ms
(* (cbrt (cbrt (+ 1 x))) (cbrt (cbrt (+ 1 x))))

simplify880.0ms

Counts
62 → 97
Calls
62 calls:
Slowest
101.0ms
(- (+ (* 2/9 x) 1) (* 7/81 (pow x 2)))
80.0ms
(* (cbrt (cbrt (+ (* 1 1) (- (* x x) (* 1 x))))) (cbrt (cbrt (+ (* 1 1) (- (* x x) (* 1 x))))))
74.0ms
(* (cbrt (cbrt (+ (* 1 1) (- (* x x) (* 1 x))))) (cbrt (cbrt (- 1 x))))
71.0ms
(* (cbrt (cbrt (- 1 x))) (cbrt (cbrt (+ (* 1 1) (- (* x x) (* 1 x))))))
64.0ms
(cbrt (cbrt (+ (* 1 1) (- (* x x) (* 1 x)))))

prune1.6s

Pruning

29 alts after pruning (29 fresh and 0 done)

Merged error: 25.3b

regimes205.0ms

Accuracy

0% (0.7b remaining)

Error of 30.0b against oracle of 29.2b and baseline of 30.0b

bsearch4.0ms

end0.0ms

sample2.6s

Algorithm
intervals