Average Error: 33.7 → 0.6
Time: 4.7s
Precision: 64
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
\[\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) \cdot \mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)\]
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\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) \cdot \mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)
double f(double x, double y, double z, double t) {
        double r602262 = x;
        double r602263 = r602262 * r602262;
        double r602264 = y;
        double r602265 = r602264 * r602264;
        double r602266 = r602263 / r602265;
        double r602267 = z;
        double r602268 = r602267 * r602267;
        double r602269 = t;
        double r602270 = r602269 * r602269;
        double r602271 = r602268 / r602270;
        double r602272 = r602266 + r602271;
        return r602272;
}

double f(double x, double y, double z, double t) {
        double r602273 = z;
        double r602274 = t;
        double r602275 = r602273 / r602274;
        double r602276 = x;
        double r602277 = y;
        double r602278 = r602276 / r602277;
        double r602279 = hypot(r602275, r602278);
        double r602280 = sqrt(r602279);
        double r602281 = r602280 * r602280;
        double r602282 = r602281 * r602279;
        return r602282;
}

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

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

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

    \[\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 \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)} \cdot \mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)\]
  9. Using strategy rm
  10. Applied pow10.6

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

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

Reproduce

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