Average Error: 0.0 → 0
Time: 4.4s
Precision: 64
\[x - y \cdot y\]
\[\mathsf{fma}\left(y, -y, x\right)\]
x - y \cdot y
\mathsf{fma}\left(y, -y, x\right)
double f(double x, double y) {
        double r132734 = x;
        double r132735 = y;
        double r132736 = r132735 * r132735;
        double r132737 = r132734 - r132736;
        return r132737;
}

double f(double x, double y) {
        double r132738 = y;
        double r132739 = -r132738;
        double r132740 = x;
        double r132741 = fma(r132738, r132739, r132740);
        return r132741;
}

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-cube-cbrt0.9

    \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}} - y \cdot y\]
  4. Applied prod-diff0.9

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{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}{0}\]
  7. Final simplification0

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

Reproduce

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