Average Error: 0.5 → 0.4
Time: 25.9s
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)}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\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}}}}\]
\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)}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\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}}}}
double f(double a1, double a2, double th) {
        double r100263 = th;
        double r100264 = cos(r100263);
        double r100265 = 2.0;
        double r100266 = sqrt(r100265);
        double r100267 = r100264 / r100266;
        double r100268 = a1;
        double r100269 = r100268 * r100268;
        double r100270 = r100267 * r100269;
        double r100271 = a2;
        double r100272 = r100271 * r100271;
        double r100273 = r100267 * r100272;
        double r100274 = r100270 + r100273;
        return r100274;
}

double f(double a1, double a2, double th) {
        double r100275 = th;
        double r100276 = cos(r100275);
        double r100277 = a1;
        double r100278 = a2;
        double r100279 = hypot(r100277, r100278);
        double r100280 = r100276 * r100279;
        double r100281 = 2.0;
        double r100282 = sqrt(r100281);
        double r100283 = cbrt(r100282);
        double r100284 = r100283 * r100283;
        double r100285 = r100280 / r100284;
        double r100286 = cbrt(r100283);
        double r100287 = r100286 * r100286;
        double r100288 = r100285 / r100287;
        double r100289 = r100279 / r100286;
        double r100290 = r100288 * r100289;
        return r100290;
}

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. Using strategy rm
  14. Applied add-cube-cbrt0.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)}}}{\color{blue}{\left(\sqrt[3]{\sqrt[3]{\sqrt{2}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt{2}}}\right) \cdot \sqrt[3]{\sqrt[3]{\sqrt{2}}}}}\]
  15. Applied associate-/r/0.4

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

    \[\leadsto \color{blue}{\frac{\frac{\cos th \cdot \mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\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}}}}}\]
  17. Final simplification0.4

    \[\leadsto \frac{\frac{\cos th \cdot \mathsf{hypot}\left(a1, a2\right)}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}}}{\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}}}}\]

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))))