Average Error: 0.5 → 0.5
Time: 7.8s
Precision: 64
\[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
\[\left(\cos th \cdot \frac{a2}{\sqrt{2}}\right) \cdot a2 + \frac{{a1}^{2}}{\frac{\sqrt{2}}{\cos th}}\]
\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)
\left(\cos th \cdot \frac{a2}{\sqrt{2}}\right) \cdot a2 + \frac{{a1}^{2}}{\frac{\sqrt{2}}{\cos th}}
double f(double a1, double a2, double th) {
        double r99336 = th;
        double r99337 = cos(r99336);
        double r99338 = 2.0;
        double r99339 = sqrt(r99338);
        double r99340 = r99337 / r99339;
        double r99341 = a1;
        double r99342 = r99341 * r99341;
        double r99343 = r99340 * r99342;
        double r99344 = a2;
        double r99345 = r99344 * r99344;
        double r99346 = r99340 * r99345;
        double r99347 = r99343 + r99346;
        return r99347;
}

double f(double a1, double a2, double th) {
        double r99348 = th;
        double r99349 = cos(r99348);
        double r99350 = a2;
        double r99351 = 2.0;
        double r99352 = sqrt(r99351);
        double r99353 = r99350 / r99352;
        double r99354 = r99349 * r99353;
        double r99355 = r99354 * r99350;
        double r99356 = a1;
        double r99357 = 2.0;
        double r99358 = pow(r99356, r99357);
        double r99359 = r99352 / r99349;
        double r99360 = r99358 / r99359;
        double r99361 = r99355 + r99360;
        return r99361;
}

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 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 clear-num0.5

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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