Average Error: 0.0 → 0.0
Time: 7.6s
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 r6908816 = x;
        double r6908817 = r6908816 * r6908816;
        double r6908818 = y;
        double r6908819 = r6908818 * r6908818;
        double r6908820 = r6908817 + r6908819;
        return r6908820;
}

double f(double x, double y) {
        double r6908821 = y;
        double r6908822 = x;
        double r6908823 = r6908822 * r6908822;
        double r6908824 = fma(r6908821, r6908821, r6908823);
        return r6908824;
}

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 2019174 +o rules:numerics
(FPCore (x y)
  :name "Graphics.Rasterific.Linear:$cquadrance from Rasterific-0.6.1"
  (+ (* x x) (* y y)))