Average Error: 6.3 → 6.3
Time: 19.0s
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 r361914 = x;
        double r361915 = r361914 * r361914;
        double r361916 = y;
        double r361917 = 4.0;
        double r361918 = r361916 * r361917;
        double r361919 = z;
        double r361920 = r361919 * r361919;
        double r361921 = t;
        double r361922 = r361920 - r361921;
        double r361923 = r361918 * r361922;
        double r361924 = r361915 - r361923;
        return r361924;
}

double f(double x, double y, double z, double t) {
        double r361925 = y;
        double r361926 = 4.0;
        double r361927 = r361925 * r361926;
        double r361928 = t;
        double r361929 = z;
        double r361930 = r361929 * r361929;
        double r361931 = r361928 - r361930;
        double r361932 = x;
        double r361933 = r361932 * r361932;
        double r361934 = fma(r361927, r361931, r361933);
        return r361934;
}

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 2019326 +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))))