Average Error: 0.1 → 0.0
Time: 18.5s
Precision: 64
\[x \cdot x - \left(y \cdot 4\right) \cdot z\]
\[\mathsf{fma}\left(4 \cdot z, -y, {x}^{2}\right)\]
x \cdot x - \left(y \cdot 4\right) \cdot z
\mathsf{fma}\left(4 \cdot z, -y, {x}^{2}\right)
double f(double x, double y, double z) {
        double r210683 = x;
        double r210684 = r210683 * r210683;
        double r210685 = y;
        double r210686 = 4.0;
        double r210687 = r210685 * r210686;
        double r210688 = z;
        double r210689 = r210687 * r210688;
        double r210690 = r210684 - r210689;
        return r210690;
}

double f(double x, double y, double z) {
        double r210691 = 4.0;
        double r210692 = z;
        double r210693 = r210691 * r210692;
        double r210694 = y;
        double r210695 = -r210694;
        double r210696 = x;
        double r210697 = 2.0;
        double r210698 = pow(r210696, r210697);
        double r210699 = fma(r210693, r210695, r210698);
        return r210699;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

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

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

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

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

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

Reproduce

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