Average Error: 0.5 → 0.4
Time: 25.0s
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{\frac{\cos th \cdot \mathsf{hypot}\left(a1, a2\right)}{\frac{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}{\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{\frac{\cos th \cdot \mathsf{hypot}\left(a1, a2\right)}{\frac{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}{\mathsf{hypot}\left(a1, a2\right)}}}{\sqrt[3]{\sqrt{2}}}
double f(double a1, double a2, double th) {
        double r94022 = th;
        double r94023 = cos(r94022);
        double r94024 = 2.0;
        double r94025 = sqrt(r94024);
        double r94026 = r94023 / r94025;
        double r94027 = a1;
        double r94028 = r94027 * r94027;
        double r94029 = r94026 * r94028;
        double r94030 = a2;
        double r94031 = r94030 * r94030;
        double r94032 = r94026 * r94031;
        double r94033 = r94029 + r94032;
        return r94033;
}

double f(double a1, double a2, double th) {
        double r94034 = th;
        double r94035 = cos(r94034);
        double r94036 = a1;
        double r94037 = a2;
        double r94038 = hypot(r94036, r94037);
        double r94039 = r94035 * r94038;
        double r94040 = 2.0;
        double r94041 = sqrt(r94040);
        double r94042 = cbrt(r94041);
        double r94043 = r94042 * r94042;
        double r94044 = r94043 / r94038;
        double r94045 = r94039 / r94044;
        double r94046 = r94045 / r94042;
        return r94046;
}

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}{\frac{\cos th \cdot \mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}{\sqrt{2}}}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt0.5

    \[\leadsto \frac{\cos th \cdot \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 associate-/r*0.5

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

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

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

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

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

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

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

Reproduce

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