Average Error: 30.1 → 0.2
Time: 12.8s
Precision: 64
Internal Precision: 128
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 30.1

    \[\sqrt{x + 1} - \sqrt{x}\]
  2. Using strategy rm
  3. Applied flip--29.9

    \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}}\]
  4. Taylor expanded around 0 0.2

    \[\leadsto \frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}\]
  5. Final simplification0.2

    \[\leadsto \frac{1}{\sqrt{x + 1} + \sqrt{x}}\]

Reproduce

herbie shell --seed 2019002 
(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.8s)Debug log

sample86.0ms

Algorithm
intervals

simplify4.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

4.0ms
(- (sqrt (+ x 1)) (sqrt x))

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.4b

localize17.0ms

Local error

Found 1 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

11.0ms
(- (sqrt (+ x 1)) (sqrt x))

series38.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

38.0ms
(- (sqrt (+ x 1)) (sqrt x))

simplify74.0ms

Counts
9 → 18
Calls

9 calls. Slowest were:

26.0ms
(/ (exp (sqrt (+ x 1))) (exp (sqrt x)))
18.0ms
(- (sqrt (sqrt (+ x 1))) (sqrt (sqrt x)))
10.0ms
(- (sqrt (sqrt (+ x 1))) (sqrt (sqrt x)))

prune116.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 32.2b

localize15.0ms

Local error

Found 4 expressions with local error:

2.7b
(- (* (sqrt (+ x 1)) (sqrt (+ x 1))) (* (sqrt x) (sqrt x)))
0.6b
(* (sqrt x) (sqrt x))
0.3b
(* (sqrt (+ x 1)) (sqrt (+ x 1)))
0.0b
(/ (- (* (sqrt (+ x 1)) (sqrt (+ x 1))) (* (sqrt x) (sqrt x))) (+ (sqrt (+ x 1)) (sqrt x)))

rewrite42.0ms

Algorithm
rewrite-expression-head
Counts
4 → 116
Calls

4 calls. Slowest were:

21.0ms
(/ (- (* (sqrt (+ x 1)) (sqrt (+ x 1))) (* (sqrt x) (sqrt x))) (+ (sqrt (+ x 1)) (sqrt x)))
10.0ms
(- (* (sqrt (+ x 1)) (sqrt (+ x 1))) (* (sqrt x) (sqrt x)))
5.0ms
(* (sqrt (+ x 1)) (sqrt (+ x 1)))

series69.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

43.0ms
(/ (- (* (sqrt (+ x 1)) (sqrt (+ x 1))) (* (sqrt x) (sqrt x))) (+ (sqrt (+ x 1)) (sqrt x)))
12.0ms
(* (sqrt (+ x 1)) (sqrt (+ x 1)))
7.0ms
(* (sqrt x) (sqrt x))
7.0ms
(- (* (sqrt (+ x 1)) (sqrt (+ x 1))) (* (sqrt x) (sqrt x)))

simplify2.6s

Counts
108 → 128
Calls

108 calls. Slowest were:

475.0ms
(- (pow (* (sqrt (+ x 1)) (sqrt (+ x 1))) 3) (pow (* (sqrt x) (sqrt x)) 3))
422.0ms
(- (* (* (sqrt (+ x 1)) (sqrt (+ x 1))) (* (sqrt (+ x 1)) (sqrt (+ x 1)))) (* (* (sqrt x) (sqrt x)) (* (sqrt x) (sqrt x))))
182.0ms
(* (* (* (sqrt (+ x 1)) (sqrt (+ x 1))) (sqrt (+ x 1))) (* (* (sqrt (+ x 1)) (sqrt (+ x 1))) (sqrt (+ x 1))))

prune1.1s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 2 expressions with local error:

0.2b
(/ 1 (+ (sqrt (+ x 1)) (sqrt x)))
0.0b
(+ (sqrt (+ x 1)) (sqrt x))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
2 → 31
Calls

2 calls. Slowest were:

6.0ms
(+ (sqrt (+ x 1)) (sqrt x))
4.0ms
(/ 1 (+ (sqrt (+ x 1)) (sqrt x)))

series63.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

33.0ms
(+ (sqrt (+ x 1)) (sqrt x))
29.0ms
(/ 1 (+ (sqrt (+ x 1)) (sqrt x)))

simplify156.0ms

Counts
15 → 37
Calls

15 calls. Slowest were:

111.0ms
(+ (* (sqrt (+ x 1)) (sqrt (+ x 1))) (- (* (sqrt x) (sqrt x)) (* (sqrt (+ x 1)) (sqrt x))))
10.0ms
(* (exp (sqrt (+ x 1))) (exp (sqrt x)))
8.0ms
(- (sqrt (+ x 1)) (sqrt x))

prune345.0ms

Pruning

8 alts after pruning (6 fresh and 2 done)

Merged error: 0.0b

localize9.0ms

Local error

Found 4 expressions with local error:

0.2b
(/ (/ 1 (sqrt (+ (sqrt (+ x 1)) (sqrt x)))) (sqrt (+ (sqrt (+ x 1)) (sqrt x))))
0.1b
(/ 1 (sqrt (+ (sqrt (+ x 1)) (sqrt x))))
0.1b
(sqrt (+ (sqrt (+ x 1)) (sqrt x)))
0.1b
(sqrt (+ (sqrt (+ x 1)) (sqrt x)))

rewrite27.0ms

Algorithm
rewrite-expression-head
Counts
4 → 127
Calls

4 calls. Slowest were:

10.0ms
(/ (/ 1 (sqrt (+ (sqrt (+ x 1)) (sqrt x)))) (sqrt (+ (sqrt (+ x 1)) (sqrt x))))
5.0ms
(sqrt (+ (sqrt (+ x 1)) (sqrt x)))
5.0ms
(sqrt (+ (sqrt (+ x 1)) (sqrt x)))

series221.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

72.0ms
(/ 1 (sqrt (+ (sqrt (+ x 1)) (sqrt x))))
54.0ms
(sqrt (+ (sqrt (+ x 1)) (sqrt x)))
50.0ms
(/ (/ 1 (sqrt (+ (sqrt (+ x 1)) (sqrt x)))) (sqrt (+ (sqrt (+ x 1)) (sqrt x))))
45.0ms
(sqrt (+ (sqrt (+ x 1)) (sqrt x)))

simplify2.6s

Counts
143 → 139
Calls

143 calls. Slowest were:

452.0ms
(/ (* (* (/ 1 (sqrt (+ (sqrt (+ x 1)) (sqrt x)))) (/ 1 (sqrt (+ (sqrt (+ x 1)) (sqrt x))))) (/ 1 (sqrt (+ (sqrt (+ x 1)) (sqrt x))))) (* (* (sqrt (+ (sqrt (+ x 1)) (sqrt x))) (sqrt (+ (sqrt (+ x 1)) (sqrt x)))) (sqrt (+ (sqrt (+ x 1)) (sqrt x)))))
166.0ms
(/ (sqrt (+ (* (sqrt (+ x 1)) (sqrt (+ x 1))) (- (* (sqrt x) (sqrt x)) (* (sqrt (+ x 1)) (sqrt x))))) (sqrt (+ (sqrt (+ x 1)) (sqrt x))))
164.0ms
(/ (sqrt (+ (* (sqrt (+ x 1)) (sqrt (+ x 1))) (- (* (sqrt x) (sqrt x)) (* (sqrt (+ x 1)) (sqrt x))))) (sqrt (sqrt (+ (sqrt (+ x 1)) (sqrt x)))))

prune1.5s

Pruning

8 alts after pruning (6 fresh and 2 done)

Merged error: 0b

regimes124.0ms

Accuracy

0% (0.1b remaining)

Error of 0.2b against oracle of 0.0b and baseline of 0.2b

bsearch2.0ms

end0.0ms

sample2.6s

Algorithm
intervals