Average Error: 45.1 → 8.1
Time: 24.5s
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.1
Target0
Herbie8.1
\[-1\]

Derivation

  1. Initial program 45.1

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

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

    \[\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.5

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

    \[\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.0

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

    \[\leadsto \log \color{blue}{\left(\frac{e^{-1}}{e^{x \cdot y - \left((x \cdot y + z)_* - z\right)}}\right)}\]
  10. Taylor expanded around -inf 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 2019022 
(FPCore (x y z)
  :name "simple fma test"

  :herbie-target
  -1

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

Details

Time bar (total: 24.0s)Debug log

sample122.0ms

Algorithm
intervals
Results
37.0ms21×body2560valid
37.0ms74×body1280valid
18.0ms49×body640valid
8.0ms80×body80valid
7.0ms24×body320valid
2.0msbody160valid

simplify247.0ms

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

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 42.5b

localize15.0ms

Local error

Found 2 expressions with local error:

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

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

series65.0ms

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

simplify1.3s

Counts
11 → 31
Calls
11 calls:
Slowest
300.0ms
(/ (exp (fma x y z)) (exp (+ 1 (+ (* x y) z))))
287.0ms
(- (fma x y z) (+ z (+ 1 (* x y))))
243.0ms
(- (fma x y z) (+ z (+ 1 (* x y))))
241.0ms
(- (fma x y z) (+ z (+ 1 (* x y))))
216.0ms
(- (fma x y z) (+ 1 (+ (* x y) z)))

prune345.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 29.1b

localize17.0ms

Local error

Found 4 expressions with local error:

9.1b
(+ (- -1 (* x y)) (- (fma x y z) z))
2.9b
(- (fma x y z) z)
0.3b
(log (exp (+ (- -1 (* x y)) (- (fma x y z) z))))
0.0b
(exp (+ (- -1 (* x y)) (- (fma x y z) z)))

rewrite107.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
45.0ms
(exp (+ (- -1 (* x y)) (- (fma x y z) z)))
41.0ms
(log (exp (+ (- -1 (* x y)) (- (fma x y z) z))))
14.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
5.0ms
(- (fma x y z) z)

series124.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
47.0ms
(exp (+ (- -1 (* x y)) (- (fma x y z) z)))
39.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
24.0ms
(log (exp (+ (- -1 (* x y)) (- (fma x y z) z))))
14.0ms
(- (fma x y z) z)

simplify7.9s

Counts
44 → 80
Calls
44 calls:
Slowest
502.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
487.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
481.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
443.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
439.0ms
(exp (* (cbrt (+ (- -1 (* x y)) (- (fma x y z) z))) (cbrt (+ (- -1 (* x y)) (- (fma x y z) z)))))

prune1.0s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 13.6b

localize26.0ms

Local error

Found 4 expressions with local error:

9.8b
(- (* x y) (- (fma x y z) z))
2.9b
(- (fma x y z) z)
0.3b
(log (/ (exp -1) (exp (- (* x y) (- (fma x y z) z)))))
0.0b
(/ (exp -1) (exp (- (* x y) (- (fma x y z) z))))

rewrite57.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
25.0ms
(log (/ (exp -1) (exp (- (* x y) (- (fma x y z) z)))))
18.0ms
(/ (exp -1) (exp (- (* x y) (- (fma x y z) z))))
8.0ms
(- (* x y) (- (fma x y z) z))
5.0ms
(- (fma x y z) z)

series232.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
118.0ms
(log (/ (exp -1) (exp (- (* x y) (- (fma x y z) z)))))
82.0ms
(/ (exp -1) (exp (- (* x y) (- (fma x y z) z))))
19.0ms
(- (* x y) (- (fma x y z) z))
13.0ms
(- (fma x y z) z)

simplify7.1s

Counts
87 → 112
Calls
87 calls:
Slowest
584.0ms
(/ (exp -1) (exp (- (+ z (* x y)) (fma x y z))))
345.0ms
(- -1 (- (* x y) (- (fma x y z) z)))
293.0ms
(- (log (/ (exp -1) (exp (- (fma x y z))))) (+ z (* x y)))
224.0ms
(/ (exp -1) (exp (- (- (fma x y z) z))))
207.0ms
(log (/ (* (cbrt (exp -1)) (cbrt (exp -1))) (* (cbrt (exp (- (* x y) (- (fma x y z) z)))) (cbrt (exp (- (* x y) (- (fma x y z) z)))))))

prune1.4s

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 7.5b

localize14.0ms

Local error

Found 2 expressions with local error:

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

rewrite9.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
7.0ms
(- (+ z (* x y)) (fma x y z))
1.0ms
(+ z (* x y))

series56.0ms

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

simplify143.0ms

Counts
10 → 31
Calls
10 calls:
Slowest
57.0ms
(/ (exp (+ z (* x y))) (exp (fma x y z)))
26.0ms
(- (+ z (* x y)) (fma x y z))
25.0ms
(- (+ z (* x y)) (fma x y z))
16.0ms
(- (+ z (* x y)) (fma x y z))
5.0ms
(- z (fma x y z))

prune347.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 7.4b

regimes77.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample3.2s

Algorithm
intervals
Results
1.6s2626×body1280valid
470.0ms1636×body640valid
429.0ms603×body2560valid
272.0ms707×body320valid
196.0ms2101×body80valid
72.0ms327×body160valid