Average Error: 33.7 → 0.8
Time: 17.1s
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[3]{{\left(\sqrt{\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}}\right)}^{3} \cdot {\left(\sqrt{\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}}\right)}^{3}}\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[3]{{\left(\sqrt{\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}}\right)}^{3} \cdot {\left(\sqrt{\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}}\right)}^{3}}\right) \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)
double f(double x, double y, double z, double t) {
        double r486352 = x;
        double r486353 = r486352 * r486352;
        double r486354 = y;
        double r486355 = r486354 * r486354;
        double r486356 = r486353 / r486355;
        double r486357 = z;
        double r486358 = r486357 * r486357;
        double r486359 = t;
        double r486360 = r486359 * r486359;
        double r486361 = r486358 / r486360;
        double r486362 = r486356 + r486361;
        return r486362;
}

double f(double x, double y, double z, double t) {
        double r486363 = x;
        double r486364 = y;
        double r486365 = r486363 / r486364;
        double r486366 = z;
        double r486367 = t;
        double r486368 = r486366 / r486367;
        double r486369 = hypot(r486365, r486368);
        double r486370 = sqrt(r486369);
        double r486371 = sqrt(r486370);
        double r486372 = 3.0;
        double r486373 = pow(r486371, r486372);
        double r486374 = r486373 * r486373;
        double r486375 = cbrt(r486374);
        double r486376 = r486370 * r486375;
        double r486377 = r486376 * r486369;
        return r486377;
}

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.7
Target0.4
Herbie0.8
\[{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}\]

Derivation

  1. Initial program 33.7

    \[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
  2. Simplified18.9

    \[\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-sqrt18.9

    \[\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. Simplified18.9

    \[\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. Using strategy rm
  10. Applied add-cbrt-cube0.7

    \[\leadsto \left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)} \cdot \color{blue}{\sqrt[3]{\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 \sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}}}\right) \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\]
  11. Simplified0.7

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

    \[\leadsto \left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)} \cdot \sqrt[3]{{\left(\sqrt{\color{blue}{\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)} \cdot \sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}}}\right)}^{3}}\right) \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\]
  14. Applied sqrt-prod0.8

    \[\leadsto \left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)} \cdot \sqrt[3]{{\color{blue}{\left(\sqrt{\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}} \cdot \sqrt{\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}}\right)}}^{3}}\right) \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\]
  15. Applied unpow-prod-down0.8

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

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

Reproduce

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

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

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