Average Error: 0.0 → 0.0
Time: 21.0s
Precision: 64
\[x \cdot x - \left(y \cdot 4\right) \cdot z\]
\[\mathsf{fma}\left(x, x, -z \cdot \left(y \cdot 4\right)\right) + \mathsf{fma}\left(-z, y \cdot 4, z \cdot \left(y \cdot 4\right)\right)\]
x \cdot x - \left(y \cdot 4\right) \cdot z
\mathsf{fma}\left(x, x, -z \cdot \left(y \cdot 4\right)\right) + \mathsf{fma}\left(-z, y \cdot 4, z \cdot \left(y \cdot 4\right)\right)
double f(double x, double y, double z) {
        double r22951638 = x;
        double r22951639 = r22951638 * r22951638;
        double r22951640 = y;
        double r22951641 = 4.0;
        double r22951642 = r22951640 * r22951641;
        double r22951643 = z;
        double r22951644 = r22951642 * r22951643;
        double r22951645 = r22951639 - r22951644;
        return r22951645;
}

double f(double x, double y, double z) {
        double r22951646 = x;
        double r22951647 = z;
        double r22951648 = y;
        double r22951649 = 4.0;
        double r22951650 = r22951648 * r22951649;
        double r22951651 = r22951647 * r22951650;
        double r22951652 = -r22951651;
        double r22951653 = fma(r22951646, r22951646, r22951652);
        double r22951654 = -r22951647;
        double r22951655 = fma(r22951654, r22951650, r22951651);
        double r22951656 = r22951653 + r22951655;
        return r22951656;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[x \cdot x - \left(y \cdot 4\right) \cdot z\]
  2. Using strategy rm
  3. Applied prod-diff0.0

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

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

Reproduce

herbie shell --seed 2019173 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rasterific.QuadraticFormula:discriminant from Rasterific-0.6.1"
  (- (* x x) (* (* y 4.0) z)))