Average Error: 0.0 → 0.0
Time: 3.8s
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 r221051 = x;
        double r221052 = y;
        double r221053 = 4.0;
        double r221054 = r221052 * r221053;
        double r221055 = z;
        double r221056 = r221054 * r221055;
        double r221057 = r221051 - r221056;
        return r221057;
}

double f(double x, double y, double z) {
        double r221058 = y;
        double r221059 = 4.0;
        double r221060 = r221058 * r221059;
        double r221061 = z;
        double r221062 = -r221061;
        double r221063 = x;
        double r221064 = fma(r221060, r221062, r221063);
        return r221064;
}

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.0

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

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

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

Reproduce

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