Average Error: 45.2 → 20.4
Time: 3.1m
Precision: 64
Internal Precision: 2368
\[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\begin{array}{l} \mathbf{if}\;\sqrt[3]{{\left(\left((x \cdot y + z)_* - y \cdot x\right) - \left(1 + z\right)\right)}^{3}} \le -8.160519111197536 \cdot 10^{-155}:\\ \;\;\;\;\left((x \cdot y + z)_* - y \cdot x\right) - \left(1 + z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 - y \cdot x\right) \cdot \left((x \cdot y + z)_* - z\right) - 1}{1 - y \cdot x}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.2
Target0
Herbie20.4
\[-1\]

Derivation

  1. Split input into 2 regimes
  2. if (cbrt (pow (- (- (fma x y z) (* y x)) (+ 1 z)) 3)) < -8.160519111197536e-155

    1. Initial program 27.3

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

      \[\leadsto \color{blue}{\sqrt[3]{\left(\left((x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\right) \cdot \left((x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\right)\right) \cdot \left((x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\right)}}\]
    4. Applied simplify5.8

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\left((x \cdot y + z)_* - y \cdot x\right) - \left(1 + z\right)\right)}^{3}}}\]
    5. Taylor expanded around 0 5.8

      \[\leadsto \sqrt[3]{{\left(\color{blue}{\left((x \cdot y + z)_* - x \cdot y\right)} - \left(1 + z\right)\right)}^{3}}\]
    6. Applied simplify5.8

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

    if -8.160519111197536e-155 < (cbrt (pow (- (- (fma x y z) (* y x)) (+ 1 z)) 3))

    1. Initial program 62.4

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

      \[\leadsto \color{blue}{\sqrt[3]{\left(\left((x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\right) \cdot \left((x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\right)\right) \cdot \left((x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\right)}}\]
    4. Applied simplify62.5

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\left((x \cdot y + z)_* - y \cdot x\right) - \left(1 + z\right)\right)}^{3}}}\]
    5. Using strategy rm
    6. Applied add-log-exp63.1

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

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

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

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

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

      \[\leadsto \sqrt[3]{{\left(\log \color{blue}{\left(e^{\left((x \cdot y + z)_* - z\right) - \left(1 + y \cdot x\right)}\right)}\right)}^{3}}\]
    12. Using strategy rm
    13. Applied flip-+34.8

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

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

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

      \[\leadsto \sqrt[3]{{\left(\log \left(e^{\frac{\color{blue}{\left(\left(1 - y \cdot x\right) \cdot \left((x \cdot y + z)_* - z\right) - \left(1 - \left(y \cdot x\right) \cdot \left(y \cdot x\right)\right)\right) \cdot \left((x \cdot y + z)_* + z\right)}}{\left((x \cdot y + z)_* + z\right) \cdot \left(1 - y \cdot x\right)}}\right)\right)}^{3}}\]
    17. Taylor expanded around 0 34.8

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\sqrt[3]{{\left(\left((x \cdot y + z)_* - y \cdot x\right) - \left(1 + z\right)\right)}^{3}} \le -8.160519111197536 \cdot 10^{-155}:\\ \;\;\;\;\left((x \cdot y + z)_* - y \cdot x\right) - \left(1 + z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 - y \cdot x\right) \cdot \left((x \cdot y + z)_* - z\right) - 1}{1 - y \cdot x}\\ \end{array}}\]

Runtime

Time bar (total: 3.1m)Debug logProfile

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

  :herbie-target
  -1

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