Average Error: 33.9 → 0.6
Time: 11.4s
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(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\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(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\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 r285073 = x;
        double r285074 = r285073 * r285073;
        double r285075 = y;
        double r285076 = r285075 * r285075;
        double r285077 = r285074 / r285076;
        double r285078 = z;
        double r285079 = r285078 * r285078;
        double r285080 = t;
        double r285081 = r285080 * r285080;
        double r285082 = r285079 / r285081;
        double r285083 = r285077 + r285082;
        return r285083;
}

double f(double x, double y, double z, double t) {
        double r285084 = x;
        double r285085 = y;
        double r285086 = r285084 / r285085;
        double r285087 = z;
        double r285088 = t;
        double r285089 = r285087 / r285088;
        double r285090 = hypot(r285086, r285089);
        double r285091 = sqrt(r285090);
        double r285092 = r285091 * r285091;
        double r285093 = r285090 * r285092;
        return r285093;
}

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

Derivation

  1. Initial program 33.9

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

    \[\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 times-frac0.4

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

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

    \[\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}{t} \cdot \frac{z}{t}\right)}\]
  8. 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)}\]
  9. Using strategy rm
  10. 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)}\]
  11. Final simplification0.6

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

Reproduce

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