Average Error: 0.5 → 0.5
Time: 49.2s
Precision: 64
\[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
\[a1 \cdot \left(a1 \cdot \sqrt[3]{\frac{\cos th}{2 \cdot \sqrt{2}} \cdot \left(\cos th \cdot \cos th\right)}\right) + \left(a2 \cdot \frac{\cos th}{\sqrt{2}}\right) \cdot a2\]
double f(double a1, double a2, double th) {
        double r5123030 = th;
        double r5123031 = cos(r5123030);
        double r5123032 = 2.0;
        double r5123033 = sqrt(r5123032);
        double r5123034 = r5123031 / r5123033;
        double r5123035 = a1;
        double r5123036 = r5123035 * r5123035;
        double r5123037 = r5123034 * r5123036;
        double r5123038 = a2;
        double r5123039 = r5123038 * r5123038;
        double r5123040 = r5123034 * r5123039;
        double r5123041 = r5123037 + r5123040;
        return r5123041;
}

double f(double a1, double a2, double th) {
        double r5123042 = a1;
        double r5123043 = th;
        double r5123044 = cos(r5123043);
        double r5123045 = 2.0;
        double r5123046 = sqrt(r5123045);
        double r5123047 = r5123045 * r5123046;
        double r5123048 = r5123044 / r5123047;
        double r5123049 = r5123044 * r5123044;
        double r5123050 = r5123048 * r5123049;
        double r5123051 = cbrt(r5123050);
        double r5123052 = r5123042 * r5123051;
        double r5123053 = r5123042 * r5123052;
        double r5123054 = a2;
        double r5123055 = r5123044 / r5123046;
        double r5123056 = r5123054 * r5123055;
        double r5123057 = r5123056 * r5123054;
        double r5123058 = r5123053 + r5123057;
        return r5123058;
}

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

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. Using strategy rm
  3. Applied associate-*r*0.5

    \[\leadsto \frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \color{blue}{\left(\frac{\cos th}{\sqrt{2}} \cdot a2\right) \cdot a2}\]
  4. Using strategy rm
  5. Applied associate-*r*0.5

    \[\leadsto \color{blue}{\left(\frac{\cos th}{\sqrt{2}} \cdot a1\right) \cdot a1} + \left(\frac{\cos th}{\sqrt{2}} \cdot a2\right) \cdot a2\]
  6. Using strategy rm
  7. Applied add-cbrt-cube0.8

    \[\leadsto \left(\frac{\cos th}{\color{blue}{\sqrt[3]{\left(\sqrt{2} \cdot \sqrt{2}\right) \cdot \sqrt{2}}}} \cdot a1\right) \cdot a1 + \left(\frac{\cos th}{\sqrt{2}} \cdot a2\right) \cdot a2\]
  8. Applied add-cbrt-cube0.8

    \[\leadsto \left(\frac{\color{blue}{\sqrt[3]{\left(\cos th \cdot \cos th\right) \cdot \cos th}}}{\sqrt[3]{\left(\sqrt{2} \cdot \sqrt{2}\right) \cdot \sqrt{2}}} \cdot a1\right) \cdot a1 + \left(\frac{\cos th}{\sqrt{2}} \cdot a2\right) \cdot a2\]
  9. Applied cbrt-undiv0.6

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

    \[\leadsto \left(\sqrt[3]{\color{blue}{\left(\cos th \cdot \cos th\right) \cdot \frac{\cos th}{2 \cdot \sqrt{2}}}} \cdot a1\right) \cdot a1 + \left(\frac{\cos th}{\sqrt{2}} \cdot a2\right) \cdot a2\]
  11. Final simplification0.5

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

Reproduce

herbie shell --seed 2019102 
(FPCore (a1 a2 th)
  :name "Migdal et al, Equation (64)"
  (+ (* (/ (cos th) (sqrt 2)) (* a1 a1)) (* (/ (cos th) (sqrt 2)) (* a2 a2))))