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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 38.8

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

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

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

Reproduce

herbie shell --seed 2019016 
(FPCore (x)
  :name "Expanding a square"
  (- (* (+ x 1) (+ x 1)) 1))

Details

Time bar (total: 2.7s)Debug log

sample101.0ms

Algorithm
intervals
Results
361×(pre true 80)
194×(body real 80)
72×(body real 1280)
50×(body real 640)
31×(body real 320)
14×(body real 160)

simplify160.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
160.0ms
(- (* (+ x 1) (+ x 1)) 1)

prune8.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize7.0ms

Local error

Found 1 expressions with local error:

0.0b
(* (+ x 2) x)

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
associate-*l*
add-cube-cbrt
associate-*l/
*-un-lft-identity
add-sqr-sqrt
add-log-exp
flip-+
*-commutative
add-exp-log
add-cbrt-cube
flip3-+
pow1
Counts
1 → 13
Calls
1 calls:
Slowest
4.0ms
(* (+ x 2) x)

series25.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
25.0ms
(* (+ x 2) x)

simplify192.0ms

Counts
7 → 16
Calls
7 calls:
Slowest
156.0ms
(* (- (* x x) (* 2 2)) x)
16.0ms
(* (+ (pow x 3) (pow 2 3)) x)
6.0ms
(+ (* 2 x) (pow x 2))
5.0ms
(+ (* 2 x) (pow x 2))
5.0ms
(+ (* 2 x) (pow x 2))

prune64.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize13.0ms

Local error

Found 2 expressions with local error:

7.5b
(/ (+ (* -4 x) (pow x 3)) (- x 2))
0.0b
(+ (* -4 x) (pow x 3))

rewrite12.0ms

Algorithm
rewrite-expression-head
Rules
12×times-frac
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
unpow3
distribute-rgt-out
add-log-exp
associate-/l*
add-exp-log
add-cbrt-cube
associate-/r*
associate-/l/
flip-+
associate-/r/
flip3-+
pow1
flip--
div-inv
div-exp
flip3--
frac-2neg
sum-log
clear-num
+-commutative
cbrt-undiv
Counts
2 → 47
Calls
2 calls:
Slowest
9.0ms
(/ (+ (* -4 x) (pow x 3)) (- x 2))
2.0ms
(+ (* -4 x) (pow x 3))

series79.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
45.0ms
(/ (+ (* -4 x) (pow x 3)) (- x 2))
34.0ms
(+ (* -4 x) (pow x 3))

simplify658.0ms

Counts
43 → 53
Calls
43 calls:
Slowest
120.0ms
(- (* (* -4 x) (* -4 x)) (* (pow x 3) (pow x 3)))
89.0ms
(+ (pow (* -4 x) 3) (pow (pow x 3) 3))
79.0ms
(/ (* (* (+ (* -4 x) (pow x 3)) (+ (* -4 x) (pow x 3))) (+ (* -4 x) (pow x 3))) (* (* (- x 2) (- x 2)) (- x 2)))
25.0ms
(/ (* (cbrt (+ (* -4 x) (pow x 3))) (cbrt (+ (* -4 x) (pow x 3)))) (* (cbrt (- x 2)) (cbrt (- x 2))))
22.0ms
(- (log (+ (* -4 x) (pow x 3))) (log (- x 2)))

prune261.0ms

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes17.0ms

Accuracy

0% (0.0b remaining)

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

bsearch1.0ms

end0.0ms

sample1.1s

Algorithm
intervals
Results
10762×(pre true 80)
5589×(body real 80)
2263×(body real 1280)
1689×(body real 640)
800×(body real 320)
421×(body real 160)