Average Error: 34.0 → 0.6
Time: 10.6s
Precision: 64
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
\[\left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)} \cdot \sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right) \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\]
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)} \cdot \sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right) \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)
double f(double x, double y, double z, double t) {
        double r766466 = x;
        double r766467 = r766466 * r766466;
        double r766468 = y;
        double r766469 = r766468 * r766468;
        double r766470 = r766467 / r766469;
        double r766471 = z;
        double r766472 = r766471 * r766471;
        double r766473 = t;
        double r766474 = r766473 * r766473;
        double r766475 = r766472 / r766474;
        double r766476 = r766470 + r766475;
        return r766476;
}

double f(double x, double y, double z, double t) {
        double r766477 = x;
        double r766478 = y;
        double r766479 = r766477 / r766478;
        double r766480 = z;
        double r766481 = t;
        double r766482 = r766480 / r766481;
        double r766483 = hypot(r766479, r766482);
        double r766484 = sqrt(r766483);
        double r766485 = r766484 * r766484;
        double r766486 = r766485 * r766483;
        return r766486;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original34.0
Target0.4
Herbie0.6
\[{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}\]

Derivation

  1. Initial program 34.0

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
  2. Simplified19.5

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{z \cdot z}{t \cdot t}\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt19.5

    \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{z \cdot z}{t \cdot t}\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{z \cdot z}{t \cdot t}\right)}}\]
  5. Simplified19.5

    \[\leadsto \color{blue}{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{z \cdot z}{t \cdot t}\right)}\]
  6. Simplified0.4

    \[\leadsto \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \color{blue}{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\]
  7. Using strategy rm
  8. Applied add-sqr-sqrt0.6

    \[\leadsto \color{blue}{\left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)} \cdot \sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right)} \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\]
  9. Final simplification0.6

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

Reproduce

herbie shell --seed 2020043 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
  :precision binary64

  :herbie-target
  (+ (pow (/ x y) 2) (pow (/ z t) 2))

  (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))