Average Error: 0.5 → 0.5
Time: 37.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)\]
\[\frac{a2}{\sqrt{2}} \cdot \left(a2 \cdot \cos th\right) + \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}{\sqrt{2}} \cdot \left(a2 \cdot \cos th\right) + \frac{\left(a1 \cdot a1\right) \cdot \cos th}{\sqrt{2}}
double f(double a1, double a2, double th) {
        double r2190514 = th;
        double r2190515 = cos(r2190514);
        double r2190516 = 2.0;
        double r2190517 = sqrt(r2190516);
        double r2190518 = r2190515 / r2190517;
        double r2190519 = a1;
        double r2190520 = r2190519 * r2190519;
        double r2190521 = r2190518 * r2190520;
        double r2190522 = a2;
        double r2190523 = r2190522 * r2190522;
        double r2190524 = r2190518 * r2190523;
        double r2190525 = r2190521 + r2190524;
        return r2190525;
}

double f(double a1, double a2, double th) {
        double r2190526 = a2;
        double r2190527 = 2.0;
        double r2190528 = sqrt(r2190527);
        double r2190529 = r2190526 / r2190528;
        double r2190530 = th;
        double r2190531 = cos(r2190530);
        double r2190532 = r2190526 * r2190531;
        double r2190533 = r2190529 * r2190532;
        double r2190534 = a1;
        double r2190535 = r2190534 * r2190534;
        double r2190536 = r2190535 * r2190531;
        double r2190537 = r2190536 / r2190528;
        double r2190538 = r2190533 + r2190537;
        return r2190538;
}

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}{\frac{a2 \cdot \cos th}{\frac{\sqrt{2}}{a2}}}\]
  4. Using strategy rm
  5. Applied div-inv0.5

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

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

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

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

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

Reproduce

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