Average Error: 45.4 → 8.0
Time: 18.8s
Precision: 64
Internal Precision: 128
\[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
\[-1 - \left(\left(z + x \cdot y\right) - (x \cdot y + z)_*\right)\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.4
Target0
Herbie8.0
\[-1\]

Derivation

  1. Initial program 45.4

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

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

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

    \[\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-14.9

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

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

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

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

    \[\leadsto -1 - \color{blue}{\left(\left(z + x \cdot y\right) - (x \cdot y + z)_*\right)}\]
  13. Final simplification8.0

    \[\leadsto -1 - \left(\left(z + x \cdot y\right) - (x \cdot y + z)_*\right)\]

Reproduce

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

  :herbie-target
  -1

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

Details

Time bar (total: 18.2s)Debug log

sample110.0ms

Algorithm
intervals

simplify325.0ms

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

prune10.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 45.4b

localize29.0ms

Local error

Found 3 expressions with local error:

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

rewrite20.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
flip-+
flip3-+
+-commutative
difference-of-squares
distribute-lft-out--
associate--r+
flip--
diff-log
flip3--
sub-neg
associate-+r+
Counts
3 → 36
Calls
3 calls:
Slowest
13.0ms
(- (fma x y z) (+ 1 (+ (* x y) z)))
3.0ms
(+ (* x y) z)
3.0ms
(+ 1 (+ (* x y) z))

series107.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
54.0ms
(- (fma x y z) (+ 1 (+ (* x y) z)))
28.0ms
(+ 1 (+ (* x y) z))
25.0ms
(+ (* x y) z)

simplify1.5s

Counts
14 → 45
Calls
14 calls:
Slowest
347.0ms
(/ (exp (fma x y z)) (exp (+ 1 (+ (* x y) z))))
296.0ms
(- (fma x y z) (+ z (+ 1 (* x y))))
273.0ms
(- (fma x y z) (+ z (+ 1 (* x y))))
256.0ms
(- (fma x y z) (+ 1 (+ (* x y) z)))
247.0ms
(- (fma x y z) (+ z (+ 1 (* x y))))

prune490.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 29.2b

localize13.0ms

Local error

Found 4 expressions with local error:

8.0b
(+ (- -1 (* x y)) (- (fma x y z) z))
1.2b
(- (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)))

rewrite86.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
38.0ms
(exp (+ (- -1 (* x y)) (- (fma x y z) z)))
36.0ms
(log (exp (+ (- -1 (* x y)) (- (fma x y z) z))))
8.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
3.0ms
(- (fma x y z) z)

series102.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
31.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
26.0ms
(exp (+ (- -1 (* x y)) (- (fma x y z) z)))
25.0ms
(log (exp (+ (- -1 (* x y)) (- (fma x y z) z))))
19.0ms
(- (fma x y z) z)

simplify9.0s

Counts
44 → 80
Calls
44 calls:
Slowest
975.0ms
(cbrt (+ (- -1 (* x y)) (- (fma x y z) z)))
556.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
525.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
523.0ms
(+ (- -1 (* x y)) (- (fma x y z) z))
514.0ms
(sqrt (+ (- -1 (* x y)) (- (fma x y z) z)))

prune970.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 10.7b

localize17.0ms

Local error

Found 3 expressions with local error:

7.5b
(- (* x y) (- (fma x y z) z))
2.3b
(log (exp (- (* x y) (- (fma x y z) z))))
1.2b
(- (fma x y z) z)

rewrite21.0ms

Algorithm
rewrite-expression-head
Rules
log-prod
add-log-exp
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
log-pow
sub-neg
pow1
add-exp-log
exp-sum
add-cbrt-cube
exp-prod
associate--r-
associate--r+
flip--
flip3--
rem-log-exp
diff-log
exp-diff
log-div
Counts
3 → 45
Calls
3 calls:
Slowest
14.0ms
(log (exp (- (* x y) (- (fma x y z) z))))
4.0ms
(- (* x y) (- (fma x y z) z))
3.0ms
(- (fma x y z) z)

series79.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
33.0ms
(log (exp (- (* x y) (- (fma x y z) z))))
23.0ms
(- (* x y) (- (fma x y z) z))
22.0ms
(- (fma x y z) z)

simplify584.0ms

Counts
23 → 54
Calls
23 calls:
Slowest
149.0ms
(log (* (cbrt (exp (- (* x y) (- (fma x y z) z)))) (cbrt (exp (- (* x y) (- (fma x y z) z))))))
78.0ms
(/ (exp (* x y)) (exp (- (fma x y z) z)))
74.0ms
(log (sqrt (exp (- (* x y) (- (fma x y z) z)))))
46.0ms
(sqrt (- (* x y) (- (fma x y z) z)))
30.0ms
(cbrt (- (* x y) (- (fma x y z) z)))

prune605.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 6.9b

localize13.0ms

Local error

Found 2 expressions with local error:

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

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

series36.0ms

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

simplify203.0ms

Counts
10 → 31
Calls
10 calls:
Slowest
82.0ms
(/ (exp (+ z (* x y))) (exp (fma x y z)))
36.0ms
(- (+ z (* x y)) (fma x y z))
28.0ms
(- (+ z (* x y)) (fma x y z))
24.0ms
(- (+ z (* x y)) (fma x y z))
11.0ms
(- (sqrt (+ z (* x y))) (sqrt (fma x y z)))

prune357.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 6.6b

regimes110.0ms

Accuracy

0% (0.1b remaining)

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

bsearch1.0ms

end0.0ms

sample3.3s

Algorithm
intervals