Average Error: 0.0 → 0.0
Time: 4.9s
Precision: 64
\[x - \left(y \cdot 4\right) \cdot z\]
\[\mathsf{fma}\left(-4 \cdot z, y, x\right) + 4 \cdot \left(z \cdot \left(y - y\right)\right)\]
x - \left(y \cdot 4\right) \cdot z
\mathsf{fma}\left(-4 \cdot z, y, x\right) + 4 \cdot \left(z \cdot \left(y - y\right)\right)
double f(double x, double y, double z) {
        double r190337 = x;
        double r190338 = y;
        double r190339 = 4.0;
        double r190340 = r190338 * r190339;
        double r190341 = z;
        double r190342 = r190340 * r190341;
        double r190343 = r190337 - r190342;
        return r190343;
}

double f(double x, double y, double z) {
        double r190344 = 4.0;
        double r190345 = z;
        double r190346 = r190344 * r190345;
        double r190347 = -r190346;
        double r190348 = y;
        double r190349 = x;
        double r190350 = fma(r190347, r190348, r190349);
        double r190351 = r190348 - r190348;
        double r190352 = r190345 * r190351;
        double r190353 = r190344 * r190352;
        double r190354 = r190350 + r190353;
        return r190354;
}

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

    \[\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}{4 \cdot \left(z \cdot \left(y - y\right)\right)}\]
  7. Using strategy rm
  8. Applied rem-cube-cbrt0.0

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

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

Reproduce

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