Average Error: 45.3 → 8.1
Time: 26.4s
Precision: 64
Internal Precision: 128
\[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\log \left(\frac{e^{-1}}{e^{\left(x \cdot y + z\right) - (x \cdot y + z)_*}}\right)\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.3
Target0
Herbie8.1
\[-1\]

Derivation

  1. Initial program 45.3

    \[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
  2. Using strategy rm
  3. Applied add-log-exp47.1

    \[\leadsto (x \cdot y + z)_* - \color{blue}{\log \left(e^{1 + \left(x \cdot y + z\right)}\right)}\]
  4. Applied add-log-exp47.6

    \[\leadsto \color{blue}{\log \left(e^{(x \cdot y + z)_*}\right)} - \log \left(e^{1 + \left(x \cdot y + z\right)}\right)\]
  5. Applied diff-log47.6

    \[\leadsto \color{blue}{\log \left(\frac{e^{(x \cdot y + z)_*}}{e^{1 + \left(x \cdot y + z\right)}}\right)}\]
  6. Simplified30.9

    \[\leadsto \log \color{blue}{\left(e^{\left(-1 - x \cdot y\right) + \left((x \cdot y + z)_* - z\right)}\right)}\]
  7. Using strategy rm
  8. Applied associate-+l-15.2

    \[\leadsto \log \left(e^{\color{blue}{-1 - \left(x \cdot y - \left((x \cdot y + z)_* - z\right)\right)}}\right)\]
  9. Applied exp-diff15.2

    \[\leadsto \log \color{blue}{\left(\frac{e^{-1}}{e^{x \cdot y - \left((x \cdot y + z)_* - z\right)}}\right)}\]
  10. Taylor expanded around 0 8.1

    \[\leadsto \log \left(\frac{e^{-1}}{e^{\color{blue}{\left(z + x \cdot y\right) - (x \cdot y + z)_*}}}\right)\]
  11. Final simplification8.1

    \[\leadsto \log \left(\frac{e^{-1}}{e^{\left(x \cdot y + z\right) - (x \cdot y + z)_*}}\right)\]

Reproduce

herbie shell --seed 2019016 
(FPCore (x y z)
  :name "simple fma test"

  :herbie-target
  -1

  (- (fma x y z) (+ 1 (+ (* x y) z))))

Details

Time bar (total: 25.8s)Debug log

sample127.0ms

Algorithm
intervals
Results
256×(pre true 80)
84×(body real 1280)
68×(body real 80)
53×(body real 640)
24×(body real 2560)
19×(body real 320)
(body real 160)

simplify295.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
294.0ms
(- (fma x y z) (+ 1 (+ (* x y) z)))

prune6.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 44.8b

localize32.0ms

Local error

Found 2 expressions with local error:

10.3b
(- (fma x y z) (+ 1 (+ (* x y) z)))
0.0b
(+ (* x y) z)

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
*-un-lft-identity
add-sqr-sqrt
add-cube-cbrt
add-exp-log
add-cbrt-cube
pow1
difference-of-squares
distribute-lft-out--
associate--r+
flip--
flip-+
diff-log
flip3--
flip3-+
sub-neg
+-commutative
Counts
2 → 25
Calls
2 calls:
Slowest
12.0ms
(- (fma x y z) (+ 1 (+ (* x y) z)))
3.0ms
(+ (* x y) z)

series54.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
40.0ms
(- (fma x y z) (+ 1 (+ (* x y) z)))
14.0ms
(+ (* x y) z)

simplify1.4s

Counts
11 → 31
Calls
11 calls:
Slowest
287.0ms
(/ (exp (fma x y z)) (exp (+ 1 (+ (* x y) z))))
276.0ms
(- (fma x y z) (+ 1 (+ (* x y) z)))
275.0ms
(- (fma x y z) (+ z (+ 1 (* x y))))
274.0ms
(- (fma x y z) (+ z (+ 1 (* x y))))
236.0ms
(- (fma x y z) (+ z (+ 1 (* x y))))

prune359.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 29.9b

localize15.0ms

Local error

Found 4 expressions with local error:

10.0b
(+ (- -1 (* x y)) (- (fma x y z) z))
1.5b
(- (fma x y z) z)
0.2b
(log (exp (+ (- -1 (* x y)) (- (fma x y z) z))))
0.0b
(exp (+ (- -1 (* x y)) (- (fma x y z) z)))

rewrite71.0ms

Algorithm
rewrite-expression-head
Rules
13×*-un-lft-identity
add-log-exp
exp-prod
add-cube-cbrt
add-sqr-sqrt
flip--
log-pow
flip3--
pow1
add-exp-log
frac-add
exp-diff
add-cbrt-cube
log-prod
distribute-lft-out
associate-+l-
sub-neg
associate-+r-
rem-exp-log
exp-sum
sum-log
associate-+r+
associate-+l+
log-div
flip-+
rem-log-exp
flip3-+
+-commutative
Counts
4 → 68
Calls
4 calls:
Slowest
30.0ms
(exp (+ (- -1 (* x y)) (- (fma x y z) z)))
27.0ms
(log (exp (+ (- -1 (* x y)) (- (fma x y z) z))))
9.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
3.0ms
(- (fma x y z) z)

series134.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
44.0ms
(exp (+ (- -1 (* x y)) (- (fma x y z) z)))
41.0ms
(log (exp (+ (- -1 (* x y)) (- (fma x y z) z))))
28.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
21.0ms
(- (fma x y z) z)

simplify8.6s

Counts
44 → 80
Calls
44 calls:
Slowest
550.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
516.0ms
(sqrt (+ (- -1 (* x y)) (- (fma x y z) z)))
510.0ms
(exp (sqrt (+ (- -1 (* x y)) (- (fma x y z) z))))
483.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
482.0ms
(exp (* (cbrt (+ (- -1 (* x y)) (- (fma x y z) z))) (cbrt (+ (- -1 (* x y)) (- (fma x y z) z)))))

prune931.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 15.7b

localize20.0ms

Local error

Found 4 expressions with local error:

9.7b
(- (* x y) (- (fma x y z) z))
1.5b
(- (fma x y z) z)
0.2b
(log (/ (exp -1) (exp (- (* x y) (- (fma x y z) z)))))
0.0b
(/ (exp -1) (exp (- (* x y) (- (fma x y z) z))))

rewrite62.0ms

Algorithm
rewrite-expression-head
Rules
36×times-frac
25×add-cube-cbrt
25×*-un-lft-identity
25×add-sqr-sqrt
23×log-prod
21×exp-sum
10×sub-neg
associate--r-
add-log-exp
add-cbrt-cube
associate-/r*
add-exp-log
pow1
associate-/l*
associate--r+
flip--
div-inv
associate-/r/
rem-log-exp
div-exp
exp-diff
flip3--
log-pow
diff-log
frac-2neg
clear-num
log-div
cbrt-undiv
Counts
4 → 100
Calls
4 calls:
Slowest
37.0ms
(/ (exp -1) (exp (- (* x y) (- (fma x y z) z))))
15.0ms
(log (/ (exp -1) (exp (- (* x y) (- (fma x y z) z)))))
5.0ms
(- (* x y) (- (fma x y z) z))
3.0ms
(- (fma x y z) z)

series247.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
108.0ms
(log (/ (exp -1) (exp (- (* x y) (- (fma x y z) z)))))
81.0ms
(/ (exp -1) (exp (- (* x y) (- (fma x y z) z))))
37.0ms
(- (* x y) (- (fma x y z) z))
21.0ms
(- (fma x y z) z)

simplify7.0s

Counts
87 → 112
Calls
87 calls:
Slowest
324.0ms
(- -1 (- (* x y) (- (fma x y z) z)))
304.0ms
(- (log (/ (exp -1) (exp (- (fma x y z))))) (+ z (* x y)))
212.0ms
(/ (exp -1) (exp (- (- (fma x y z) z))))
209.0ms
(/ (exp -1) (exp (- (- (fma x y z) z))))
198.0ms
(/ (sqrt (exp -1)) (exp (- (* x y) (- (fma x y z) z))))

prune1.5s

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 8.9b

localize27.0ms

Local error

Found 2 expressions with local error:

8.9b
(- (+ z (* x y)) (fma x y z))
0.0b
(+ z (* x y))

rewrite11.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
*-un-lft-identity
add-sqr-sqrt
add-cube-cbrt
add-exp-log
add-cbrt-cube
pow1
difference-of-squares
distribute-lft-out--
flip--
flip-+
associate--l+
diff-log
flip3--
flip3-+
sub-neg
+-commutative
Counts
2 → 25
Calls
2 calls:
Slowest
9.0ms
(- (+ z (* x y)) (fma x y z))
1.0ms
(+ z (* x y))

series59.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
31.0ms
(- (+ z (* x y)) (fma x y z))
28.0ms
(+ z (* x y))

simplify169.0ms

Counts
10 → 31
Calls
10 calls:
Slowest
71.0ms
(/ (exp (+ z (* x y))) (exp (fma x y z)))
24.0ms
(- (+ z (* x y)) (fma x y z))
24.0ms
(- (+ z (* x y)) (fma x y z))
21.0ms
(- (+ z (* x y)) (fma x y z))
13.0ms
(- (sqrt (+ z (* x y))) (sqrt (fma x y z)))

prune456.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 8.9b

regimes109.0ms

Accuracy

0% (0.1b remaining)

Error of 8.1b against oracle of 8.0b and baseline of 8.1b

bsearch4.0ms

end0.0ms

sample4.1s

Algorithm
intervals
Results
8000×(pre true 80)
2621×(body real 1280)
2072×(body real 80)
1618×(body real 640)
729×(body real 320)
609×(body real 2560)
351×(body real 160)