Average Error: 0.1 → 0.1
Time: 5.3s
Precision: 64
\[x - \left(y \cdot 4\right) \cdot z\]
\[\mathsf{fma}\left(y \cdot 4, -z, x\right)\]
x - \left(y \cdot 4\right) \cdot z
\mathsf{fma}\left(y \cdot 4, -z, x\right)
double f(double x, double y, double z) {
        double r145845 = x;
        double r145846 = y;
        double r145847 = 4.0;
        double r145848 = r145846 * r145847;
        double r145849 = z;
        double r145850 = r145848 * r145849;
        double r145851 = r145845 - r145850;
        return r145851;
}

double f(double x, double y, double z) {
        double r145852 = y;
        double r145853 = 4.0;
        double r145854 = r145852 * r145853;
        double r145855 = z;
        double r145856 = -r145855;
        double r145857 = x;
        double r145858 = fma(r145854, r145856, r145857);
        return r145858;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

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

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

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

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

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

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

Reproduce

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