Average Error: 0.5 → 0.5
Time: 43.7s
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(a1 \cdot a1\right) \cdot \frac{\cos th}{\sqrt{2}} + \left(\frac{\cos th}{\sqrt{2}} \cdot a2\right) \cdot a2\]
\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)
\left(a1 \cdot a1\right) \cdot \frac{\cos th}{\sqrt{2}} + \left(\frac{\cos th}{\sqrt{2}} \cdot a2\right) \cdot a2
double f(double a1, double a2, double th) {
        double r2357454 = th;
        double r2357455 = cos(r2357454);
        double r2357456 = 2.0;
        double r2357457 = sqrt(r2357456);
        double r2357458 = r2357455 / r2357457;
        double r2357459 = a1;
        double r2357460 = r2357459 * r2357459;
        double r2357461 = r2357458 * r2357460;
        double r2357462 = a2;
        double r2357463 = r2357462 * r2357462;
        double r2357464 = r2357458 * r2357463;
        double r2357465 = r2357461 + r2357464;
        return r2357465;
}

double f(double a1, double a2, double th) {
        double r2357466 = a1;
        double r2357467 = r2357466 * r2357466;
        double r2357468 = th;
        double r2357469 = cos(r2357468);
        double r2357470 = 2.0;
        double r2357471 = sqrt(r2357470);
        double r2357472 = r2357469 / r2357471;
        double r2357473 = r2357467 * r2357472;
        double r2357474 = a2;
        double r2357475 = r2357472 * r2357474;
        double r2357476 = r2357475 * r2357474;
        double r2357477 = r2357473 + r2357476;
        return r2357477;
}

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. Taylor expanded around -inf 0.5

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

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

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

Reproduce

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