Average Error: 0.0 → 0.0
Time: 22.1s
Precision: 64
Internal Precision: 128
\[\left(a + b\right) \cdot \left(a + b\right)\]
\[a \cdot \left(b + a\right) + \left(b + a\right) \cdot b\]

Error

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[\left(\left(b \cdot a + b \cdot b\right) + b \cdot a\right) + a \cdot a\]

Derivation

  1. Initial program 0.0

    \[\left(a + b\right) \cdot \left(a + b\right)\]
  2. Using strategy rm
  3. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{\left(a + b\right) \cdot a + \left(a + b\right) \cdot b}\]
  4. Final simplification0.0

    \[\leadsto a \cdot \left(b + a\right) + \left(b + a\right) \cdot b\]

Reproduce

herbie shell --seed 2019016 +o rules:numerics
(FPCore (a b)
  :name "Expression 4, p15"
  :pre (and (<= 5 a 10) (<= 0 b 0.001))

  :herbie-target
  (+ (+ (+ (* b a) (* b b)) (* b a)) (* a a))

  (* (+ a b) (+ a b)))

Details

Time bar (total: 21.7s)Debug log

sample34.0ms

Algorithm
intervals
Results
256×(pre true 80)
256×(body real 80)

simplify32.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
32.0ms
(* (+ a b) (+ a b))

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 1 expressions with local error:

0.0b
(* (+ a b) (+ a b))

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
flip-+
flip3-+
pow1
frac-times
add-cube-cbrt
add-exp-log
associate-*l*
associate-*r*
add-cbrt-cube
*-un-lft-identity
add-sqr-sqrt
associate-*r/
associate-*l/
add-log-exp
log1p-expm1-u
cbrt-unprod
pow-prod-up
*-commutative
prod-exp
pow-prod-down
pow-plus
distribute-lft-in
expm1-log1p-u
distribute-rgt-in
pow2
Counts
1 → 32
Calls
1 calls:
Slowest
4.0ms
(* (+ a b) (+ a b))

series9.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
9.0ms
(* (+ a b) (+ a b))

simplify2.2s

Counts
28 → 35
Calls
28 calls:
Slowest
412.0ms
(* (- (* a a) (* b b)) (+ (pow a 3) (pow b 3)))
355.0ms
(* (+ (* a a) (- (* b b) (* a b))) (+ (* a a) (- (* b b) (* a b))))
243.0ms
(* (+ (pow a 3) (pow b 3)) (+ (pow a 3) (pow b 3)))
184.0ms
(* (- a b) (+ (* a a) (- (* b b) (* a b))))
173.0ms
(* (+ (pow a 3) (pow b 3)) (+ a b))

prune294.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize14.0ms

Local error

Found 3 expressions with local error:

0.0b
(* (+ a b) b)
0.0b
(* (+ a b) a)
0.0b
(+ (* (+ a b) a) (* (+ a b) b))

rewrite19.0ms

Algorithm
rewrite-expression-head
Rules
12×associate-*l/
flip-+
flip3-+
associate-*l*
add-log-exp
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
frac-add
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
*-commutative
distribute-lft-out
fma-def
sum-log
+-commutative
Counts
3 → 49
Calls
3 calls:
Slowest
9.0ms
(+ (* (+ a b) a) (* (+ a b) b))
5.0ms
(* (+ a b) b)
4.0ms
(* (+ a b) a)

series70.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
24.0ms
(* (+ a b) b)
23.0ms
(+ (* (+ a b) a) (* (+ a b) b))
22.0ms
(* (+ a b) a)

simplify2.8s

Counts
29 → 58
Calls
29 calls:
Slowest
717.0ms
(* (- (* a a) (* b b)) a)
422.0ms
(* (- (* a a) (* b b)) b)
303.0ms
(* (+ (* a a) (- (* b b) (* a b))) (+ (* a a) (- (* b b) (* a b))))
246.0ms
(* (- a b) (+ (* a a) (- (* b b) (* a b))))
165.0ms
(+ (* (* (+ (pow a 3) (pow b 3)) a) (+ (* a a) (- (* b b) (* a b)))) (* (+ (* a a) (- (* b b) (* a b))) (* (+ (pow a 3) (pow b 3)) b)))

prune428.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize65.0ms

Local error

Found 4 expressions with local error:

0.5b
(* (* (+ b a) (- a b)) (fma b (- b a) (* a a)))
0.4b
(/ (fma (* (* (+ b a) (- a b)) (fma b (- b a) (* a a))) b (* (* (- a b) a) (fma b (* b b) (pow a 3)))) (* (- a b) (fma b (- b a) (* a a))))
0.4b
(* (* (- a b) a) (fma b (* b b) (pow a 3)))
0.3b
(* (- a b) (fma b (- b a) (* a a)))

rewrite31.0ms

Algorithm
rewrite-expression-head
Rules
18×add-exp-log
18×associate-*l/
18×add-cbrt-cube
13×pow1
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
associate-*r*
flip--
fma-udef
cbrt-unprod
prod-exp
flip3--
pow-prod-down
associate-*l*
add-log-exp
log1p-expm1-u
frac-times
expm1-log1p-u
associate-/l*
flip-+
*-commutative
times-frac
flip3-+
distribute-lft-in
distribute-rgt-in
associate-/r/
associate-*r/
div-exp
cbrt-undiv
div-inv
frac-2neg
associate-/r*
clear-num
Counts
4 → 99
Calls
4 calls:
Slowest
11.0ms
(* (* (+ b a) (- a b)) (fma b (- b a) (* a a)))
8.0ms
(* (* (- a b) a) (fma b (* b b) (pow a 3)))
6.0ms
(/ (fma (* (* (+ b a) (- a b)) (fma b (- b a) (* a a))) b (* (* (- a b) a) (fma b (* b b) (pow a 3)))) (* (- a b) (fma b (- b a) (* a a))))
4.0ms
(* (- a b) (fma b (- b a) (* a a)))

series222.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
95.0ms
(/ (fma (* (* (+ b a) (- a b)) (fma b (- b a) (* a a))) b (* (* (- a b) a) (fma b (* b b) (pow a 3)))) (* (- a b) (fma b (- b a) (* a a))))
60.0ms
(* (* (+ b a) (- a b)) (fma b (- b a) (* a a)))
40.0ms
(* (* (- a b) a) (fma b (* b b) (pow a 3)))
26.0ms
(* (- a b) (fma b (- b a) (* a a)))

simplify12.7s

Counts
70 → 111
Calls
70 calls:
Slowest
637.0ms
(* (* (+ (pow b 3) (pow a 3)) (- (* a a) (* b b))) (fma b (- b a) (* a a)))
601.0ms
(* (* (- (* b b) (* a a)) (- a b)) (fma b (- b a) (* a a)))
586.0ms
(/ (fma (* (* (+ b a) (- a b)) (fma b (- b a) (* a a))) b (* (* (- a b) a) (fma b (* b b) (pow a 3)))) (fma b (- b a) (* a a)))
557.0ms
(sqrt (fma (* (* (+ b a) (- a b)) (fma b (- b a) (* a a))) b (* (* (- a b) a) (fma b (* b b) (pow a 3)))))
508.0ms
(/ (cbrt (fma (* (* (+ b a) (- a b)) (fma b (- b a) (* a a))) b (* (* (- a b) a) (fma b (* b b) (pow a 3))))) (fma b (- b a) (* a a)))

prune1.6s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes65.0ms

Accuracy

0% (0.0b remaining)

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

bsearch2.0ms

end0.0ms

sample1.1s

Algorithm
intervals
Results
8000×(pre true 80)
8000×(body real 80)