Average Error: 45.3 → 7.8
Time: 46.9s
Precision: 64
Internal Precision: 2368
\[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\begin{array}{l} \mathbf{if}\;\left((x \cdot y + z)_* - y \cdot x\right) - z \le -2.919718334020837 \cdot 10^{-16} \lor \neg \left(\left((x \cdot y + z)_* - y \cdot x\right) - z \le 0.0\right):\\ \;\;\;\;\log \left(e^{\log \left(e^{\left(\left((x \cdot y + z)_* - z\right) - y \cdot x\right) - 1}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\left(\left((x \cdot y + z)_* - y \cdot x\right) - z\right) - 1}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.3
Target0
Herbie7.8
\[-1\]

Derivation

  1. Split input into 2 regimes
  2. if (- (- (fma x y z) (* y x)) z) < -2.919718334020837e-16 or 0.0 < (- (- (fma x y z) (* y x)) z)

    1. Initial program 52.8

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

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

      \[\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-log54.4

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

      \[\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-exp38.4

      \[\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-exp54.1

      \[\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-exp54.4

      \[\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-log54.4

      \[\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-log54.4

      \[\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 simplify52.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+22.0

      \[\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 -2.919718334020837e-16 < (- (- (fma x y z) (* y x)) z) < 0.0

    1. Initial program 41.2

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

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

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\left((x \cdot y + z)_* - y \cdot x\right) - z \le -2.919718334020837 \cdot 10^{-16} \lor \neg \left(\left((x \cdot y + z)_* - y \cdot x\right) - z \le 0.0\right):\\ \;\;\;\;\log \left(e^{\log \left(e^{\left(\left((x \cdot y + z)_* - z\right) - y \cdot x\right) - 1}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\left(\left((x \cdot y + z)_* - y \cdot x\right) - z\right) - 1}\right)\\ \end{array}}\]

Runtime

Time bar (total: 46.9s)Debug logProfile

herbie shell --seed '#(1072936661 1621281212 3440817831 3219514234 460296804 1258167384)' 
(FPCore (x y z)
  :name "simple fma test"

  :herbie-target
  -1

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