Average Error: 0.5 → 0.5
Time: 32.6s
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 \cdot {a2}^{2}}{\sqrt{2}} + \left(\cos th \cdot \frac{a1}{\sqrt{\sqrt{2}}}\right) \cdot \frac{a1}{\sqrt{\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{\cos th \cdot {a2}^{2}}{\sqrt{2}} + \left(\cos th \cdot \frac{a1}{\sqrt{\sqrt{2}}}\right) \cdot \frac{a1}{\sqrt{\sqrt{2}}}
double f(double a1, double a2, double th) {
        double r63766 = th;
        double r63767 = cos(r63766);
        double r63768 = 2.0;
        double r63769 = sqrt(r63768);
        double r63770 = r63767 / r63769;
        double r63771 = a1;
        double r63772 = r63771 * r63771;
        double r63773 = r63770 * r63772;
        double r63774 = a2;
        double r63775 = r63774 * r63774;
        double r63776 = r63770 * r63775;
        double r63777 = r63773 + r63776;
        return r63777;
}

double f(double a1, double a2, double th) {
        double r63778 = th;
        double r63779 = cos(r63778);
        double r63780 = a2;
        double r63781 = 2.0;
        double r63782 = pow(r63780, r63781);
        double r63783 = r63779 * r63782;
        double r63784 = 2.0;
        double r63785 = sqrt(r63784);
        double r63786 = r63783 / r63785;
        double r63787 = a1;
        double r63788 = sqrt(r63785);
        double r63789 = r63787 / r63788;
        double r63790 = r63779 * r63789;
        double r63791 = r63790 * r63789;
        double r63792 = r63786 + r63791;
        return r63792;
}

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. Using strategy rm
  3. Applied *-un-lft-identity0.5

    \[\leadsto \frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\color{blue}{1 \cdot \sqrt{2}}} \cdot \left(a2 \cdot a2\right)\]
  4. Applied *-un-lft-identity0.5

    \[\leadsto \frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\color{blue}{1 \cdot \cos th}}{1 \cdot \sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
  5. Applied times-frac0.5

    \[\leadsto \frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \color{blue}{\left(\frac{1}{1} \cdot \frac{\cos th}{\sqrt{2}}\right)} \cdot \left(a2 \cdot a2\right)\]
  6. Applied associate-*l*0.5

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

    \[\leadsto \frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{1}{1} \cdot \color{blue}{\frac{\cos th \cdot {a2}^{2}}{\sqrt{2}}}\]
  8. Using strategy rm
  9. Applied div-inv0.5

    \[\leadsto \color{blue}{\left(\cos th \cdot \frac{1}{\sqrt{2}}\right)} \cdot \left(a1 \cdot a1\right) + \frac{1}{1} \cdot \frac{\cos th \cdot {a2}^{2}}{\sqrt{2}}\]
  10. Applied associate-*l*0.5

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

    \[\leadsto \cos th \cdot \color{blue}{\frac{{a1}^{2}}{\sqrt{2}}} + \frac{1}{1} \cdot \frac{\cos th \cdot {a2}^{2}}{\sqrt{2}}\]
  12. Using strategy rm
  13. Applied add-sqr-sqrt0.5

    \[\leadsto \cos th \cdot \frac{{a1}^{2}}{\sqrt{\color{blue}{\sqrt{2} \cdot \sqrt{2}}}} + \frac{1}{1} \cdot \frac{\cos th \cdot {a2}^{2}}{\sqrt{2}}\]
  14. Applied sqrt-prod0.5

    \[\leadsto \cos th \cdot \frac{{a1}^{2}}{\color{blue}{\sqrt{\sqrt{2}} \cdot \sqrt{\sqrt{2}}}} + \frac{1}{1} \cdot \frac{\cos th \cdot {a2}^{2}}{\sqrt{2}}\]
  15. Applied unpow20.5

    \[\leadsto \cos th \cdot \frac{\color{blue}{a1 \cdot a1}}{\sqrt{\sqrt{2}} \cdot \sqrt{\sqrt{2}}} + \frac{1}{1} \cdot \frac{\cos th \cdot {a2}^{2}}{\sqrt{2}}\]
  16. Applied times-frac0.5

    \[\leadsto \cos th \cdot \color{blue}{\left(\frac{a1}{\sqrt{\sqrt{2}}} \cdot \frac{a1}{\sqrt{\sqrt{2}}}\right)} + \frac{1}{1} \cdot \frac{\cos th \cdot {a2}^{2}}{\sqrt{2}}\]
  17. Applied associate-*r*0.5

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

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

Reproduce

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