Average Error: 0.0 → 0.0
Time: 6.7s
Precision: 64
Internal Precision: 128
\[a \cdot \left(\left(b + c\right) + d\right)\]
\[(a \cdot \left(d + c\right) + \left(b \cdot a\right))_*\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Target

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

Derivation

  1. Initial program 0.0

    \[a \cdot \left(\left(b + c\right) + d\right)\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt0.3

    \[\leadsto a \cdot \left(\color{blue}{\sqrt{b + c} \cdot \sqrt{b + c}} + d\right)\]
  4. Applied fma-def0.3

    \[\leadsto a \cdot \color{blue}{(\left(\sqrt{b + c}\right) \cdot \left(\sqrt{b + c}\right) + d)_*}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.5

    \[\leadsto a \cdot \color{blue}{\left(\sqrt{(\left(\sqrt{b + c}\right) \cdot \left(\sqrt{b + c}\right) + d)_*} \cdot \sqrt{(\left(\sqrt{b + c}\right) \cdot \left(\sqrt{b + c}\right) + d)_*}\right)}\]
  7. Applied associate-*r*0.6

    \[\leadsto \color{blue}{\left(a \cdot \sqrt{(\left(\sqrt{b + c}\right) \cdot \left(\sqrt{b + c}\right) + d)_*}\right) \cdot \sqrt{(\left(\sqrt{b + c}\right) \cdot \left(\sqrt{b + c}\right) + d)_*}}\]
  8. Simplified0.5

    \[\leadsto \left(a \cdot \sqrt{(\left(\sqrt{b + c}\right) \cdot \left(\sqrt{b + c}\right) + d)_*}\right) \cdot \color{blue}{\sqrt{c + \left(b + d\right)}}\]
  9. Using strategy rm
  10. Applied pow10.5

    \[\leadsto \left(a \cdot \sqrt{(\left(\sqrt{b + c}\right) \cdot \left(\sqrt{b + c}\right) + d)_*}\right) \cdot \color{blue}{{\left(\sqrt{c + \left(b + d\right)}\right)}^{1}}\]
  11. Applied pow10.5

    \[\leadsto \color{blue}{{\left(a \cdot \sqrt{(\left(\sqrt{b + c}\right) \cdot \left(\sqrt{b + c}\right) + d)_*}\right)}^{1}} \cdot {\left(\sqrt{c + \left(b + d\right)}\right)}^{1}\]
  12. Applied pow-prod-down0.5

    \[\leadsto \color{blue}{{\left(\left(a \cdot \sqrt{(\left(\sqrt{b + c}\right) \cdot \left(\sqrt{b + c}\right) + d)_*}\right) \cdot \sqrt{c + \left(b + d\right)}\right)}^{1}}\]
  13. Simplified0.0

    \[\leadsto {\color{blue}{\left((a \cdot \left(d + c\right) + \left(a \cdot b\right))_*\right)}}^{1}\]
  14. Final simplification0.0

    \[\leadsto (a \cdot \left(d + c\right) + \left(b \cdot a\right))_*\]

Reproduce

herbie shell --seed 2019010 +o rules:numerics
(FPCore (a b c d)
  :name "Expression, p14"
  :pre (and (<= 56789 a 98765) (<= 0 b 1) (<= 0 c 0.0016773) (<= 0 d 0.0016773))

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

  (* a (+ (+ b c) d)))

Details

Time bar (total: 6.3s)Debug log

sample26.0ms

Algorithm
intervals

simplify72.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
72.0ms
(* a (+ (+ b c) d))

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize9.0ms

Local error

Found 2 expressions with local error:

0.0b
(* a (+ (+ b c) d))
0.0b
(+ (+ b c) d)

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-*r*
fma-def
add-log-exp
log1p-expm1-u
flip-+
add-exp-log
associate-*r/
add-cbrt-cube
flip3-+
pow1
expm1-log1p-u
*-commutative
distribute-lft-in
associate-+l+
+-commutative
distribute-rgt-in
Counts
2 → 33
Calls
2 calls:
Slowest
4.0ms
(* a (+ (+ b c) d))
3.0ms
(+ (+ b c) d)

series50.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
33.0ms
(* a (+ (+ b c) d))
17.0ms
(+ (+ b c) d)

simplify393.0ms

Counts
15 → 39
Calls
15 calls:
Slowest
176.0ms
(+ (* (+ b c) (+ b c)) (- (* d d) (* (+ b c) d)))
70.0ms
(+ (* a d) (+ (* a b) (* a c)))
70.0ms
(+ (* a d) (+ (* a b) (* a c)))
15.0ms
(- (+ b c) d)
11.0ms
(+ b (+ c d))

prune350.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0b

localize9.0ms

Local error

Found 4 expressions with local error:

0.4b
(fma (sqrt (+ b c)) (sqrt (+ b c)) d)
0.0b
(* a (fma (sqrt (+ b c)) (sqrt (+ b c)) d))
0.0b
(sqrt (+ b c))
0.0b
(sqrt (+ b c))

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
sqrt-prod
add-log-exp
log1p-expm1-u
add-exp-log
sqrt-div
add-cbrt-cube
pow1
expm1-log1p-u
fma-udef
associate-*r*
flip-+
pow1/2
flip3-+
rem-sqrt-square
*-commutative
distribute-lft-in
distribute-rgt-in
Counts
4 → 57
Calls
4 calls:
Slowest
1.0ms
(* a (fma (sqrt (+ b c)) (sqrt (+ b c)) d))
1.0ms
(sqrt (+ b c))
1.0ms
(sqrt (+ b c))
0.0ms
(fma (sqrt (+ b c)) (sqrt (+ b c)) d)

series238.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
89.0ms
(fma (sqrt (+ b c)) (sqrt (+ b c)) d)
86.0ms
(* a (fma (sqrt (+ b c)) (sqrt (+ b c)) d))
34.0ms
(sqrt (+ b c))
29.0ms
(sqrt (+ b c))

simplify135.0ms

Counts
29 → 69
Calls
29 calls:
Slowest
32.0ms
(sqrt (- (* b b) (* c c)))
29.0ms
(sqrt (- (* b b) (* c c)))
9.0ms
(cbrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d))
9.0ms
(sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d))
8.0ms
(+ b (+ c d))

prune692.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0b

localize32.0ms

Local error

Found 4 expressions with local error:

0.4b
(* (* a (sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d))) (sqrt (+ c (+ b d))))
0.4b
(fma (sqrt (+ b c)) (sqrt (+ b c)) d)
0.3b
(* a (sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d)))
0.0b
(sqrt (+ c (+ b d)))

rewrite20.0ms

Algorithm
rewrite-expression-head
Rules
12×associate-*r*
10×add-sqr-sqrt
sqrt-prod
add-cube-cbrt
*-un-lft-identity
add-exp-log
add-cbrt-cube
pow1
add-log-exp
log1p-expm1-u
sqrt-div
expm1-log1p-u
flip-+
*-commutative
associate-*r/
flip3-+
fma-udef
cbrt-unprod
prod-exp
pow-prod-down
associate-*l*
pow1/2
rem-sqrt-square
Counts
4 → 64
Calls
4 calls:
Slowest
13.0ms
(* (* a (sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d))) (sqrt (+ c (+ b d))))
4.0ms
(* a (sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d)))
2.0ms
(sqrt (+ c (+ b d)))
0.0ms
(fma (sqrt (+ b c)) (sqrt (+ b c)) d)

series671.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
352.0ms
(* (* a (sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d))) (sqrt (+ c (+ b d))))
192.0ms
(* a (sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d)))
93.0ms
(fma (sqrt (+ b c)) (sqrt (+ b c)) d)
34.0ms
(sqrt (+ c (+ b d)))

simplify1.2s

Counts
35 → 76
Calls
35 calls:
Slowest
513.0ms
(sqrt (+ (pow c 3) (pow (+ b d) 3)))
186.0ms
(sqrt (+ (* c c) (- (* (+ b d) (+ b d)) (* c (+ b d)))))
103.0ms
(sqrt (- (* c c) (* (+ b d) (+ b d))))
89.0ms
(* (* (* (* a (sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d))) (* a (sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d)))) (* a (sqrt (fma (sqrt (+ b c)) (sqrt (+ b c)) d)))) (* (* (sqrt (+ c (+ b d))) (sqrt (+ c (+ b d)))) (sqrt (+ c (+ b d)))))
54.0ms
(+ (* a d) (+ (* a b) (* a c)))

prune954.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize12.0ms

Local error

Found 1 expressions with local error:

0.0b
(fma a (+ d c) (* a b))

rewrite0.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
log1p-expm1-u
fma-udef
add-cube-cbrt
add-exp-log
add-cbrt-cube
*-un-lft-identity
pow1
expm1-log1p-u
add-sqr-sqrt
Counts
1 → 10
Calls
1 calls:
Slowest
0.0ms
(fma a (+ d c) (* a b))

series24.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
24.0ms
(fma a (+ d c) (* a b))

simplify121.0ms

Counts
3 → 13
Calls
3 calls:
Slowest
66.0ms
(+ (* a d) (+ (* a b) (* a c)))
54.0ms
(+ (* a d) (+ (* a b) (* a c)))
1.0ms
0

prune111.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

regimes162.0ms

Accuracy

0% (0.0b remaining)

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

bsearch2.0ms

end0.0ms

sample972.0ms

Algorithm
intervals