Average Error: 33.5 → 0.7
Time: 4.4s
Precision: 64
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
\[\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right) \cdot \left(\sqrt{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)} \cdot \left(\sqrt{\sqrt{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)}} \cdot \sqrt{\sqrt{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)}}\right)\right)\]
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right) \cdot \left(\sqrt{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)} \cdot \left(\sqrt{\sqrt{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)}} \cdot \sqrt{\sqrt{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)}}\right)\right)
double f(double x, double y, double z, double t) {
        double r570060 = x;
        double r570061 = r570060 * r570060;
        double r570062 = y;
        double r570063 = r570062 * r570062;
        double r570064 = r570061 / r570063;
        double r570065 = z;
        double r570066 = r570065 * r570065;
        double r570067 = t;
        double r570068 = r570067 * r570067;
        double r570069 = r570066 / r570068;
        double r570070 = r570064 + r570069;
        return r570070;
}

double f(double x, double y, double z, double t) {
        double r570071 = z;
        double r570072 = t;
        double r570073 = r570071 / r570072;
        double r570074 = x;
        double r570075 = y;
        double r570076 = r570074 / r570075;
        double r570077 = hypot(r570073, r570076);
        double r570078 = sqrt(r570077);
        double r570079 = sqrt(r570078);
        double r570080 = r570079 * r570079;
        double r570081 = r570078 * r570080;
        double r570082 = r570077 * r570081;
        return r570082;
}

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

Derivation

  1. Initial program 33.5

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

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

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

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

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

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

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

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

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

Reproduce

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