Average Error: 0.0 → 0.0
Time: 7.3s
Precision: 64
\[x \cdot x + y \cdot y\]
\[\mathsf{fma}\left(y, y, x \cdot x\right)\]
x \cdot x + y \cdot y
\mathsf{fma}\left(y, y, x \cdot x\right)
double f(double x, double y) {
        double r6384335 = x;
        double r6384336 = r6384335 * r6384335;
        double r6384337 = y;
        double r6384338 = r6384337 * r6384337;
        double r6384339 = r6384336 + r6384338;
        return r6384339;
}

double f(double x, double y) {
        double r6384340 = y;
        double r6384341 = x;
        double r6384342 = r6384341 * r6384341;
        double r6384343 = fma(r6384340, r6384340, r6384342);
        return r6384343;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[x \cdot x + y \cdot y\]
  2. Simplified0.0

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

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

Reproduce

herbie shell --seed 2019171 +o rules:numerics
(FPCore (x y)
  :name "Graphics.Rasterific.Linear:$cquadrance from Rasterific-0.6.1"
  (+ (* x x) (* y y)))