Average Error: 39.2 → 0.0
Time: 4.7s
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.2

    \[\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 2018362 +o rules:numerics
(FPCore (x)
  :name "Expanding a square"
  (- (* (+ x 1) (+ x 1)) 1))

Details

Time bar (total: 3.4s)Debug log

start150.0ms

Algorithm
intervals

setup506.0ms

Pruning

1 alts after pruning (1 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)

series25.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

25.0ms
(* (+ 2 x) x)

simplify277.0ms

Counts
7 → 18
Calls

7 calls. Slowest were:

232.0ms
(* (- (* 2 2) (* x x)) x)
15.0ms
(* (+ (pow 2 3) (pow x 3)) x)
7.0ms
(+ (* 2 x) (pow x 2))

prune88.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize17.0ms

Local error

Found 3 expressions with local error:

6.0b
(/ (* (- (* 2 2) (* x x)) x) (- 2 x))
0.0b
(* (- (* 2 2) (* x x)) x)
0.0b
(- (* 2 2) (* x x))

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
3 → 58
Calls

3 calls. Slowest were:

7.0ms
(/ (* (- (* 2 2) (* x x)) x) (- 2 x))
4.0ms
(* (- (* 2 2) (* x x)) x)
2.0ms
(- (* 2 2) (* x x))

series92.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

42.0ms
(/ (* (- (* 2 2) (* x x)) x) (- 2 x))
32.0ms
(* (- (* 2 2) (* x x)) x)
18.0ms
(- (* 2 2) (* x x))

simplify1.8s

Counts
35 → 67
Calls

35 calls. Slowest were:

437.0ms
(- (log (* (- (* 2 2) (* x x)) x)) (log (- 2 x)))
205.0ms
(/ (- (* 2 2) (* x x)) (* (cbrt (- 2 x)) (cbrt (- 2 x))))
200.0ms
(* (- (* (* 2 2) (* 2 2)) (* (* x x) (* x x))) x)

prune380.0ms

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes19.0ms

Accuracy

0% (0.0b remaining)

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

bsearch1.0ms