Average Error: 0.5 → 0.4
Time: 9.3s
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{\cos th}{\sqrt[3]{\sqrt[3]{\sqrt{2}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt{2}}}} \cdot \left(\frac{\mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt[3]{\sqrt{2}}}} \cdot \frac{\mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}\right)\]
\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)
\frac{\cos th}{\sqrt[3]{\sqrt[3]{\sqrt{2}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt{2}}}} \cdot \left(\frac{\mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt[3]{\sqrt{2}}}} \cdot \frac{\mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}\right)
double f(double a1, double a2, double th) {
        double r116160 = th;
        double r116161 = cos(r116160);
        double r116162 = 2.0;
        double r116163 = sqrt(r116162);
        double r116164 = r116161 / r116163;
        double r116165 = a1;
        double r116166 = r116165 * r116165;
        double r116167 = r116164 * r116166;
        double r116168 = a2;
        double r116169 = r116168 * r116168;
        double r116170 = r116164 * r116169;
        double r116171 = r116167 + r116170;
        return r116171;
}

double f(double a1, double a2, double th) {
        double r116172 = th;
        double r116173 = cos(r116172);
        double r116174 = 2.0;
        double r116175 = sqrt(r116174);
        double r116176 = cbrt(r116175);
        double r116177 = cbrt(r116176);
        double r116178 = r116177 * r116177;
        double r116179 = r116173 / r116178;
        double r116180 = a1;
        double r116181 = a2;
        double r116182 = hypot(r116180, r116181);
        double r116183 = r116182 / r116177;
        double r116184 = r116176 * r116176;
        double r116185 = r116182 / r116184;
        double r116186 = r116183 * r116185;
        double r116187 = r116179 * r116186;
        return r116187;
}

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 *-un-lft-identity0.5

    \[\leadsto \frac{\frac{\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}}}}{\color{blue}{1 \cdot \sqrt[3]{\sqrt{2}}}}\]
  12. Applied times-frac0.7

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

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

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

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

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

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

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

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

Reproduce

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