Average Error: 0.0 → 0
Time: 3.6s
Precision: 64
\[x - y \cdot y\]
\[\mathsf{fma}\left(y, -y, x\right) + \left(\left(-y\right) + y\right) \cdot y\]
x - y \cdot y
\mathsf{fma}\left(y, -y, x\right) + \left(\left(-y\right) + y\right) \cdot y
double f(double x, double y) {
        double r112929 = x;
        double r112930 = y;
        double r112931 = r112930 * r112930;
        double r112932 = r112929 - r112931;
        return r112932;
}

double f(double x, double y) {
        double r112933 = y;
        double r112934 = -r112933;
        double r112935 = x;
        double r112936 = fma(r112933, r112934, r112935);
        double r112937 = r112934 + r112933;
        double r112938 = r112937 * r112933;
        double r112939 = r112936 + r112938;
        return r112939;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[x - y \cdot y\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt31.9

    \[\leadsto \color{blue}{\sqrt{x} \cdot \sqrt{x}} - y \cdot y\]
  4. Applied prod-diff31.9

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, -y, x\right)} + \mathsf{fma}\left(-y, y, y \cdot y\right)\]
  6. Simplified0

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

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x y)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1"
  (- x (* y y)))