Average Error: 39.5 → 0.0
Time: 8.2s
Precision: 64
Internal Precision: 128
\[\left(x + 1\right) \cdot \left(x + 1\right) - 1\]
\[\left(4 - x \cdot x\right) \cdot \frac{x}{2 - 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.5

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

    \[\leadsto \color{blue}{\left(2 + x\right) \cdot x}\]
  3. Using strategy rm
  4. Applied flip-+0.0

    \[\leadsto \color{blue}{\frac{2 \cdot 2 - x \cdot x}{2 - x}} \cdot x\]
  5. Applied associate-*l/6.6

    \[\leadsto \color{blue}{\frac{\left(2 \cdot 2 - x \cdot x\right) \cdot x}{2 - x}}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity6.6

    \[\leadsto \frac{\left(2 \cdot 2 - x \cdot x\right) \cdot x}{\color{blue}{1 \cdot \left(2 - x\right)}}\]
  8. Applied times-frac0.0

    \[\leadsto \color{blue}{\frac{2 \cdot 2 - x \cdot x}{1} \cdot \frac{x}{2 - x}}\]
  9. Simplified0.0

    \[\leadsto \color{blue}{\left(4 - x \cdot x\right)} \cdot \frac{x}{2 - x}\]
  10. Final simplification0.0

    \[\leadsto \left(4 - x \cdot x\right) \cdot \frac{x}{2 - x}\]

Reproduce

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

Details

Time bar (total: 8.0s)Debug log

sample98.0ms

Algorithm
intervals

simplify420.0ms

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

prune11.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)

rewrite6.0ms

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

series25.0ms

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

simplify253.0ms

Counts
7 → 18
Calls
7 calls:
Slowest
216.0ms
(* (- (* 2 2) (* x x)) x)
15.0ms
(* (+ (pow 2 3) (pow x 3)) x)
6.0ms
(+ (* 2 x) (pow x 2))
6.0ms
(+ (* 2 x) (pow x 2))
6.0ms
(+ (* 2 x) (pow x 2))

prune76.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 2 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
associate-*l/
associate-*l*
add-cbrt-cube
flip--
flip3--
times-frac
associate-/r*
associate-/l/
add-log-exp
log1p-expm1-u
associate-/r/
pow1
expm1-log1p-u
difference-of-squares
associate-/l*
div-inv
*-commutative
div-exp
frac-2neg
clear-num
cbrt-undiv
Counts
2 → 41
Calls
2 calls:
Slowest
6.0ms
(/ (* (- (* 2 2) (* x x)) x) (- 2 x))
4.0ms
(* (- (* 2 2) (* x x)) x)

series75.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
46.0ms
(/ (* (- (* 2 2) (* x x)) x) (- 2 x))
28.0ms
(* (- (* 2 2) (* x x)) x)

simplify1.4s

Counts
27 → 47
Calls
27 calls:
Slowest
191.0ms
(/ (- (* 2 2) (* x x)) (* (cbrt (- 2 x)) (cbrt (- 2 x))))
176.0ms
(* (- (* (* 2 2) (* 2 2)) (* (* x x) (* x x))) x)
173.0ms
(* (- (* (* 2 2) (* 2 2)) (* (* x x) (* x x))) x)
163.0ms
(- (log (* (- (* 2 2) (* x x)) x)) (log (- 2 x)))
137.0ms
(/ (- (* 2 2) (* x x)) 1)

prune215.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0b

localize7.0ms

Local error

Found 2 expressions with local error:

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

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
associate-*r*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
flip--
associate-/r/
add-exp-log
add-cbrt-cube
flip3--
pow1
associate-*l*
associate-/r*
add-log-exp
div-inv
log1p-expm1-u
associate-*l/
frac-times
expm1-log1p-u
cbrt-unprod
*-commutative
associate-*r/
prod-exp
pow-prod-down
frac-2neg
clear-num
Counts
2 → 44
Calls
2 calls:
Slowest
4.0ms
(* (- 4 (* x x)) (/ x (- 2 x)))
0.0ms
(/ x (- 2 x))

series54.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
42.0ms
(* (- 4 (* x x)) (/ x (- 2 x)))
12.0ms
(/ x (- 2 x))

simplify1.7s

Counts
29 → 50
Calls
29 calls:
Slowest
301.0ms
(* (* (* (- 4 (* x x)) (- 4 (* x x))) (- 4 (* x x))) (* (* (/ x (- 2 x)) (/ x (- 2 x))) (/ x (- 2 x))))
258.0ms
(* (- (* 4 4) (* (* x x) (* x x))) (/ x (- 2 x)))
204.0ms
(* (- (pow 4 3) (pow (* x x) 3)) (/ x (- 2 x)))
134.0ms
(+ (* 1/2 x) (+ (* 1/8 (pow x 3)) (* 1/4 (pow x 2))))
129.0ms
(- (+ (* 4 (/ 1 (pow x 2))) (+ (* 2 (/ 1 x)) 1)))

prune233.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize14.0ms

Local error

Found 4 expressions with local error:

0.8b
(cbrt (- 2 x))
0.8b
(cbrt (- 2 x))
0.8b
(cbrt (- 2 x))
0.4b
(/ x (* (cbrt (- 2 x)) (cbrt (- 2 x))))

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
18×cbrt-div
flip--
flip3--
cbrt-prod
associate-/r/
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
frac-times
expm1-log1p-u
pow1/3
associate-*r/
associate-*l/
div-inv
frac-2neg
associate-/r*
clear-num
Counts
4 → 66
Calls
4 calls:
Slowest
2.0ms
(/ x (* (cbrt (- 2 x)) (cbrt (- 2 x))))
1.0ms
(cbrt (- 2 x))
1.0ms
(cbrt (- 2 x))
0.0ms
(cbrt (- 2 x))

series146.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
48.0ms
(/ x (* (cbrt (- 2 x)) (cbrt (- 2 x))))
34.0ms
(cbrt (- 2 x))
33.0ms
(cbrt (- 2 x))
31.0ms
(cbrt (- 2 x))

simplify1.5s

Counts
36 → 78
Calls
36 calls:
Slowest
184.0ms
(+ (* 1/3 (* (pow 1/4 1/3) (pow x 2))) (+ (* (pow 1/4 1/3) x) (* 5/36 (* (pow 1/4 1/3) (pow x 3)))))
156.0ms
(- (pow 2 1/3) (+ (* 1/36 (* (pow x 2) (pow 2 1/3))) (* 1/6 (* x (pow 2 1/3)))))
155.0ms
(- (pow 2 1/3) (+ (* 1/36 (* (pow x 2) (pow 2 1/3))) (* 1/6 (* x (pow 2 1/3)))))
154.0ms
(- (pow 2 1/3) (+ (* 1/36 (* (pow x 2) (pow 2 1/3))) (* 1/6 (* x (pow 2 1/3)))))
132.0ms
(- (exp (* 1/3 (- (log -1) (log (/ 1 x))))) (+ (* 2/3 (/ (exp (* 1/3 (- (log -1) (log (/ 1 x))))) x)) (* 4/9 (/ (exp (* 1/3 (- (log -1) (log (/ 1 x))))) (pow x 2)))))

prune460.0ms

Pruning

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

end0.0ms

sample1.2s

Algorithm
intervals