Average Error: 0.5 → 0.5
Time: 54.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)\]
\[a1 \cdot \left(\frac{\cos th}{\sqrt{2}} \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\]
\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) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)
double f(double a1, double a2, double th) {
        double r2357944 = th;
        double r2357945 = cos(r2357944);
        double r2357946 = 2.0;
        double r2357947 = sqrt(r2357946);
        double r2357948 = r2357945 / r2357947;
        double r2357949 = a1;
        double r2357950 = r2357949 * r2357949;
        double r2357951 = r2357948 * r2357950;
        double r2357952 = a2;
        double r2357953 = r2357952 * r2357952;
        double r2357954 = r2357948 * r2357953;
        double r2357955 = r2357951 + r2357954;
        return r2357955;
}

double f(double a1, double a2, double th) {
        double r2357956 = a1;
        double r2357957 = th;
        double r2357958 = cos(r2357957);
        double r2357959 = 2.0;
        double r2357960 = sqrt(r2357959);
        double r2357961 = r2357958 / r2357960;
        double r2357962 = r2357961 * r2357956;
        double r2357963 = r2357956 * r2357962;
        double r2357964 = a2;
        double r2357965 = r2357964 * r2357964;
        double r2357966 = r2357961 * r2357965;
        double r2357967 = r2357963 + r2357966;
        return r2357967;
}

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

Reproduce

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