Average Error: 45.3 → 24.3
Time: 36.6s
Precision: 64
Internal Precision: 2432
\[(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)_* - \frac{\left(y \cdot x\right) \cdot \left(y \cdot x\right)}{y \cdot x - z}\right) + \frac{z \cdot z}{y \cdot x - z}\right) + \left(-1\right)}\right) = -\infty:\\ \;\;\;\;\log \left(e^{\left((x \cdot y + z)_* - \frac{y \cdot x}{1} \cdot \frac{y \cdot x}{y \cdot x - z}\right) + \left(\frac{z \cdot z}{y \cdot x - z} - 1\right)}\right)\\ \mathbf{if}\;\log \left(e^{\left(\left((x \cdot y + z)_* - \frac{\left(y \cdot x\right) \cdot \left(y \cdot x\right)}{y \cdot x - z}\right) + \frac{z \cdot z}{y \cdot x - z}\right) + \left(-1\right)}\right) \le -1.0:\\ \;\;\;\;\log \left(e^{\left(\left((x \cdot y + z)_* - \frac{\left(y \cdot x\right) \cdot \left(y \cdot x\right)}{y \cdot x - z}\right) + \frac{z \cdot z}{y \cdot x - z}\right) + \left(-1\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\left((x \cdot y + z)_* - \frac{y \cdot x}{1} \cdot \frac{y \cdot x}{y \cdot x - z}\right) + \left(\frac{z \cdot z}{y \cdot x - z} - 1\right)}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Split input into 2 regimes
  2. if (log (exp (+ (+ (- (fma x y z) (/ (* (* y x) (* y x)) (- (* y x) z))) (/ (* z z) (- (* y x) z))) (- 1)))) < -inf.0 or -1.0 < (log (exp (+ (+ (- (fma x y z) (/ (* (* y x) (* y x)) (- (* y x) z))) (/ (* z z) (- (* y x) z))) (- 1))))

    1. Initial program 62.2

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

      \[\leadsto (x \cdot y + z)_* - \left(1 + \color{blue}{\frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - z \cdot z}{x \cdot y - z}}\right)\]
    4. Using strategy rm
    5. Applied div-sub62.8

      \[\leadsto (x \cdot y + z)_* - \left(1 + \color{blue}{\left(\frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right)}{x \cdot y - z} - \frac{z \cdot z}{x \cdot y - z}\right)}\right)\]
    6. Applied associate-+r-62.8

      \[\leadsto (x \cdot y + z)_* - \color{blue}{\left(\left(1 + \frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right)}{x \cdot y - z}\right) - \frac{z \cdot z}{x \cdot y - z}\right)}\]
    7. Applied associate--r-62.8

      \[\leadsto \color{blue}{\left((x \cdot y + z)_* - \left(1 + \frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right)}{x \cdot y - z}\right)\right) + \frac{z \cdot z}{x \cdot y - z}}\]
    8. Using strategy rm
    9. Applied add-log-exp63.0

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

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

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

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

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

      \[\leadsto \log \color{blue}{\left(e^{\left((x \cdot y + z)_* - \frac{\left(y \cdot x\right) \cdot \left(y \cdot x\right)}{y \cdot x - z}\right) + \left(\frac{z \cdot z}{y \cdot x - z} - 1\right)}\right)}\]
    15. Using strategy rm
    16. Applied *-un-lft-identity62.8

      \[\leadsto \log \left(e^{\left((x \cdot y + z)_* - \frac{\left(y \cdot x\right) \cdot \left(y \cdot x\right)}{\color{blue}{1 \cdot \left(y \cdot x - z\right)}}\right) + \left(\frac{z \cdot z}{y \cdot x - z} - 1\right)}\right)\]
    17. Applied times-frac48.3

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

    if -inf.0 < (log (exp (+ (+ (- (fma x y z) (/ (* (* y x) (* y x)) (- (* y x) z))) (/ (* z z) (- (* y x) z))) (- 1)))) < -1.0

    1. Initial program 28.3

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

      \[\leadsto (x \cdot y + z)_* - \left(1 + \color{blue}{\frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - z \cdot z}{x \cdot y - z}}\right)\]
    4. Using strategy rm
    5. Applied div-sub28.4

      \[\leadsto (x \cdot y + z)_* - \left(1 + \color{blue}{\left(\frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right)}{x \cdot y - z} - \frac{z \cdot z}{x \cdot y - z}\right)}\right)\]
    6. Applied associate-+r-28.4

      \[\leadsto (x \cdot y + z)_* - \color{blue}{\left(\left(1 + \frac{\left(x \cdot y\right) \cdot \left(x \cdot y\right)}{x \cdot y - z}\right) - \frac{z \cdot z}{x \cdot y - z}\right)}\]
    7. Applied associate--r-28.4

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

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

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

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

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

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

      \[\leadsto \log \color{blue}{\left(e^{\left((x \cdot y + z)_* - \frac{\left(y \cdot x\right) \cdot \left(y \cdot x\right)}{y \cdot x - z}\right) + \left(\frac{z \cdot z}{y \cdot x - z} - 1\right)}\right)}\]
    15. Using strategy rm
    16. Applied sub-neg15.9

      \[\leadsto \log \left(e^{\left((x \cdot y + z)_* - \frac{\left(y \cdot x\right) \cdot \left(y \cdot x\right)}{y \cdot x - z}\right) + \color{blue}{\left(\frac{z \cdot z}{y \cdot x - z} + \left(-1\right)\right)}}\right)\]
    17. Applied associate-+r+0.2

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

Runtime

Time bar (total: 36.6s)Debug logProfile

herbie shell --seed '#(1070227846 1561819246 480764335 4016816270 2602869839 2117310382)' 
(FPCore (x y z)
  :name "simple fma test"

  :herbie-target
  -1

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