Average Error: 33.9 → 0.6
Time: 11.7s
Precision: 64
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
\[\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \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)\]
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \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)
double f(double x, double y, double z, double t) {
        double r706422 = x;
        double r706423 = r706422 * r706422;
        double r706424 = y;
        double r706425 = r706424 * r706424;
        double r706426 = r706423 / r706425;
        double r706427 = z;
        double r706428 = r706427 * r706427;
        double r706429 = t;
        double r706430 = r706429 * r706429;
        double r706431 = r706428 / r706430;
        double r706432 = r706426 + r706431;
        return r706432;
}

double f(double x, double y, double z, double t) {
        double r706433 = x;
        double r706434 = y;
        double r706435 = r706433 / r706434;
        double r706436 = z;
        double r706437 = t;
        double r706438 = r706436 / r706437;
        double r706439 = hypot(r706435, r706438);
        double r706440 = sqrt(r706439);
        double r706441 = r706440 * r706440;
        double r706442 = r706439 * r706441;
        return r706442;
}

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

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

Derivation

  1. Initial program 33.9

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

    \[\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.4

    \[\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.4

    \[\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 \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \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)}\]
  9. Final simplification0.6

    \[\leadsto \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \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)\]

Reproduce

herbie shell --seed 2020047 +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))))