Average Error: 6.3 → 6.3
Time: 13.4s
Precision: 64
\[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
\[\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\]
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)
double f(double x, double y, double z, double t) {
        double r611752 = x;
        double r611753 = r611752 * r611752;
        double r611754 = y;
        double r611755 = 4.0;
        double r611756 = r611754 * r611755;
        double r611757 = z;
        double r611758 = r611757 * r611757;
        double r611759 = t;
        double r611760 = r611758 - r611759;
        double r611761 = r611756 * r611760;
        double r611762 = r611753 - r611761;
        return r611762;
}

double f(double x, double y, double z, double t) {
        double r611763 = y;
        double r611764 = 4.0;
        double r611765 = r611763 * r611764;
        double r611766 = t;
        double r611767 = z;
        double r611768 = r611767 * r611767;
        double r611769 = r611766 - r611768;
        double r611770 = x;
        double r611771 = r611770 * r611770;
        double r611772 = fma(r611765, r611769, r611771);
        return r611772;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original6.3
Target6.3
Herbie6.3
\[x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\]

Derivation

  1. Initial program 6.3

    \[x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\]
  2. Simplified6.3

    \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)}\]
  3. Final simplification6.3

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

Reproduce

herbie shell --seed 2019305 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
  :precision binary64

  :herbie-target
  (- (* x x) (* 4 (* y (- (* z z) t))))

  (- (* x x) (* (* y 4) (- (* z z) t))))