Average Error: 34.4 → 0.6
Time: 4.7s
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 \sqrt{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\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 \sqrt{\mathsf{hypot}\left(\frac{z}{t}, \frac{x}{y}\right)}\right)
double f(double x, double y, double z, double t) {
        double r771196 = x;
        double r771197 = r771196 * r771196;
        double r771198 = y;
        double r771199 = r771198 * r771198;
        double r771200 = r771197 / r771199;
        double r771201 = z;
        double r771202 = r771201 * r771201;
        double r771203 = t;
        double r771204 = r771203 * r771203;
        double r771205 = r771202 / r771204;
        double r771206 = r771200 + r771205;
        return r771206;
}

double f(double x, double y, double z, double t) {
        double r771207 = z;
        double r771208 = t;
        double r771209 = r771207 / r771208;
        double r771210 = x;
        double r771211 = y;
        double r771212 = r771210 / r771211;
        double r771213 = hypot(r771209, r771212);
        double r771214 = sqrt(r771213);
        double r771215 = r771214 * r771214;
        double r771216 = r771213 * r771215;
        return r771216;
}

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

Original34.4
Target0.4
Herbie0.6
\[{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}\]

Derivation

  1. Initial program 34.4

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

Reproduce

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