Average Error: 0.5 → 0.5
Time: 23.3s
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{a2 \cdot a2}{\sqrt{2}} \cdot \cos th + \frac{\left(a1 \cdot a1\right) \cdot \cos th}{\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{a2 \cdot a2}{\sqrt{2}} \cdot \cos th + \frac{\left(a1 \cdot a1\right) \cdot \cos th}{\sqrt{2}}
double f(double a1, double a2, double th) {
        double r1043497 = th;
        double r1043498 = cos(r1043497);
        double r1043499 = 2.0;
        double r1043500 = sqrt(r1043499);
        double r1043501 = r1043498 / r1043500;
        double r1043502 = a1;
        double r1043503 = r1043502 * r1043502;
        double r1043504 = r1043501 * r1043503;
        double r1043505 = a2;
        double r1043506 = r1043505 * r1043505;
        double r1043507 = r1043501 * r1043506;
        double r1043508 = r1043504 + r1043507;
        return r1043508;
}

double f(double a1, double a2, double th) {
        double r1043509 = a2;
        double r1043510 = r1043509 * r1043509;
        double r1043511 = 2.0;
        double r1043512 = sqrt(r1043511);
        double r1043513 = r1043510 / r1043512;
        double r1043514 = th;
        double r1043515 = cos(r1043514);
        double r1043516 = r1043513 * r1043515;
        double r1043517 = a1;
        double r1043518 = r1043517 * r1043517;
        double r1043519 = r1043518 * r1043515;
        double r1043520 = r1043519 / r1043512;
        double r1043521 = r1043516 + r1043520;
        return r1043521;
}

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 \frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \color{blue}{\left(\cos th \cdot \frac{1}{\sqrt{2}}\right)} \cdot \left(a2 \cdot a2\right)\]
  4. Applied associate-*l*0.5

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

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

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

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

Reproduce

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