Average Error: 0.0 → 0
Time: 4.2s
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 r112849 = x;
        double r112850 = y;
        double r112851 = r112850 * r112850;
        double r112852 = r112849 - r112851;
        return r112852;
}

double f(double x, double y) {
        double r112853 = y;
        double r112854 = -r112853;
        double r112855 = x;
        double r112856 = fma(r112853, r112854, r112855);
        return r112856;
}

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 2019304 +o rules:numerics
(FPCore (x y)
  :name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1"
  :precision binary64
  (- x (* y y)))