Average Error: 45.2 → 8.1
Time: 53.4s
Precision: 64
Internal Precision: 2368
\[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\begin{array}{l} \mathbf{if}\;\log \left(e^{\left(\left((x \cdot y + z)_* - y \cdot x\right) - z\right) - 1}\right) \le -1.0000000000039062:\\ \;\;\;\;\log \left(e^{\log \left(e^{\left(\left((x \cdot y + z)_* - z\right) - y \cdot x\right) - 1}\right)}\right)\\ \mathbf{if}\;\log \left(e^{\left(\left((x \cdot y + z)_* - y \cdot x\right) - z\right) - 1}\right) \le -0.9882888793945312:\\ \;\;\;\;\log \left(e^{\left(\left((x \cdot y + z)_* - y \cdot x\right) - z\right) - 1}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\log \left(e^{\left(\left((x \cdot y + z)_* - z\right) - y \cdot x\right) - 1}\right)}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Split input into 2 regimes
  2. if (log (exp (- (- (- (fma x y z) (* y x)) z) 1))) < -1.0000000000039062 or -0.9882888793945312 < (log (exp (- (- (- (fma x y z) (* y x)) z) 1)))

    1. Initial program 62.8

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

      \[\leadsto (x \cdot y + z)_* - \color{blue}{\log \left(e^{1 + \left(x \cdot y + z\right)}\right)}\]
    4. Applied add-log-exp63.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-log63.6

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

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

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

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

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

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

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

      \[\leadsto \log \left(e^{\log \color{blue}{\left(e^{\left((x \cdot y + z)_* - z\right) - \left(y \cdot x + 1\right)}\right)}}\right)\]
    14. Using strategy rm
    15. Applied associate--r+38.4

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

    if -1.0000000000039062 < (log (exp (- (- (- (fma x y z) (* y x)) z) 1))) < -0.9882888793945312

    1. Initial program 40.6

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

      \[\leadsto (x \cdot y + z)_* - \color{blue}{\log \left(e^{1 + \left(x \cdot y + z\right)}\right)}\]
    4. Applied add-log-exp43.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-log43.5

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

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

      \[\leadsto \log \left(e^{\color{blue}{\left(\left((x \cdot y + z)_* - y \cdot x\right) - z\right) - 1}}\right)\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 53.4s)Debug logProfile

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

  :herbie-target
  -1

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