Average Error: 0.0 → 0
Time: 4.0s
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 r134590 = x;
        double r134591 = y;
        double r134592 = r134591 * r134591;
        double r134593 = r134590 - r134592;
        return r134593;
}

double f(double x, double y) {
        double r134594 = y;
        double r134595 = -r134594;
        double r134596 = x;
        double r134597 = fma(r134594, r134595, r134596);
        return r134597;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[x - y \cdot y\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{x - {y}^{2}}\]
  3. Simplified0

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

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

Reproduce

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