Average Error: 0.0 → 0.0
Time: 17.2s
Precision: 64
Internal Precision: 128
\[\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1\]
\[(d1 \cdot \left(d2 - d3\right) + \left(d4 \cdot d1\right))_* - d1 \cdot d1\]

Error

Bits error versus d1

Bits error versus d2

Bits error versus d3

Bits error versus d4

Target

Original0.0
Target0.0
Herbie0.0
\[d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)\]

Derivation

  1. Initial program 0.0

    \[\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1\]
  2. Using strategy rm
  3. Applied distribute-lft-out--0.0

    \[\leadsto \left(\color{blue}{d1 \cdot \left(d2 - d3\right)} + d4 \cdot d1\right) - d1 \cdot d1\]
  4. Applied fma-def0.0

    \[\leadsto \color{blue}{(d1 \cdot \left(d2 - d3\right) + \left(d4 \cdot d1\right))_*} - d1 \cdot d1\]
  5. Final simplification0.0

    \[\leadsto (d1 \cdot \left(d2 - d3\right) + \left(d4 \cdot d1\right))_* - d1 \cdot d1\]

Reproduce

herbie shell --seed 2019016 +o rules:numerics
(FPCore (d1 d2 d3 d4)
  :name "FastMath dist4"

  :herbie-target
  (* d1 (- (+ (- d2 d3) d4) d1))

  (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))

Details

Time bar (total: 16.6s)Debug log

sample54.0ms

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

simplify139.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
139.0ms
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1))

prune17.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize33.0ms

Local error

Found 3 expressions with local error:

0.0b
(- (* d1 d2) (* d1 d3))
0.0b
(+ (- (* d1 d2) (* d1 d3)) (* d4 d1))
0.0b
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1))

rewrite82.0ms

Algorithm
rewrite-expression-head
Rules
19×add-log-exp
add-sqr-sqrt
add-cube-cbrt
diff-log
*-un-lft-identity
prod-diff
fma-neg
fma-def
sum-log
log1p-expm1-u
add-exp-log
add-cbrt-cube
sub-neg
associate-+l+
pow1
expm1-log1p-u
distribute-lft-out--
flip--
associate-+l-
flip3--
difference-of-squares
flip-+
associate--l+
flip3-+
+-commutative
associate--l-
Counts
3 → 64
Calls
3 calls:
Slowest
70.0ms
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1))
9.0ms
(+ (- (* d1 d2) (* d1 d3)) (* d4 d1))
2.0ms
(- (* d1 d2) (* d1 d3))

series113.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
56.0ms
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1))
34.0ms
(+ (- (* d1 d2) (* d1 d3)) (* d4 d1))
23.0ms
(- (* d1 d2) (* d1 d3))

simplify3.9s

Counts
36 → 73
Calls
36 calls:
Slowest
540.0ms
(fma (sqrt (+ (- (* d1 d2) (* d1 d3)) (* d4 d1))) (sqrt (+ (- (* d1 d2) (* d1 d3)) (* d4 d1))) (- (* d1 d1)))
341.0ms
(fma 1 (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (- (* d1 d1)))
327.0ms
(/ (* (exp (- (* d1 d2) (* d1 d3))) (exp (* d4 d1))) (exp (* d1 d1)))
313.0ms
(fma (* (cbrt (+ (- (* d1 d2) (* d1 d3)) (* d4 d1))) (cbrt (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)))) (cbrt (+ (- (* d1 d2) (* d1 d3)) (* d4 d1))) (- (* d1 d1)))
241.0ms
(* (exp (- (* d1 d2) (* d1 d3))) (exp (* d4 d1)))

prune884.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0b

localize19.0ms

Local error

Found 2 expressions with local error:

0.0b
(fma d1 (- d2 d3) (* d4 d1))
0.0b
(- (fma d1 (- d2 d3) (* d4 d1)) (* d1 d1))

rewrite8.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-log-exp
add-cube-cbrt
*-un-lft-identity
prod-diff
fma-neg
log1p-expm1-u
fma-udef
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
difference-of-squares
flip--
associate--l+
diff-log
flip3--
sub-neg
Counts
2 → 32
Calls
2 calls:
Slowest
7.0ms
(- (fma d1 (- d2 d3) (* d4 d1)) (* d1 d1))
0.0ms
(fma d1 (- d2 d3) (* d4 d1))

series96.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
56.0ms
(- (fma d1 (- d2 d3) (* d4 d1)) (* d1 d1))
39.0ms
(fma d1 (- d2 d3) (* d4 d1))

simplify1.7s

Counts
18 → 38
Calls
18 calls:
Slowest
305.0ms
(fma 1 (fma d1 (- d2 d3) (* d4 d1)) (- (* d1 d1)))
198.0ms
(/ (exp (fma d1 (- d2 d3) (* d4 d1))) (exp (* d1 d1)))
195.0ms
(fma (sqrt (fma d1 (- d2 d3) (* d4 d1))) (sqrt (fma d1 (- d2 d3) (* d4 d1))) (- (* d1 d1)))
163.0ms
(fma (* (cbrt (fma d1 (- d2 d3) (* d4 d1))) (cbrt (fma d1 (- d2 d3) (* d4 d1)))) (cbrt (fma d1 (- d2 d3) (* d4 d1))) (- (* d1 d1)))
131.0ms
(- (* d2 d1) (+ (pow d1 2) (* d3 d1)))

prune394.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0b

localize21.0ms

Local error

Found 1 expressions with local error:

0.0b
(* d1 (- (+ d2 d4) (+ d3 d1)))

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
18×prod-diff
16×*-un-lft-identity
16×add-sqr-sqrt
14×add-cube-cbrt
12×distribute-lft-in
12×distribute-rgt-in
associate-*r/
associate-*r*
flip-+
frac-sub
flip3-+
associate--l+
sub-neg
difference-of-squares
add-log-exp
distribute-lft-out--
flip--
log1p-expm1-u
*-commutative
add-exp-log
add-cbrt-cube
flip3--
pow1
expm1-log1p-u
Counts
1 → 45
Calls
1 calls:
Slowest
15.0ms
(* d1 (- (+ d2 d4) (+ d3 d1)))

series46.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
46.0ms
(* d1 (- (+ d2 d4) (+ d3 d1)))

simplify6.1s

Counts
38 → 48
Calls
38 calls:
Slowest
580.0ms
(* (fma (- (cbrt (+ d3 d1))) (* (cbrt (+ d3 d1)) (cbrt (+ d3 d1))) (* (cbrt (+ d3 d1)) (* (cbrt (+ d3 d1)) (cbrt (+ d3 d1))))) d1)
391.0ms
(* (+ (* d2 d2) (- (* d4 d4) (* d2 d4))) (+ (* d3 d3) (- (* d1 d1) (* d3 d1))))
334.0ms
(* d1 (fma (- (+ d3 d1)) 1 (* (+ d3 d1) 1)))
322.0ms
(* (fma (- (+ d3 d1)) 1 (* (+ d3 d1) 1)) d1)
301.0ms
(* (fma (- (+ d3 d1)) 1 (* (+ d3 d1) 1)) d1)

prune454.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0b

localize16.0ms

Local error

Found 1 expressions with local error:

0.0b
(fma (- d1) (+ d1 d3) (* d2 d1))

rewrite1.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 (- d1) (+ d1 d3) (* d2 d1))

series24.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
24.0ms
(fma (- d1) (+ d1 d3) (* d2 d1))

simplify379.0ms

Counts
3 → 13
Calls
3 calls:
Slowest
143.0ms
(- (* d2 d1) (+ (pow d1 2) (* d3 d1)))
127.0ms
(- (* d2 d1) (+ (pow d1 2) (* d3 d1)))
109.0ms
(- (* d2 d1) (+ (pow d1 2) (* d3 d1)))

prune111.0ms

Pruning

4 alts after pruning (1 fresh and 3 done)

Merged error: 0b

regimes203.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.8s

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