Average Error: 0.5 → 0.5
Time: 29.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)\]
\[a1 \cdot \left(\frac{\cos th}{\sqrt{2}} \cdot a1\right) + \left(a2 \cdot a2\right) \cdot \frac{\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)
a1 \cdot \left(\frac{\cos th}{\sqrt{2}} \cdot a1\right) + \left(a2 \cdot a2\right) \cdot \frac{\cos th}{\sqrt{2}}
double f(double a1, double a2, double th) {
        double r2366673 = th;
        double r2366674 = cos(r2366673);
        double r2366675 = 2.0;
        double r2366676 = sqrt(r2366675);
        double r2366677 = r2366674 / r2366676;
        double r2366678 = a1;
        double r2366679 = r2366678 * r2366678;
        double r2366680 = r2366677 * r2366679;
        double r2366681 = a2;
        double r2366682 = r2366681 * r2366681;
        double r2366683 = r2366677 * r2366682;
        double r2366684 = r2366680 + r2366683;
        return r2366684;
}

double f(double a1, double a2, double th) {
        double r2366685 = a1;
        double r2366686 = th;
        double r2366687 = cos(r2366686);
        double r2366688 = 2.0;
        double r2366689 = sqrt(r2366688);
        double r2366690 = r2366687 / r2366689;
        double r2366691 = r2366690 * r2366685;
        double r2366692 = r2366685 * r2366691;
        double r2366693 = a2;
        double r2366694 = r2366693 * r2366693;
        double r2366695 = r2366694 * r2366690;
        double r2366696 = r2366692 + r2366695;
        return r2366696;
}

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 \color{blue}{\frac{{a1}^{2} \cdot \cos th}{\sqrt{2}}} + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
  3. Simplified0.5

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

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

Reproduce

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