Average Error: 0.0 → 0.0
Time: 1.4s
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 r88729 = x;
        double r88730 = r88729 * r88729;
        double r88731 = y;
        double r88732 = r88731 * r88731;
        double r88733 = r88730 + r88732;
        return r88733;
}

double f(double x, double y) {
        double r88734 = y;
        double r88735 = x;
        double r88736 = r88735 * r88735;
        double r88737 = fma(r88734, r88734, r88736);
        return r88737;
}

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