Average Error: 39.3 → 0.0
Time: 9.9s
Precision: 64
Internal Precision: 128
\[\left(x + 1\right) \cdot \left(x + 1\right) - 1\]
\[\left(x + 2\right) \cdot x\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 39.3

    \[\left(x + 1\right) \cdot \left(x + 1\right) - 1\]
  2. Initial simplification0.0

    \[\leadsto \left(2 + x\right) \cdot x\]
  3. Final simplification0.0

    \[\leadsto \left(x + 2\right) \cdot x\]

Reproduce

herbie shell --seed 2018360 +o rules:numerics
(FPCore (x)
  :name "Expanding a square"
  (- (* (+ x 1) (+ x 1)) 1))

Details

Time bar (total: 8.4s)Debug log

start99.0ms

Algorithm
intervals

setup445.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 1 expressions with local error:

0.0b
(* (+ 2 x) x)

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
1 → 15
Calls

1 calls. Slowest were:

4.0ms
(* (+ 2 x) x)

series26.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

26.0ms
(* (+ 2 x) x)

simplify249.0ms

Counts
7 → 18
Calls

7 calls. Slowest were:

204.0ms
(* (- (* 2 2) (* x x)) x)
21.0ms
(* (+ (pow 2 3) (pow x 3)) x)
7.0ms
(+ (* 2 x) (pow x 2))

prune94.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0b

localize8.0ms

Local error

Found 4 expressions with local error:

0.6b
(cbrt (* (+ 2 x) x))
0.6b
(cbrt (* (+ 2 x) x))
0.6b
(cbrt (* (+ 2 x) x))
0.5b
(* (cbrt (* (+ 2 x) x)) (cbrt (* (+ 2 x) x)))

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
4 → 73
Calls

4 calls. Slowest were:

8.0ms
(* (cbrt (* (+ 2 x) x)) (cbrt (* (+ 2 x) x)))
2.0ms
(cbrt (* (+ 2 x) x))
1.0ms
(cbrt (* (+ 2 x) x))

series176.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

47.0ms
(cbrt (* (+ 2 x) x))
46.0ms
(* (cbrt (* (+ 2 x) x)) (cbrt (* (+ 2 x) x)))
43.0ms
(cbrt (* (+ 2 x) x))
40.0ms
(cbrt (* (+ 2 x) x))

simplify3.6s

Counts
49 → 85
Calls

49 calls. Slowest were:

372.0ms
(- (+ (* 2/3 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x))))))) x)) (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x)))))))) (* 4/9 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x))))))) (pow x 2))))
226.0ms
(- (+ (* (pow (pow x 4) 1/3) (pow (cbrt -1) 2)) (* 4/3 (* (pow x 1/3) (pow (cbrt -1) 2)))) (* 4/9 (* (pow (/ 1 (pow x 2)) 1/3) (pow (cbrt -1) 2))))
224.0ms
(* (cbrt (* (+ (pow 2 3) (pow x 3)) x)) (cbrt (* (- (* 2 2) (* x x)) x)))

prune552.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0b

localize25.0ms

Local error

Found 2 expressions with local error:

5.8b
(/ (* (- (* 2 2) (* x x)) x) (- 2 x))
0.1b
(* (- (* 2 2) (* x x)) x)

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
2 → 41
Calls

2 calls. Slowest were:

11.0ms
(/ (* (- (* 2 2) (* x x)) x) (- 2 x))
7.0ms
(* (- (* 2 2) (* x x)) x)

series99.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

58.0ms
(/ (* (- (* 2 2) (* x x)) x) (- 2 x))
41.0ms
(* (- (* 2 2) (* x x)) x)

simplify1.3s

Counts
27 → 47
Calls

27 calls. Slowest were:

207.0ms
(/ (- (* 2 2) (* x x)) (* (cbrt (- 2 x)) (cbrt (- 2 x))))
197.0ms
(- (log (* (- (* 2 2) (* x x)) x)) (log (- 2 x)))
148.0ms
(/ (- (* 2 2) (* x x)) (sqrt (- 2 x)))

prune259.0ms

Pruning

4 alts after pruning (1 fresh and 3 done)

Merged error: 0b

localize7.0ms

Local error

Found 2 expressions with local error:

0.3b
(/ (- 4 (* x x)) (/ (- 2 x) x))
0.0b
(/ (- 2 x) x)

rewrite5.0ms

Algorithm
rewrite-expression-head
Counts
2 → 55
Calls

2 calls. Slowest were:

3.0ms
(/ (- 4 (* x x)) (/ (- 2 x) x))
2.0ms
(/ (- 2 x) x)

series62.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

43.0ms
(/ (- 4 (* x x)) (/ (- 2 x) x))
19.0ms
(/ (- 2 x) x)

simplify993.0ms

Counts
46 → 61
Calls

46 calls. Slowest were:

314.0ms
(/ (* (* (- 4 (* x x)) (- 4 (* x x))) (- 4 (* x x))) (* (* (/ (- 2 x) x) (/ (- 2 x) x)) (/ (- 2 x) x)))
133.0ms
(- (* 4 4) (* (* x x) (* x x)))
52.0ms
(/ (- 4 (* x x)) (/ (- 2 x) x))

prune351.0ms

Pruning

4 alts after pruning (0 fresh and 4 done)

Merged error: 0b

regimes24.0ms

Accuracy

0% (0.0b remaining)

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

bsearch1.0ms