Average Error: 33.8 → 0.7
Time: 12.4s
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 \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)\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 \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)\right) \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)
double f(double x, double y, double z, double t) {
        double r871774 = x;
        double r871775 = r871774 * r871774;
        double r871776 = y;
        double r871777 = r871776 * r871776;
        double r871778 = r871775 / r871777;
        double r871779 = z;
        double r871780 = r871779 * r871779;
        double r871781 = t;
        double r871782 = r871781 * r871781;
        double r871783 = r871780 / r871782;
        double r871784 = r871778 + r871783;
        return r871784;
}

double f(double x, double y, double z, double t) {
        double r871785 = x;
        double r871786 = y;
        double r871787 = r871785 / r871786;
        double r871788 = z;
        double r871789 = t;
        double r871790 = r871788 / r871789;
        double r871791 = hypot(r871787, r871790);
        double r871792 = sqrt(r871791);
        double r871793 = sqrt(r871792);
        double r871794 = r871793 * r871793;
        double r871795 = r871792 * r871794;
        double r871796 = r871795 * r871791;
        return r871796;
}

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

Derivation

  1. Initial program 33.8

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

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

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

    \[\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-sqr-sqrt0.6

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

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

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

Reproduce

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