Average Error: 45.2 → 24.4
Time: 1.5m
Precision: 64
Internal Precision: 2432
\[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\begin{array}{l} \mathbf{if}\;z \le -1285573289984.7488:\\ \;\;\;\;\log \left(e^{\left((\left(\frac{1}{x}\right) \cdot \left(\frac{1}{y}\right) + \left(\frac{1}{z}\right))_* - \frac{1}{y \cdot x}\right) - 1}\right)\\ \mathbf{if}\;z \le 2.7830005542474225 \cdot 10^{+18}:\\ \;\;\;\;(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\left((\left(\frac{1}{x}\right) \cdot \left(\frac{1}{y}\right) + \left(\frac{1}{z}\right))_* - \frac{1}{y \cdot x}\right) - 1}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.2
Target0.0
Herbie24.4
\[-1\]

Derivation

  1. Split input into 2 regimes
  2. if z < -1285573289984.7488 or 2.7830005542474225e+18 < z

    1. Initial program 61.9

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

      \[\leadsto (x \cdot y + z)_* - \left(1 + \color{blue}{\left(\sqrt[3]{x \cdot y + z} \cdot \sqrt[3]{x \cdot y + z}\right) \cdot \sqrt[3]{x \cdot y + z}}\right)\]
    4. Taylor expanded around inf 56.0

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

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

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

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

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

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

    if -1285573289984.7488 < z < 2.7830005542474225e+18

    1. Initial program 30.1

      \[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 1.5m)Debug logProfile

herbie shell --seed '#(1063027428 1192549564 1443466578 604016274 3637110559 1698629644)' 
(FPCore (x y z)
  :name "simple fma test"

  :herbie-target
  -1

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