Average Error: 33.2 → 0.7
Time: 14.1s
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(\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) \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(\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) \cdot \sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right)
double f(double x, double y, double z, double t) {
        double r745316 = x;
        double r745317 = r745316 * r745316;
        double r745318 = y;
        double r745319 = r745318 * r745318;
        double r745320 = r745317 / r745319;
        double r745321 = z;
        double r745322 = r745321 * r745321;
        double r745323 = t;
        double r745324 = r745323 * r745323;
        double r745325 = r745322 / r745324;
        double r745326 = r745320 + r745325;
        return r745326;
}

double f(double x, double y, double z, double t) {
        double r745327 = x;
        double r745328 = y;
        double r745329 = r745327 / r745328;
        double r745330 = z;
        double r745331 = t;
        double r745332 = r745330 / r745331;
        double r745333 = hypot(r745329, r745332);
        double r745334 = sqrt(r745333);
        double r745335 = sqrt(r745334);
        double r745336 = r745335 * r745335;
        double r745337 = r745336 * r745334;
        double r745338 = r745333 * r745337;
        return r745338;
}

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

Derivation

  1. Initial program 33.2

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

    \[\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 \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. Using strategy rm
  10. Applied add-sqr-sqrt0.6

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

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

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

Reproduce

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