Average Error: 0.5 → 0.4
Time: 26.4s
Precision: 64
\[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
\[\frac{\mathsf{hypot}\left(a1, a2\right) \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}} \cdot \frac{\mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt{2}}}\]
\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)
\frac{\mathsf{hypot}\left(a1, a2\right) \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}} \cdot \frac{\mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt{2}}}
double f(double a1, double a2, double th) {
        double r93458 = th;
        double r93459 = cos(r93458);
        double r93460 = 2.0;
        double r93461 = sqrt(r93460);
        double r93462 = r93459 / r93461;
        double r93463 = a1;
        double r93464 = r93463 * r93463;
        double r93465 = r93462 * r93464;
        double r93466 = a2;
        double r93467 = r93466 * r93466;
        double r93468 = r93462 * r93467;
        double r93469 = r93465 + r93468;
        return r93469;
}

double f(double a1, double a2, double th) {
        double r93470 = a1;
        double r93471 = a2;
        double r93472 = hypot(r93470, r93471);
        double r93473 = th;
        double r93474 = cos(r93473);
        double r93475 = r93472 * r93474;
        double r93476 = 2.0;
        double r93477 = sqrt(r93476);
        double r93478 = cbrt(r93477);
        double r93479 = r93478 * r93478;
        double r93480 = r93475 / r93479;
        double r93481 = r93472 / r93478;
        double r93482 = r93480 * r93481;
        return r93482;
}

Error

Bits error versus a1

Bits error versus a2

Bits error versus th

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.5

    \[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
  2. Simplified0.5

    \[\leadsto \color{blue}{\cos th \cdot \frac{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}{\sqrt{2}}}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.5

    \[\leadsto \cos th \cdot \frac{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}{\color{blue}{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \sqrt[3]{\sqrt{2}}}}\]
  5. Applied add-sqr-sqrt0.5

    \[\leadsto \cos th \cdot \frac{\color{blue}{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)} \cdot \sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}}{\left(\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}\right) \cdot \sqrt[3]{\sqrt{2}}}\]
  6. Applied times-frac0.5

    \[\leadsto \cos th \cdot \color{blue}{\left(\frac{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}} \cdot \frac{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}{\sqrt[3]{\sqrt{2}}}\right)}\]
  7. Applied associate-*r*0.5

    \[\leadsto \color{blue}{\left(\cos th \cdot \frac{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}\right) \cdot \frac{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}{\sqrt[3]{\sqrt{2}}}}\]
  8. Simplified0.5

    \[\leadsto \color{blue}{\frac{\cos th}{\frac{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}{\mathsf{hypot}\left(a1, a2\right)}}} \cdot \frac{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}{\sqrt[3]{\sqrt{2}}}\]
  9. Using strategy rm
  10. Applied *-un-lft-identity0.5

    \[\leadsto \frac{\cos th}{\color{blue}{1 \cdot \frac{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}{\mathsf{hypot}\left(a1, a2\right)}}} \cdot \frac{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}{\sqrt[3]{\sqrt{2}}}\]
  11. Applied *-un-lft-identity0.5

    \[\leadsto \frac{\color{blue}{1 \cdot \cos th}}{1 \cdot \frac{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}{\mathsf{hypot}\left(a1, a2\right)}} \cdot \frac{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}{\sqrt[3]{\sqrt{2}}}\]
  12. Applied times-frac0.5

    \[\leadsto \color{blue}{\left(\frac{1}{1} \cdot \frac{\cos th}{\frac{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}{\mathsf{hypot}\left(a1, a2\right)}}\right)} \cdot \frac{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}{\sqrt[3]{\sqrt{2}}}\]
  13. Applied associate-*l*0.5

    \[\leadsto \color{blue}{\frac{1}{1} \cdot \left(\frac{\cos th}{\frac{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}{\mathsf{hypot}\left(a1, a2\right)}} \cdot \frac{\sqrt{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}}{\sqrt[3]{\sqrt{2}}}\right)}\]
  14. Simplified0.4

    \[\leadsto \frac{1}{1} \cdot \color{blue}{\left(\frac{\mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt{2}}} \cdot \frac{\cos th \cdot \mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}\right)}\]
  15. Final simplification0.4

    \[\leadsto \frac{\mathsf{hypot}\left(a1, a2\right) \cdot \cos th}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}} \cdot \frac{\mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt{2}}}\]

Reproduce

herbie shell --seed 2019194 +o rules:numerics
(FPCore (a1 a2 th)
  :name "Migdal et al, Equation (64)"
  (+ (* (/ (cos th) (sqrt 2.0)) (* a1 a1)) (* (/ (cos th) (sqrt 2.0)) (* a2 a2))))