Average Error: 0.0 → 0.1
Time: 3.5s
Precision: 64
\[x - \left(y \cdot 4\right) \cdot z\]
\[\left(y - y\right) \cdot \left(4 \cdot z\right) + \mathsf{fma}\left(-4 \cdot z, y, x\right)\]
x - \left(y \cdot 4\right) \cdot z
\left(y - y\right) \cdot \left(4 \cdot z\right) + \mathsf{fma}\left(-4 \cdot z, y, x\right)
double f(double x, double y, double z) {
        double r189752 = x;
        double r189753 = y;
        double r189754 = 4.0;
        double r189755 = r189753 * r189754;
        double r189756 = z;
        double r189757 = r189755 * r189756;
        double r189758 = r189752 - r189757;
        return r189758;
}

double f(double x, double y, double z) {
        double r189759 = y;
        double r189760 = r189759 - r189759;
        double r189761 = 4.0;
        double r189762 = z;
        double r189763 = r189761 * r189762;
        double r189764 = r189760 * r189763;
        double r189765 = -r189763;
        double r189766 = x;
        double r189767 = fma(r189765, r189759, r189766);
        double r189768 = r189764 + r189767;
        return r189768;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[x - \left(y \cdot 4\right) \cdot z\]
  2. Using strategy rm
  3. Applied add-cube-cbrt0.8

    \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}} - \left(y \cdot 4\right) \cdot z\]
  4. Applied prod-diff0.8

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -z \cdot \left(y \cdot 4\right)\right) + \mathsf{fma}\left(-z, y \cdot 4, z \cdot \left(y \cdot 4\right)\right)}\]
  5. Simplified0.9

    \[\leadsto \color{blue}{\mathsf{fma}\left(-4 \cdot z, y, {\left(\sqrt[3]{x}\right)}^{3}\right)} + \mathsf{fma}\left(-z, y \cdot 4, z \cdot \left(y \cdot 4\right)\right)\]
  6. Simplified0.8

    \[\leadsto \mathsf{fma}\left(-4 \cdot z, y, {\left(\sqrt[3]{x}\right)}^{3}\right) + \color{blue}{\left(y - y\right) \cdot \left(4 \cdot z\right)}\]
  7. Using strategy rm
  8. Applied *-un-lft-identity0.8

    \[\leadsto \mathsf{fma}\left(-4 \cdot z, y, {\left(\sqrt[3]{\color{blue}{1 \cdot x}}\right)}^{3}\right) + \left(y - y\right) \cdot \left(4 \cdot z\right)\]
  9. Applied cbrt-prod0.8

    \[\leadsto \mathsf{fma}\left(-4 \cdot z, y, {\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{x}\right)}}^{3}\right) + \left(y - y\right) \cdot \left(4 \cdot z\right)\]
  10. Applied unpow-prod-down0.8

    \[\leadsto \mathsf{fma}\left(-4 \cdot z, y, \color{blue}{{\left(\sqrt[3]{1}\right)}^{3} \cdot {\left(\sqrt[3]{x}\right)}^{3}}\right) + \left(y - y\right) \cdot \left(4 \cdot z\right)\]
  11. Simplified0.8

    \[\leadsto \mathsf{fma}\left(-4 \cdot z, y, \color{blue}{1} \cdot {\left(\sqrt[3]{x}\right)}^{3}\right) + \left(y - y\right) \cdot \left(4 \cdot z\right)\]
  12. Simplified0.1

    \[\leadsto \mathsf{fma}\left(-4 \cdot z, y, 1 \cdot \color{blue}{x}\right) + \left(y - y\right) \cdot \left(4 \cdot z\right)\]
  13. Final simplification0.1

    \[\leadsto \left(y - y\right) \cdot \left(4 \cdot z\right) + \mathsf{fma}\left(-4 \cdot z, y, x\right)\]

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, A"
  :precision binary64
  (- x (* (* y 4) z)))