Average Error: 0.0 → 0.0
Time: 675.0ms
Precision: 64
\[x \cdot x + y \cdot y\]
\[\mathsf{fma}\left(x, x, y \cdot y\right)\]
x \cdot x + y \cdot y
\mathsf{fma}\left(x, x, y \cdot y\right)
double f(double x, double y) {
        double r148624 = x;
        double r148625 = r148624 * r148624;
        double r148626 = y;
        double r148627 = r148626 * r148626;
        double r148628 = r148625 + r148627;
        return r148628;
}

double f(double x, double y) {
        double r148629 = x;
        double r148630 = y;
        double r148631 = r148630 * r148630;
        double r148632 = fma(r148629, r148629, r148631);
        return r148632;
}

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(x, x, y \cdot y\right)}\]
  3. Final simplification0.0

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

Reproduce

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