Average Error: 33.4 → 0.6
Time: 22.5s
Precision: 64
\[\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}\]
\[{\left({\left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right)}^{4}\right)}^{\frac{1}{4}} \cdot \left({\left({\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{2}\right)}^{\frac{1}{4}} \cdot \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}
{\left({\left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right)}^{4}\right)}^{\frac{1}{4}} \cdot \left({\left({\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{2}\right)}^{\frac{1}{4}} \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)
double f(double x, double y, double z, double t) {
        double r401232 = x;
        double r401233 = r401232 * r401232;
        double r401234 = y;
        double r401235 = r401234 * r401234;
        double r401236 = r401233 / r401235;
        double r401237 = z;
        double r401238 = r401237 * r401237;
        double r401239 = t;
        double r401240 = r401239 * r401239;
        double r401241 = r401238 / r401240;
        double r401242 = r401236 + r401241;
        return r401242;
}

double f(double x, double y, double z, double t) {
        double r401243 = x;
        double r401244 = y;
        double r401245 = r401243 / r401244;
        double r401246 = z;
        double r401247 = t;
        double r401248 = r401246 / r401247;
        double r401249 = hypot(r401245, r401248);
        double r401250 = sqrt(r401249);
        double r401251 = 4.0;
        double r401252 = pow(r401250, r401251);
        double r401253 = 0.25;
        double r401254 = pow(r401252, r401253);
        double r401255 = 2.0;
        double r401256 = pow(r401249, r401255);
        double r401257 = pow(r401256, r401253);
        double r401258 = r401257 * r401249;
        double r401259 = r401254 * r401258;
        return r401259;
}

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

Derivation

  1. Initial program 33.4

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

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

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

    \[\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 pow10.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{\color{blue}{{\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{1}}}\right)\]
  11. Applied sqrt-pow10.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 \color{blue}{{\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{\left(\frac{1}{2}\right)}}\right)\]
  12. Applied pow10.6

    \[\leadsto \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \left(\sqrt{\color{blue}{{\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{1}}} \cdot {\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{\left(\frac{1}{2}\right)}\right)\]
  13. Applied sqrt-pow10.6

    \[\leadsto \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \left(\color{blue}{{\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{\left(\frac{1}{2}\right)}} \cdot {\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{\left(\frac{1}{2}\right)}\right)\]
  14. Applied pow-prod-down0.4

    \[\leadsto \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \color{blue}{{\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{\left(\frac{1}{2}\right)}}\]
  15. Simplified0.6

    \[\leadsto \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot {\color{blue}{\left({\left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right)}^{4}\right)}}^{\left(\frac{1}{2}\right)}\]
  16. Using strategy rm
  17. Applied sqr-pow0.6

    \[\leadsto \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right) \cdot \color{blue}{\left({\left({\left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right)}^{4}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {\left({\left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right)}^{4}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}\right)}\]
  18. Applied associate-*r*0.6

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

    \[\leadsto \color{blue}{\left({\left({\left(\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)}^{2}\right)}^{\frac{1}{4}} \cdot \mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)\right)} \cdot {\left({\left(\sqrt{\mathsf{hypot}\left(\frac{x}{y}, \frac{z}{t}\right)}\right)}^{4}\right)}^{\left(\frac{\frac{1}{2}}{2}\right)}\]
  20. Final simplification0.6

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

Reproduce

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