Average Error: 0.5 → 0.4
Time: 25.0s
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 \left(a2 \cdot a2\right)}{\sqrt{2}} + \frac{a1 \cdot \left(a1 \cdot \cos th\right)}{\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 \left(a2 \cdot a2\right)}{\sqrt{2}} + \frac{a1 \cdot \left(a1 \cdot \cos th\right)}{\sqrt{2}}
double f(double a1, double a2, double th) {
        double r1137240 = th;
        double r1137241 = cos(r1137240);
        double r1137242 = 2.0;
        double r1137243 = sqrt(r1137242);
        double r1137244 = r1137241 / r1137243;
        double r1137245 = a1;
        double r1137246 = r1137245 * r1137245;
        double r1137247 = r1137244 * r1137246;
        double r1137248 = a2;
        double r1137249 = r1137248 * r1137248;
        double r1137250 = r1137244 * r1137249;
        double r1137251 = r1137247 + r1137250;
        return r1137251;
}

double f(double a1, double a2, double th) {
        double r1137252 = th;
        double r1137253 = cos(r1137252);
        double r1137254 = a2;
        double r1137255 = r1137254 * r1137254;
        double r1137256 = r1137253 * r1137255;
        double r1137257 = 2.0;
        double r1137258 = sqrt(r1137257);
        double r1137259 = r1137256 / r1137258;
        double r1137260 = a1;
        double r1137261 = r1137260 * r1137253;
        double r1137262 = r1137260 * r1137261;
        double r1137263 = r1137262 / r1137258;
        double r1137264 = r1137259 + r1137263;
        return r1137264;
}

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 div-inv0.5

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

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

    \[\leadsto \cos th \cdot \color{blue}{\frac{a1 \cdot a1}{\sqrt{2}}} + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
  6. Taylor expanded around -inf 0.5

    \[\leadsto \cos th \cdot \frac{a1 \cdot a1}{\sqrt{2}} + \color{blue}{\frac{\cos th \cdot {a2}^{2}}{\sqrt{2}}}\]
  7. Simplified0.5

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

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

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

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

Reproduce

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