?

Average Error: 0.5 → 0.5
Time: 23.7s
Precision: binary64
Cost: 13504

?

\[\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right) \]
\[\left(\sqrt{0.5} \cdot \cos th\right) \cdot \left(a1 \cdot a1 + a2 \cdot a2\right) \]
(FPCore (a1 a2 th)
 :precision binary64
 (+
  (* (/ (cos th) (sqrt 2.0)) (* a1 a1))
  (* (/ (cos th) (sqrt 2.0)) (* a2 a2))))
(FPCore (a1 a2 th)
 :precision binary64
 (* (* (sqrt 0.5) (cos th)) (+ (* a1 a1) (* a2 a2))))
double code(double a1, double a2, double th) {
	return ((cos(th) / sqrt(2.0)) * (a1 * a1)) + ((cos(th) / sqrt(2.0)) * (a2 * a2));
}
double code(double a1, double a2, double th) {
	return (sqrt(0.5) * cos(th)) * ((a1 * a1) + (a2 * a2));
}
real(8) function code(a1, a2, th)
    real(8), intent (in) :: a1
    real(8), intent (in) :: a2
    real(8), intent (in) :: th
    code = ((cos(th) / sqrt(2.0d0)) * (a1 * a1)) + ((cos(th) / sqrt(2.0d0)) * (a2 * a2))
end function
real(8) function code(a1, a2, th)
    real(8), intent (in) :: a1
    real(8), intent (in) :: a2
    real(8), intent (in) :: th
    code = (sqrt(0.5d0) * cos(th)) * ((a1 * a1) + (a2 * a2))
end function
public static double code(double a1, double a2, double th) {
	return ((Math.cos(th) / Math.sqrt(2.0)) * (a1 * a1)) + ((Math.cos(th) / Math.sqrt(2.0)) * (a2 * a2));
}
public static double code(double a1, double a2, double th) {
	return (Math.sqrt(0.5) * Math.cos(th)) * ((a1 * a1) + (a2 * a2));
}
def code(a1, a2, th):
	return ((math.cos(th) / math.sqrt(2.0)) * (a1 * a1)) + ((math.cos(th) / math.sqrt(2.0)) * (a2 * a2))
def code(a1, a2, th):
	return (math.sqrt(0.5) * math.cos(th)) * ((a1 * a1) + (a2 * a2))
function code(a1, a2, th)
	return Float64(Float64(Float64(cos(th) / sqrt(2.0)) * Float64(a1 * a1)) + Float64(Float64(cos(th) / sqrt(2.0)) * Float64(a2 * a2)))
end
function code(a1, a2, th)
	return Float64(Float64(sqrt(0.5) * cos(th)) * Float64(Float64(a1 * a1) + Float64(a2 * a2)))
end
function tmp = code(a1, a2, th)
	tmp = ((cos(th) / sqrt(2.0)) * (a1 * a1)) + ((cos(th) / sqrt(2.0)) * (a2 * a2));
end
function tmp = code(a1, a2, th)
	tmp = (sqrt(0.5) * cos(th)) * ((a1 * a1) + (a2 * a2));
end
code[a1_, a2_, th_] := N[(N[(N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(a1 * a1), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[a1_, a2_, th_] := N[(N[(N[Sqrt[0.5], $MachinePrecision] * N[Cos[th], $MachinePrecision]), $MachinePrecision] * N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)
\left(\sqrt{0.5} \cdot \cos th\right) \cdot \left(a1 \cdot a1 + a2 \cdot a2\right)

Error?

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. Simplified0.5

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

    [Start]0.5

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

    distribute-lft-out [=>]0.5

    \[ \color{blue}{\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1 + a2 \cdot a2\right)} \]
  3. Applied egg-rr0.5

    \[\leadsto \color{blue}{\left({2}^{-0.5} \cdot \cos th\right)} \cdot \left(a1 \cdot a1 + a2 \cdot a2\right) \]
  4. Taylor expanded in th around inf 0.5

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

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

Alternatives

Alternative 1
Error14.4
Cost14438
\[\begin{array}{l} t_1 := a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ t_2 := a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ \mathbf{if}\;th \leq -1.36 \cdot 10^{+169}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq -1.7 \cdot 10^{+78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -0.046:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 3.3 \cdot 10^{-15}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 3.7 \cdot 10^{+70} \lor \neg \left(th \leq 1.02 \cdot 10^{+86}\right) \land \left(th \leq 4.2 \cdot 10^{+131} \lor \neg \left(th \leq 3.5 \cdot 10^{+217}\right) \land th \leq 10^{+297}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error14.4
Cost14437
\[\begin{array}{l} t_1 := \cos th \cdot \left(\sqrt{0.5} \cdot \left(a2 \cdot a2\right)\right)\\ t_2 := a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ t_3 := a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ \mathbf{if}\;th \leq -2 \cdot 10^{+169}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq -1.7 \cdot 10^{+78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -0.112:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 3.3 \cdot 10^{-15}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 1.25 \cdot 10^{+70}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;th \leq 8.5 \cdot 10^{+85}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 3.2 \cdot 10^{+133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 2.2 \cdot 10^{+217} \lor \neg \left(th \leq 1.9 \cdot 10^{+298}\right):\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 3
Error14.3
Cost14437
\[\begin{array}{l} t_1 := \cos th \cdot \frac{a2}{\frac{\sqrt{2}}{a2}}\\ t_2 := a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ \mathbf{if}\;th \leq -1.85 \cdot 10^{+169}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq -2.2 \cdot 10^{+78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -0.49:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{-10}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 4 \cdot 10^{+70}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 2.15 \cdot 10^{+85}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 6.5 \cdot 10^{+135}:\\ \;\;\;\;\cos th \cdot \left(\sqrt{0.5} \cdot \left(a2 \cdot a2\right)\right)\\ \mathbf{elif}\;th \leq 2.5 \cdot 10^{+217} \lor \neg \left(th \leq 7.5 \cdot 10^{+293}\right):\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ \end{array} \]
Alternative 4
Error14.2
Cost14436
\[\begin{array}{l} t_1 := \cos th \cdot \frac{a2}{\frac{\sqrt{2}}{a2}}\\ t_2 := a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ t_3 := \cos th \cdot \frac{a1 \cdot a1}{\sqrt{2}}\\ \mathbf{if}\;th \leq -1.25 \cdot 10^{+169}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq -1.85 \cdot 10^{+78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -0.095:\\ \;\;\;\;t_3\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{-10}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 2.35 \cdot 10^{+70}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 1.8 \cdot 10^{+85}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 2.7 \cdot 10^{+134}:\\ \;\;\;\;\cos th \cdot \left(\sqrt{0.5} \cdot \left(a2 \cdot a2\right)\right)\\ \mathbf{elif}\;th \leq 2.7 \cdot 10^{+217}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 1.6 \cdot 10^{+292}:\\ \;\;\;\;a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 5
Error14.3
Cost14436
\[\begin{array}{l} t_1 := \cos th \cdot \frac{a2}{\frac{\sqrt{2}}{a2}}\\ t_2 := a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ t_3 := \cos th \cdot \frac{a1 \cdot a1}{\sqrt{2}}\\ \mathbf{if}\;th \leq -1.5 \cdot 10^{+169}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq -2.1 \cdot 10^{+78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -0.07:\\ \;\;\;\;t_3\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{-10}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 1.08 \cdot 10^{+70}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 7.2 \cdot 10^{+86}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 2.1 \cdot 10^{+136}:\\ \;\;\;\;\cos th \cdot \frac{a2 \cdot a2}{\sqrt{2}}\\ \mathbf{elif}\;th \leq 2.6 \cdot 10^{+217}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 3 \cdot 10^{+293}:\\ \;\;\;\;a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 6
Error14.3
Cost14436
\[\begin{array}{l} t_1 := a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ t_2 := \cos th \cdot \frac{a1 \cdot a1}{\sqrt{2}}\\ \mathbf{if}\;th \leq -1.3 \cdot 10^{+169}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq -1.8 \cdot 10^{+78}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a2 \cdot a2\right)\right)\\ \mathbf{elif}\;th \leq -0.048:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{-10}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 2 \cdot 10^{+70}:\\ \;\;\;\;\cos th \cdot \frac{a2}{\frac{\sqrt{2}}{a2}}\\ \mathbf{elif}\;th \leq 3.2 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 2.8 \cdot 10^{+132}:\\ \;\;\;\;\cos th \cdot \frac{a2 \cdot a2}{\sqrt{2}}\\ \mathbf{elif}\;th \leq 2.4 \cdot 10^{+217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 1.6 \cdot 10^{+297}:\\ \;\;\;\;a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error14.3
Cost14436
\[\begin{array}{l} t_1 := a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ t_2 := \sqrt{0.5} \cdot \left(a1 \cdot \left(\cos th \cdot a1\right)\right)\\ \mathbf{if}\;th \leq -2.65 \cdot 10^{+169}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq -2.1 \cdot 10^{+78}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a2 \cdot a2\right)\right)\\ \mathbf{elif}\;th \leq -0.096:\\ \;\;\;\;\cos th \cdot \frac{a1 \cdot a1}{\sqrt{2}}\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{-10}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 2.25 \cdot 10^{+70}:\\ \;\;\;\;\cos th \cdot \frac{a2}{\frac{\sqrt{2}}{a2}}\\ \mathbf{elif}\;th \leq 2.35 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 1.02 \cdot 10^{+132}:\\ \;\;\;\;\cos th \cdot \frac{a2 \cdot a2}{\sqrt{2}}\\ \mathbf{elif}\;th \leq 3.2 \cdot 10^{+217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 1.7 \cdot 10^{+298}:\\ \;\;\;\;a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Error14.2
Cost14436
\[\begin{array}{l} t_1 := a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ \mathbf{if}\;th \leq -1.8 \cdot 10^{+169}:\\ \;\;\;\;\left(\sqrt{0.5} \cdot \cos th\right) \cdot \left(a1 \cdot a1\right)\\ \mathbf{elif}\;th \leq -1.8 \cdot 10^{+78}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a2 \cdot a2\right)\right)\\ \mathbf{elif}\;th \leq -0.105:\\ \;\;\;\;\cos th \cdot \frac{a1 \cdot a1}{\sqrt{2}}\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{-10}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 1.18 \cdot 10^{+70}:\\ \;\;\;\;\cos th \cdot \frac{a2}{\frac{\sqrt{2}}{a2}}\\ \mathbf{elif}\;th \leq 4.1 \cdot 10^{+86}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 4 \cdot 10^{+135}:\\ \;\;\;\;\cos th \cdot \frac{a2 \cdot a2}{\sqrt{2}}\\ \mathbf{elif}\;th \leq 2.6 \cdot 10^{+217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 1.16 \cdot 10^{+294}:\\ \;\;\;\;a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(a1 \cdot \left(\cos th \cdot a1\right)\right)\\ \end{array} \]
Alternative 9
Error14.3
Cost14436
\[\begin{array}{l} t_1 := \cos th \cdot \frac{a1}{\frac{\sqrt{2}}{a1}}\\ \mathbf{if}\;th \leq -2.85 \cdot 10^{+169}:\\ \;\;\;\;\left(\sqrt{0.5} \cdot \cos th\right) \cdot \left(a1 \cdot a1\right)\\ \mathbf{elif}\;th \leq -1.85 \cdot 10^{+78}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a2 \cdot a2\right)\right)\\ \mathbf{elif}\;th \leq -0.25:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{-10}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 2.55 \cdot 10^{+70}:\\ \;\;\;\;\cos th \cdot \frac{a2}{\frac{\sqrt{2}}{a2}}\\ \mathbf{elif}\;th \leq 2.8 \cdot 10^{+85}:\\ \;\;\;\;a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ \mathbf{elif}\;th \leq 5 \cdot 10^{+137}:\\ \;\;\;\;\cos th \cdot \frac{a2 \cdot a2}{\sqrt{2}}\\ \mathbf{elif}\;th \leq 2.6 \cdot 10^{+217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 3 \cdot 10^{+291}:\\ \;\;\;\;a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(a1 \cdot \left(\cos th \cdot a1\right)\right)\\ \end{array} \]
Alternative 10
Error14.2
Cost14436
\[\begin{array}{l} t_1 := \cos th \cdot \frac{a1}{\frac{\sqrt{2}}{a1}}\\ \mathbf{if}\;th \leq -1.9 \cdot 10^{+169}:\\ \;\;\;\;\left(a1 \cdot a1\right) \cdot \frac{\cos th}{\sqrt{2}}\\ \mathbf{elif}\;th \leq -1.85 \cdot 10^{+78}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a2 \cdot a2\right)\right)\\ \mathbf{elif}\;th \leq -0.14:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{-10}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 3.8 \cdot 10^{+70}:\\ \;\;\;\;\cos th \cdot \frac{a2}{\frac{\sqrt{2}}{a2}}\\ \mathbf{elif}\;th \leq 5.5 \cdot 10^{+86}:\\ \;\;\;\;a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{+130}:\\ \;\;\;\;\cos th \cdot \frac{a2 \cdot a2}{\sqrt{2}}\\ \mathbf{elif}\;th \leq 2.3 \cdot 10^{+217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;th \leq 2.5 \cdot 10^{+293}:\\ \;\;\;\;a2 \cdot \frac{\cos th \cdot a2}{\sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(a1 \cdot \left(\cos th \cdot a1\right)\right)\\ \end{array} \]
Alternative 11
Error14.3
Cost14436
\[\begin{array}{l} t_1 := \cos th \cdot a2\\ t_2 := \cos th \cdot \frac{a1}{\frac{\sqrt{2}}{a1}}\\ \mathbf{if}\;th \leq -1.46 \cdot 10^{+169}:\\ \;\;\;\;\left(a1 \cdot a1\right) \cdot \frac{\cos th}{\sqrt{2}}\\ \mathbf{elif}\;th \leq -1.75 \cdot 10^{+78}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a2 \cdot a2\right)\right)\\ \mathbf{elif}\;th \leq -0.017:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 7.6 \cdot 10^{-10}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \mathbf{elif}\;th \leq 2.15 \cdot 10^{+70}:\\ \;\;\;\;\cos th \cdot \frac{a2}{\frac{\sqrt{2}}{a2}}\\ \mathbf{elif}\;th \leq 2.1 \cdot 10^{+85}:\\ \;\;\;\;a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ \mathbf{elif}\;th \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;\frac{a2}{\frac{\sqrt{2}}{t_1}}\\ \mathbf{elif}\;th \leq 2.6 \cdot 10^{+217}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;th \leq 3.8 \cdot 10^{+295}:\\ \;\;\;\;a2 \cdot \frac{t_1}{\sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(a1 \cdot \left(\cos th \cdot a1\right)\right)\\ \end{array} \]
Alternative 12
Error13.9
Cost13513
\[\begin{array}{l} \mathbf{if}\;th \leq -0.3 \lor \neg \left(th \leq 10.2\right):\\ \;\;\;\;a1 \cdot \left(\cos th \cdot \frac{a1}{\sqrt{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \left(\sqrt{0.5} \cdot \left(-0.5 \cdot \left(th \cdot th\right) + 1\right)\right)\\ \end{array} \]
Alternative 13
Error0.5
Cost13504
\[\cos th \cdot \frac{a1 \cdot a1 + a2 \cdot a2}{\sqrt{2}} \]
Alternative 14
Error25.9
Cost6976
\[\sqrt{0.5} \cdot \left(a1 \cdot a1 + a2 \cdot a2\right) \]
Alternative 15
Error36.4
Cost6852
\[\begin{array}{l} \mathbf{if}\;a2 \leq 1.35 \cdot 10^{-138}:\\ \;\;\;\;a1 \cdot \left(\sqrt{0.5} \cdot a1\right)\\ \mathbf{else}:\\ \;\;\;\;a2 \cdot \left(\sqrt{0.5} \cdot a2\right)\\ \end{array} \]
Alternative 16
Error36.4
Cost6852
\[\begin{array}{l} \mathbf{if}\;a2 \leq 1.7 \cdot 10^{-138}:\\ \;\;\;\;\sqrt{0.5} \cdot \left(a1 \cdot a1\right)\\ \mathbf{else}:\\ \;\;\;\;a2 \cdot \left(\sqrt{0.5} \cdot a2\right)\\ \end{array} \]
Alternative 17
Error36.4
Cost6852
\[\begin{array}{l} \mathbf{if}\;a2 \leq 2 \cdot 10^{-138}:\\ \;\;\;\;a1 \cdot \frac{a1}{\sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;a2 \cdot \left(\sqrt{0.5} \cdot a2\right)\\ \end{array} \]
Alternative 18
Error40.7
Cost6720
\[a1 \cdot \left(\sqrt{0.5} \cdot a1\right) \]

Error

Reproduce?

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