Average Error: 0.0 → 0.0
Time: 4.7s
Precision: 64
\[x \cdot x + y \cdot y\]
\[\mathsf{hypot}\left(x, y\right) \cdot \mathsf{hypot}\left(x, y\right)\]
x \cdot x + y \cdot y
\mathsf{hypot}\left(x, y\right) \cdot \mathsf{hypot}\left(x, y\right)
double f(double x, double y) {
        double r156028 = x;
        double r156029 = r156028 * r156028;
        double r156030 = y;
        double r156031 = r156030 * r156030;
        double r156032 = r156029 + r156031;
        return r156032;
}

double f(double x, double y) {
        double r156033 = x;
        double r156034 = y;
        double r156035 = hypot(r156033, r156034);
        double r156036 = r156035 * r156035;
        return r156036;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[x \cdot x + y \cdot y\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt0.0

    \[\leadsto \color{blue}{\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y}}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{hypot}\left(x, y\right)} \cdot \sqrt{x \cdot x + y \cdot y}\]
  5. Simplified0.0

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

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

Reproduce

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