Average Error: 0.5 → 0.4
Time: 24.1s
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{{\left(\frac{1}{{\left(\sqrt{2}\right)}^{8}}\right)}^{\frac{1}{9}} \cdot \mathsf{fma}\left(\cos th, a2 \cdot a2, \left(a1 \cdot a1\right) \cdot \cos th\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{{\left(\frac{1}{{\left(\sqrt{2}\right)}^{8}}\right)}^{\frac{1}{9}} \cdot \mathsf{fma}\left(\cos th, a2 \cdot a2, \left(a1 \cdot a1\right) \cdot \cos th\right)}{\sqrt[3]{\sqrt[3]{\sqrt{2}}}}
double f(double a1, double a2, double th) {
        double r96108 = th;
        double r96109 = cos(r96108);
        double r96110 = 2.0;
        double r96111 = sqrt(r96110);
        double r96112 = r96109 / r96111;
        double r96113 = a1;
        double r96114 = r96113 * r96113;
        double r96115 = r96112 * r96114;
        double r96116 = a2;
        double r96117 = r96116 * r96116;
        double r96118 = r96112 * r96117;
        double r96119 = r96115 + r96118;
        return r96119;
}

double f(double a1, double a2, double th) {
        double r96120 = 1.0;
        double r96121 = 2.0;
        double r96122 = sqrt(r96121);
        double r96123 = 8.0;
        double r96124 = pow(r96122, r96123);
        double r96125 = r96120 / r96124;
        double r96126 = 0.1111111111111111;
        double r96127 = pow(r96125, r96126);
        double r96128 = th;
        double r96129 = cos(r96128);
        double r96130 = a2;
        double r96131 = r96130 * r96130;
        double r96132 = a1;
        double r96133 = r96132 * r96132;
        double r96134 = r96133 * r96129;
        double r96135 = fma(r96129, r96131, r96134);
        double r96136 = r96127 * r96135;
        double r96137 = cbrt(r96122);
        double r96138 = cbrt(r96137);
        double r96139 = r96136 / r96138;
        return r96139;
}

Error

Bits error versus a1

Bits error versus a2

Bits error versus th

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-cube-cbrt0.5

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

    \[\leadsto \color{blue}{\frac{\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[3]{\sqrt{2}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt{2}}}}}{\sqrt[3]{\sqrt[3]{\sqrt{2}}}}}\]
  9. Taylor expanded around inf 0.4

    \[\leadsto \frac{\color{blue}{\left({a1}^{2} \cdot \cos th\right) \cdot {\left(\frac{1}{{\left(\sqrt{2}\right)}^{8}}\right)}^{\frac{1}{9}} + {\left(\frac{1}{{\left(\sqrt{2}\right)}^{8}}\right)}^{\frac{1}{9}} \cdot \left(\cos th \cdot {a2}^{2}\right)}}{\sqrt[3]{\sqrt[3]{\sqrt{2}}}}\]
  10. Simplified0.4

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

    \[\leadsto \frac{{\left(\frac{1}{{\left(\sqrt{2}\right)}^{8}}\right)}^{\frac{1}{9}} \cdot \mathsf{fma}\left(\cos th, a2 \cdot a2, \left(a1 \cdot a1\right) \cdot \cos th\right)}{\sqrt[3]{\sqrt[3]{\sqrt{2}}}}\]

Reproduce

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