
(FPCore (a1 a2 th) :precision binary64 (let* ((t_1 (/ (cos th) (sqrt 2.0)))) (+ (* t_1 (* a1 a1)) (* t_1 (* a2 a2)))))
double code(double a1, double a2, double th) {
double t_1 = cos(th) / sqrt(2.0);
return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2));
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
t_1 = cos(th) / sqrt(2.0d0)
code = (t_1 * (a1 * a1)) + (t_1 * (a2 * a2))
end function
public static double code(double a1, double a2, double th) {
double t_1 = Math.cos(th) / Math.sqrt(2.0);
return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2));
}
def code(a1, a2, th): t_1 = math.cos(th) / math.sqrt(2.0) return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2))
function code(a1, a2, th) t_1 = Float64(cos(th) / sqrt(2.0)) return Float64(Float64(t_1 * Float64(a1 * a1)) + Float64(t_1 * Float64(a2 * a2))) end
function tmp = code(a1, a2, th) t_1 = cos(th) / sqrt(2.0); tmp = (t_1 * (a1 * a1)) + (t_1 * (a2 * a2)); end
code[a1_, a2_, th_] := Block[{t$95$1 = N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$1 * N[(a1 * a1), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\cos th}{\sqrt{2}}\\
t_1 \cdot \left(a1 \cdot a1\right) + t_1 \cdot \left(a2 \cdot a2\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a1 a2 th) :precision binary64 (let* ((t_1 (/ (cos th) (sqrt 2.0)))) (+ (* t_1 (* a1 a1)) (* t_1 (* a2 a2)))))
double code(double a1, double a2, double th) {
double t_1 = cos(th) / sqrt(2.0);
return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2));
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
t_1 = cos(th) / sqrt(2.0d0)
code = (t_1 * (a1 * a1)) + (t_1 * (a2 * a2))
end function
public static double code(double a1, double a2, double th) {
double t_1 = Math.cos(th) / Math.sqrt(2.0);
return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2));
}
def code(a1, a2, th): t_1 = math.cos(th) / math.sqrt(2.0) return (t_1 * (a1 * a1)) + (t_1 * (a2 * a2))
function code(a1, a2, th) t_1 = Float64(cos(th) / sqrt(2.0)) return Float64(Float64(t_1 * Float64(a1 * a1)) + Float64(t_1 * Float64(a2 * a2))) end
function tmp = code(a1, a2, th) t_1 = cos(th) / sqrt(2.0); tmp = (t_1 * (a1 * a1)) + (t_1 * (a2 * a2)); end
code[a1_, a2_, th_] := Block[{t$95$1 = N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$1 * N[(a1 * a1), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\cos th}{\sqrt{2}}\\
t_1 \cdot \left(a1 \cdot a1\right) + t_1 \cdot \left(a2 \cdot a2\right)
\end{array}
\end{array}
(FPCore (a1 a2 th) :precision binary64 (* (* (sqrt 0.5) (cos th)) (+ (* a1 a1) (* 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 = (sqrt(0.5d0) * cos(th)) * ((a1 * a1) + (a2 * a2))
end function
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.sqrt(0.5) * math.cos(th)) * ((a1 * a1) + (a2 * a2))
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 = (sqrt(0.5) * cos(th)) * ((a1 * a1) + (a2 * a2)); end
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]
\begin{array}{l}
\\
\left(\sqrt{0.5} \cdot \cos th\right) \cdot \left(a1 \cdot a1 + a2 \cdot a2\right)
\end{array}
Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.5%
associate-/r/99.5%
pow1/299.5%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in th around inf 99.7%
Final simplification99.7%
(FPCore (a1 a2 th) :precision binary64 (if (<= (cos th) 0.01) (* a2 (/ a2 (/ (sqrt 2.0) (cos th)))) (* (sqrt 0.5) (+ (* a1 a1) (* a2 a2)))))
double code(double a1, double a2, double th) {
double tmp;
if (cos(th) <= 0.01) {
tmp = a2 * (a2 / (sqrt(2.0) / cos(th)));
} else {
tmp = sqrt(0.5) * ((a1 * a1) + (a2 * a2));
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (cos(th) <= 0.01d0) then
tmp = a2 * (a2 / (sqrt(2.0d0) / cos(th)))
else
tmp = sqrt(0.5d0) * ((a1 * a1) + (a2 * a2))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (Math.cos(th) <= 0.01) {
tmp = a2 * (a2 / (Math.sqrt(2.0) / Math.cos(th)));
} else {
tmp = Math.sqrt(0.5) * ((a1 * a1) + (a2 * a2));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if math.cos(th) <= 0.01: tmp = a2 * (a2 / (math.sqrt(2.0) / math.cos(th))) else: tmp = math.sqrt(0.5) * ((a1 * a1) + (a2 * a2)) return tmp
function code(a1, a2, th) tmp = 0.0 if (cos(th) <= 0.01) tmp = Float64(a2 * Float64(a2 / Float64(sqrt(2.0) / cos(th)))); else tmp = Float64(sqrt(0.5) * Float64(Float64(a1 * a1) + Float64(a2 * a2))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (cos(th) <= 0.01) tmp = a2 * (a2 / (sqrt(2.0) / cos(th))); else tmp = sqrt(0.5) * ((a1 * a1) + (a2 * a2)); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[N[Cos[th], $MachinePrecision], 0.01], N[(a2 * N[(a2 / N[(N[Sqrt[2.0], $MachinePrecision] / N[Cos[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[0.5], $MachinePrecision] * N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos th \leq 0.01:\\
\;\;\;\;a2 \cdot \frac{a2}{\frac{\sqrt{2}}{\cos th}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5} \cdot \left(a1 \cdot a1 + a2 \cdot a2\right)\\
\end{array}
\end{array}
if (cos.f64 th) < 0.0100000000000000002Initial program 99.4%
distribute-lft-out99.4%
associate-*l/99.5%
associate-*r/99.5%
fma-def99.5%
Simplified99.5%
Taylor expanded in a1 around 0 53.4%
unpow253.4%
associate-*l*53.4%
associate-*r/53.4%
associate-/l*53.5%
Simplified53.5%
if 0.0100000000000000002 < (cos.f64 th) Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.5%
associate-/r/99.5%
pow1/299.5%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 87.7%
unpow287.7%
unpow287.7%
Simplified87.7%
Final simplification77.4%
(FPCore (a1 a2 th) :precision binary64 (let* ((t_1 (+ (* a1 a1) (* a2 a2)))) (if (<= (cos th) -0.01) (* t_1 -0.5) (* (sqrt 0.5) t_1))))
double code(double a1, double a2, double th) {
double t_1 = (a1 * a1) + (a2 * a2);
double tmp;
if (cos(th) <= -0.01) {
tmp = t_1 * -0.5;
} else {
tmp = sqrt(0.5) * t_1;
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = (a1 * a1) + (a2 * a2)
if (cos(th) <= (-0.01d0)) then
tmp = t_1 * (-0.5d0)
else
tmp = sqrt(0.5d0) * t_1
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double t_1 = (a1 * a1) + (a2 * a2);
double tmp;
if (Math.cos(th) <= -0.01) {
tmp = t_1 * -0.5;
} else {
tmp = Math.sqrt(0.5) * t_1;
}
return tmp;
}
def code(a1, a2, th): t_1 = (a1 * a1) + (a2 * a2) tmp = 0 if math.cos(th) <= -0.01: tmp = t_1 * -0.5 else: tmp = math.sqrt(0.5) * t_1 return tmp
function code(a1, a2, th) t_1 = Float64(Float64(a1 * a1) + Float64(a2 * a2)) tmp = 0.0 if (cos(th) <= -0.01) tmp = Float64(t_1 * -0.5); else tmp = Float64(sqrt(0.5) * t_1); end return tmp end
function tmp_2 = code(a1, a2, th) t_1 = (a1 * a1) + (a2 * a2); tmp = 0.0; if (cos(th) <= -0.01) tmp = t_1 * -0.5; else tmp = sqrt(0.5) * t_1; end tmp_2 = tmp; end
code[a1_, a2_, th_] := Block[{t$95$1 = N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[th], $MachinePrecision], -0.01], N[(t$95$1 * -0.5), $MachinePrecision], N[(N[Sqrt[0.5], $MachinePrecision] * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a1 \cdot a1 + a2 \cdot a2\\
\mathbf{if}\;\cos th \leq -0.01:\\
\;\;\;\;t_1 \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5} \cdot t_1\\
\end{array}
\end{array}
if (cos.f64 th) < -0.0100000000000000002Initial program 99.4%
distribute-lft-out99.4%
Simplified99.4%
Taylor expanded in th around 0 6.4%
Applied egg-rr49.2%
if -0.0100000000000000002 < (cos.f64 th) Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.5%
associate-/r/99.5%
pow1/299.5%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 87.4%
unpow287.4%
unpow287.4%
Simplified87.4%
Final simplification76.2%
(FPCore (a1 a2 th) :precision binary64 (let* ((t_1 (+ (* a1 a1) (* a2 a2)))) (if (<= (cos th) 0.71) (* (cos th) t_1) (* (sqrt 0.5) t_1))))
double code(double a1, double a2, double th) {
double t_1 = (a1 * a1) + (a2 * a2);
double tmp;
if (cos(th) <= 0.71) {
tmp = cos(th) * t_1;
} else {
tmp = sqrt(0.5) * t_1;
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = (a1 * a1) + (a2 * a2)
if (cos(th) <= 0.71d0) then
tmp = cos(th) * t_1
else
tmp = sqrt(0.5d0) * t_1
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double t_1 = (a1 * a1) + (a2 * a2);
double tmp;
if (Math.cos(th) <= 0.71) {
tmp = Math.cos(th) * t_1;
} else {
tmp = Math.sqrt(0.5) * t_1;
}
return tmp;
}
def code(a1, a2, th): t_1 = (a1 * a1) + (a2 * a2) tmp = 0 if math.cos(th) <= 0.71: tmp = math.cos(th) * t_1 else: tmp = math.sqrt(0.5) * t_1 return tmp
function code(a1, a2, th) t_1 = Float64(Float64(a1 * a1) + Float64(a2 * a2)) tmp = 0.0 if (cos(th) <= 0.71) tmp = Float64(cos(th) * t_1); else tmp = Float64(sqrt(0.5) * t_1); end return tmp end
function tmp_2 = code(a1, a2, th) t_1 = (a1 * a1) + (a2 * a2); tmp = 0.0; if (cos(th) <= 0.71) tmp = cos(th) * t_1; else tmp = sqrt(0.5) * t_1; end tmp_2 = tmp; end
code[a1_, a2_, th_] := Block[{t$95$1 = N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[th], $MachinePrecision], 0.71], N[(N[Cos[th], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[Sqrt[0.5], $MachinePrecision] * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a1 \cdot a1 + a2 \cdot a2\\
\mathbf{if}\;\cos th \leq 0.71:\\
\;\;\;\;\cos th \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5} \cdot t_1\\
\end{array}
\end{array}
if (cos.f64 th) < 0.70999999999999996Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.4%
associate-/r/99.4%
pow1/299.4%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Applied egg-rr52.2%
if 0.70999999999999996 < (cos.f64 th) Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.5%
associate-/r/99.5%
pow1/299.5%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 91.7%
unpow291.7%
unpow291.7%
Simplified91.7%
Final simplification76.3%
(FPCore (a1 a2 th) :precision binary64 (if (<= a1 -2.9e-102) (* (cos th) (/ (* a1 a1) (sqrt 2.0))) (* a2 (/ a2 (/ (sqrt 2.0) (cos th))))))
double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -2.9e-102) {
tmp = cos(th) * ((a1 * a1) / sqrt(2.0));
} else {
tmp = a2 * (a2 / (sqrt(2.0) / cos(th)));
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (a1 <= (-2.9d-102)) then
tmp = cos(th) * ((a1 * a1) / sqrt(2.0d0))
else
tmp = a2 * (a2 / (sqrt(2.0d0) / cos(th)))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -2.9e-102) {
tmp = Math.cos(th) * ((a1 * a1) / Math.sqrt(2.0));
} else {
tmp = a2 * (a2 / (Math.sqrt(2.0) / Math.cos(th)));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if a1 <= -2.9e-102: tmp = math.cos(th) * ((a1 * a1) / math.sqrt(2.0)) else: tmp = a2 * (a2 / (math.sqrt(2.0) / math.cos(th))) return tmp
function code(a1, a2, th) tmp = 0.0 if (a1 <= -2.9e-102) tmp = Float64(cos(th) * Float64(Float64(a1 * a1) / sqrt(2.0))); else tmp = Float64(a2 * Float64(a2 / Float64(sqrt(2.0) / cos(th)))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (a1 <= -2.9e-102) tmp = cos(th) * ((a1 * a1) / sqrt(2.0)); else tmp = a2 * (a2 / (sqrt(2.0) / cos(th))); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[a1, -2.9e-102], N[(N[Cos[th], $MachinePrecision] * N[(N[(a1 * a1), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 / N[(N[Sqrt[2.0], $MachinePrecision] / N[Cos[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a1 \leq -2.9 \cdot 10^{-102}:\\
\;\;\;\;\cos th \cdot \frac{a1 \cdot a1}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \frac{a2}{\frac{\sqrt{2}}{\cos th}}\\
\end{array}
\end{array}
if a1 < -2.89999999999999986e-102Initial program 99.5%
distribute-lft-out99.5%
associate-*l/99.5%
associate-*r/99.6%
fma-def99.6%
Simplified99.6%
Taylor expanded in a1 around inf 73.3%
unpow273.3%
Simplified73.3%
if -2.89999999999999986e-102 < a1 Initial program 99.5%
distribute-lft-out99.5%
associate-*l/99.6%
associate-*r/99.6%
fma-def99.6%
Simplified99.6%
Taylor expanded in a1 around 0 63.6%
unpow263.6%
associate-*l*63.5%
associate-*r/63.6%
associate-/l*63.6%
Simplified63.6%
Final simplification67.0%
(FPCore (a1 a2 th) :precision binary64 (if (<= a1 -7e-101) (* (sqrt 0.5) (* (cos th) (* a1 a1))) (* a2 (/ a2 (/ (sqrt 2.0) (cos th))))))
double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7e-101) {
tmp = sqrt(0.5) * (cos(th) * (a1 * a1));
} else {
tmp = a2 * (a2 / (sqrt(2.0) / cos(th)));
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (a1 <= (-7d-101)) then
tmp = sqrt(0.5d0) * (cos(th) * (a1 * a1))
else
tmp = a2 * (a2 / (sqrt(2.0d0) / cos(th)))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7e-101) {
tmp = Math.sqrt(0.5) * (Math.cos(th) * (a1 * a1));
} else {
tmp = a2 * (a2 / (Math.sqrt(2.0) / Math.cos(th)));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if a1 <= -7e-101: tmp = math.sqrt(0.5) * (math.cos(th) * (a1 * a1)) else: tmp = a2 * (a2 / (math.sqrt(2.0) / math.cos(th))) return tmp
function code(a1, a2, th) tmp = 0.0 if (a1 <= -7e-101) tmp = Float64(sqrt(0.5) * Float64(cos(th) * Float64(a1 * a1))); else tmp = Float64(a2 * Float64(a2 / Float64(sqrt(2.0) / cos(th)))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (a1 <= -7e-101) tmp = sqrt(0.5) * (cos(th) * (a1 * a1)); else tmp = a2 * (a2 / (sqrt(2.0) / cos(th))); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[a1, -7e-101], N[(N[Sqrt[0.5], $MachinePrecision] * N[(N[Cos[th], $MachinePrecision] * N[(a1 * a1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 / N[(N[Sqrt[2.0], $MachinePrecision] / N[Cos[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a1 \leq -7 \cdot 10^{-101}:\\
\;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a1 \cdot a1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \frac{a2}{\frac{\sqrt{2}}{\cos th}}\\
\end{array}
\end{array}
if a1 < -6.99999999999999989e-101Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.4%
associate-/r/99.4%
pow1/299.4%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in a1 around inf 73.3%
unpow273.3%
Simplified73.3%
if -6.99999999999999989e-101 < a1 Initial program 99.5%
distribute-lft-out99.5%
associate-*l/99.6%
associate-*r/99.6%
fma-def99.6%
Simplified99.6%
Taylor expanded in a1 around 0 63.6%
unpow263.6%
associate-*l*63.5%
associate-*r/63.6%
associate-/l*63.6%
Simplified63.6%
Final simplification67.0%
(FPCore (a1 a2 th) :precision binary64 (if (<= a1 -7e-101) (* (sqrt 0.5) (* (cos th) (* a1 a1))) (* (sqrt 0.5) (* (cos th) (* a2 a2)))))
double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7e-101) {
tmp = sqrt(0.5) * (cos(th) * (a1 * a1));
} else {
tmp = sqrt(0.5) * (cos(th) * (a2 * a2));
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (a1 <= (-7d-101)) then
tmp = sqrt(0.5d0) * (cos(th) * (a1 * a1))
else
tmp = sqrt(0.5d0) * (cos(th) * (a2 * a2))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7e-101) {
tmp = Math.sqrt(0.5) * (Math.cos(th) * (a1 * a1));
} else {
tmp = Math.sqrt(0.5) * (Math.cos(th) * (a2 * a2));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if a1 <= -7e-101: tmp = math.sqrt(0.5) * (math.cos(th) * (a1 * a1)) else: tmp = math.sqrt(0.5) * (math.cos(th) * (a2 * a2)) return tmp
function code(a1, a2, th) tmp = 0.0 if (a1 <= -7e-101) tmp = Float64(sqrt(0.5) * Float64(cos(th) * Float64(a1 * a1))); else tmp = Float64(sqrt(0.5) * Float64(cos(th) * Float64(a2 * a2))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (a1 <= -7e-101) tmp = sqrt(0.5) * (cos(th) * (a1 * a1)); else tmp = sqrt(0.5) * (cos(th) * (a2 * a2)); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[a1, -7e-101], N[(N[Sqrt[0.5], $MachinePrecision] * N[(N[Cos[th], $MachinePrecision] * N[(a1 * a1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[0.5], $MachinePrecision] * N[(N[Cos[th], $MachinePrecision] * N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a1 \leq -7 \cdot 10^{-101}:\\
\;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a1 \cdot a1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a2 \cdot a2\right)\right)\\
\end{array}
\end{array}
if a1 < -6.99999999999999989e-101Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.4%
associate-/r/99.4%
pow1/299.4%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in a1 around inf 73.3%
unpow273.3%
Simplified73.3%
if -6.99999999999999989e-101 < a1 Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.5%
associate-/r/99.5%
pow1/299.5%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in a1 around 0 63.6%
unpow263.6%
Simplified63.6%
Final simplification67.0%
(FPCore (a1 a2 th) :precision binary64 (if (<= a1 -7e-101) (* (sqrt 0.5) (* (cos th) (* a1 a1))) (/ (cos th) (/ (sqrt 2.0) (* a2 a2)))))
double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7e-101) {
tmp = sqrt(0.5) * (cos(th) * (a1 * a1));
} else {
tmp = cos(th) / (sqrt(2.0) / (a2 * a2));
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (a1 <= (-7d-101)) then
tmp = sqrt(0.5d0) * (cos(th) * (a1 * a1))
else
tmp = cos(th) / (sqrt(2.0d0) / (a2 * a2))
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7e-101) {
tmp = Math.sqrt(0.5) * (Math.cos(th) * (a1 * a1));
} else {
tmp = Math.cos(th) / (Math.sqrt(2.0) / (a2 * a2));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if a1 <= -7e-101: tmp = math.sqrt(0.5) * (math.cos(th) * (a1 * a1)) else: tmp = math.cos(th) / (math.sqrt(2.0) / (a2 * a2)) return tmp
function code(a1, a2, th) tmp = 0.0 if (a1 <= -7e-101) tmp = Float64(sqrt(0.5) * Float64(cos(th) * Float64(a1 * a1))); else tmp = Float64(cos(th) / Float64(sqrt(2.0) / Float64(a2 * a2))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (a1 <= -7e-101) tmp = sqrt(0.5) * (cos(th) * (a1 * a1)); else tmp = cos(th) / (sqrt(2.0) / (a2 * a2)); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[a1, -7e-101], N[(N[Sqrt[0.5], $MachinePrecision] * N[(N[Cos[th], $MachinePrecision] * N[(a1 * a1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[th], $MachinePrecision] / N[(N[Sqrt[2.0], $MachinePrecision] / N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a1 \leq -7 \cdot 10^{-101}:\\
\;\;\;\;\sqrt{0.5} \cdot \left(\cos th \cdot \left(a1 \cdot a1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos th}{\frac{\sqrt{2}}{a2 \cdot a2}}\\
\end{array}
\end{array}
if a1 < -6.99999999999999989e-101Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.4%
associate-/r/99.4%
pow1/299.4%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in a1 around inf 73.3%
unpow273.3%
Simplified73.3%
if -6.99999999999999989e-101 < a1 Initial program 99.5%
distribute-lft-out99.5%
associate-*l/99.6%
associate-*r/99.6%
fma-def99.6%
Simplified99.6%
fma-def99.6%
clear-num99.6%
un-div-inv99.6%
add-sqr-sqrt99.6%
pow299.6%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in a1 around 0 63.6%
unpow263.6%
Simplified63.6%
Final simplification67.0%
(FPCore (a1 a2 th) :precision binary64 (let* ((t_1 (+ (* a1 a1) (* a2 a2)))) (if (<= (cos th) -0.01) (* t_1 -0.5) (* 0.5 t_1))))
double code(double a1, double a2, double th) {
double t_1 = (a1 * a1) + (a2 * a2);
double tmp;
if (cos(th) <= -0.01) {
tmp = t_1 * -0.5;
} else {
tmp = 0.5 * t_1;
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = (a1 * a1) + (a2 * a2)
if (cos(th) <= (-0.01d0)) then
tmp = t_1 * (-0.5d0)
else
tmp = 0.5d0 * t_1
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double t_1 = (a1 * a1) + (a2 * a2);
double tmp;
if (Math.cos(th) <= -0.01) {
tmp = t_1 * -0.5;
} else {
tmp = 0.5 * t_1;
}
return tmp;
}
def code(a1, a2, th): t_1 = (a1 * a1) + (a2 * a2) tmp = 0 if math.cos(th) <= -0.01: tmp = t_1 * -0.5 else: tmp = 0.5 * t_1 return tmp
function code(a1, a2, th) t_1 = Float64(Float64(a1 * a1) + Float64(a2 * a2)) tmp = 0.0 if (cos(th) <= -0.01) tmp = Float64(t_1 * -0.5); else tmp = Float64(0.5 * t_1); end return tmp end
function tmp_2 = code(a1, a2, th) t_1 = (a1 * a1) + (a2 * a2); tmp = 0.0; if (cos(th) <= -0.01) tmp = t_1 * -0.5; else tmp = 0.5 * t_1; end tmp_2 = tmp; end
code[a1_, a2_, th_] := Block[{t$95$1 = N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[th], $MachinePrecision], -0.01], N[(t$95$1 * -0.5), $MachinePrecision], N[(0.5 * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a1 \cdot a1 + a2 \cdot a2\\
\mathbf{if}\;\cos th \leq -0.01:\\
\;\;\;\;t_1 \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot t_1\\
\end{array}
\end{array}
if (cos.f64 th) < -0.0100000000000000002Initial program 99.4%
distribute-lft-out99.4%
Simplified99.4%
Taylor expanded in th around 0 6.4%
Applied egg-rr49.2%
if -0.0100000000000000002 < (cos.f64 th) Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 87.3%
Applied egg-rr54.3%
Final simplification52.8%
(FPCore (a1 a2 th) :precision binary64 (if (<= a1 -7.6e+124) (* (cos th) (* a1 a1)) (if (<= a1 -1.95e-121) (/ (* a1 a1) (sqrt 2.0)) (* (cos th) (* a2 a2)))))
double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7.6e+124) {
tmp = cos(th) * (a1 * a1);
} else if (a1 <= -1.95e-121) {
tmp = (a1 * a1) / sqrt(2.0);
} else {
tmp = cos(th) * (a2 * a2);
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (a1 <= (-7.6d+124)) then
tmp = cos(th) * (a1 * a1)
else if (a1 <= (-1.95d-121)) then
tmp = (a1 * a1) / sqrt(2.0d0)
else
tmp = cos(th) * (a2 * a2)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7.6e+124) {
tmp = Math.cos(th) * (a1 * a1);
} else if (a1 <= -1.95e-121) {
tmp = (a1 * a1) / Math.sqrt(2.0);
} else {
tmp = Math.cos(th) * (a2 * a2);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if a1 <= -7.6e+124: tmp = math.cos(th) * (a1 * a1) elif a1 <= -1.95e-121: tmp = (a1 * a1) / math.sqrt(2.0) else: tmp = math.cos(th) * (a2 * a2) return tmp
function code(a1, a2, th) tmp = 0.0 if (a1 <= -7.6e+124) tmp = Float64(cos(th) * Float64(a1 * a1)); elseif (a1 <= -1.95e-121) tmp = Float64(Float64(a1 * a1) / sqrt(2.0)); else tmp = Float64(cos(th) * Float64(a2 * a2)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (a1 <= -7.6e+124) tmp = cos(th) * (a1 * a1); elseif (a1 <= -1.95e-121) tmp = (a1 * a1) / sqrt(2.0); else tmp = cos(th) * (a2 * a2); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[a1, -7.6e+124], N[(N[Cos[th], $MachinePrecision] * N[(a1 * a1), $MachinePrecision]), $MachinePrecision], If[LessEqual[a1, -1.95e-121], N[(N[(a1 * a1), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], N[(N[Cos[th], $MachinePrecision] * N[(a2 * a2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a1 \leq -7.6 \cdot 10^{+124}:\\
\;\;\;\;\cos th \cdot \left(a1 \cdot a1\right)\\
\mathbf{elif}\;a1 \leq -1.95 \cdot 10^{-121}:\\
\;\;\;\;\frac{a1 \cdot a1}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos th \cdot \left(a2 \cdot a2\right)\\
\end{array}
\end{array}
if a1 < -7.5999999999999997e124Initial program 99.9%
distribute-lft-out99.9%
associate-*l/99.9%
associate-*r/100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in a1 around inf 97.5%
unpow297.5%
associate-/l*97.5%
Simplified97.5%
Applied egg-rr91.1%
*-commutative91.1%
associate-*r*91.1%
Simplified91.1%
if -7.5999999999999997e124 < a1 < -1.95e-121Initial program 99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 53.3%
Taylor expanded in a1 around inf 23.6%
unpow223.6%
Simplified23.6%
if -1.95e-121 < a1 Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.5%
associate-/r/99.5%
pow1/299.5%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Applied egg-rr51.1%
Taylor expanded in a1 around 0 36.0%
unpow236.0%
Simplified36.0%
Final simplification41.3%
(FPCore (a1 a2 th) :precision binary64 (if (<= a1 -7.6e+124) (* (cos th) (* a1 a1)) (if (<= a1 -1.35e-91) (/ (* a1 a1) (sqrt 2.0)) (/ (* a2 a2) (sqrt 2.0)))))
double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7.6e+124) {
tmp = cos(th) * (a1 * a1);
} else if (a1 <= -1.35e-91) {
tmp = (a1 * a1) / sqrt(2.0);
} else {
tmp = (a2 * a2) / sqrt(2.0);
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (a1 <= (-7.6d+124)) then
tmp = cos(th) * (a1 * a1)
else if (a1 <= (-1.35d-91)) then
tmp = (a1 * a1) / sqrt(2.0d0)
else
tmp = (a2 * a2) / sqrt(2.0d0)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (a1 <= -7.6e+124) {
tmp = Math.cos(th) * (a1 * a1);
} else if (a1 <= -1.35e-91) {
tmp = (a1 * a1) / Math.sqrt(2.0);
} else {
tmp = (a2 * a2) / Math.sqrt(2.0);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if a1 <= -7.6e+124: tmp = math.cos(th) * (a1 * a1) elif a1 <= -1.35e-91: tmp = (a1 * a1) / math.sqrt(2.0) else: tmp = (a2 * a2) / math.sqrt(2.0) return tmp
function code(a1, a2, th) tmp = 0.0 if (a1 <= -7.6e+124) tmp = Float64(cos(th) * Float64(a1 * a1)); elseif (a1 <= -1.35e-91) tmp = Float64(Float64(a1 * a1) / sqrt(2.0)); else tmp = Float64(Float64(a2 * a2) / sqrt(2.0)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (a1 <= -7.6e+124) tmp = cos(th) * (a1 * a1); elseif (a1 <= -1.35e-91) tmp = (a1 * a1) / sqrt(2.0); else tmp = (a2 * a2) / sqrt(2.0); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[a1, -7.6e+124], N[(N[Cos[th], $MachinePrecision] * N[(a1 * a1), $MachinePrecision]), $MachinePrecision], If[LessEqual[a1, -1.35e-91], N[(N[(a1 * a1), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], N[(N[(a2 * a2), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a1 \leq -7.6 \cdot 10^{+124}:\\
\;\;\;\;\cos th \cdot \left(a1 \cdot a1\right)\\
\mathbf{elif}\;a1 \leq -1.35 \cdot 10^{-91}:\\
\;\;\;\;\frac{a1 \cdot a1}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a2 \cdot a2}{\sqrt{2}}\\
\end{array}
\end{array}
if a1 < -7.5999999999999997e124Initial program 99.9%
distribute-lft-out99.9%
associate-*l/99.9%
associate-*r/100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in a1 around inf 97.5%
unpow297.5%
associate-/l*97.5%
Simplified97.5%
Applied egg-rr91.1%
*-commutative91.1%
associate-*r*91.1%
Simplified91.1%
if -7.5999999999999997e124 < a1 < -1.3499999999999999e-91Initial program 99.2%
distribute-lft-out99.2%
Simplified99.2%
Taylor expanded in th around 0 53.1%
Taylor expanded in a1 around inf 25.1%
unpow225.1%
Simplified25.1%
if -1.3499999999999999e-91 < a1 Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 63.4%
Taylor expanded in a1 around 0 43.5%
unpow243.5%
Simplified43.5%
Final simplification46.6%
(FPCore (a1 a2 th) :precision binary64 (if (<= a2 1.8e+151) (* a1 a1) (- a1 (* a2 a2))))
double code(double a1, double a2, double th) {
double tmp;
if (a2 <= 1.8e+151) {
tmp = a1 * a1;
} else {
tmp = a1 - (a2 * a2);
}
return tmp;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
real(8) :: tmp
if (a2 <= 1.8d+151) then
tmp = a1 * a1
else
tmp = a1 - (a2 * a2)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (a2 <= 1.8e+151) {
tmp = a1 * a1;
} else {
tmp = a1 - (a2 * a2);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if a2 <= 1.8e+151: tmp = a1 * a1 else: tmp = a1 - (a2 * a2) return tmp
function code(a1, a2, th) tmp = 0.0 if (a2 <= 1.8e+151) tmp = Float64(a1 * a1); else tmp = Float64(a1 - Float64(a2 * a2)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (a2 <= 1.8e+151) tmp = a1 * a1; else tmp = a1 - (a2 * a2); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[a2, 1.8e+151], N[(a1 * a1), $MachinePrecision], N[(a1 - N[(a2 * a2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a2 \leq 1.8 \cdot 10^{+151}:\\
\;\;\;\;a1 \cdot a1\\
\mathbf{else}:\\
\;\;\;\;a1 - a2 \cdot a2\\
\end{array}
\end{array}
if a2 < 1.8e151Initial program 99.4%
distribute-lft-out99.4%
Simplified99.4%
Taylor expanded in th around 0 63.7%
Taylor expanded in a1 around inf 39.5%
unpow239.5%
Simplified39.5%
Applied egg-rr28.6%
if 1.8e151 < a2 Initial program 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in th around 0 63.3%
Applied egg-rr36.7%
cancel-sign-sub-inv36.7%
Simplified36.7%
Final simplification29.5%
(FPCore (a1 a2 th) :precision binary64 (* (+ a1 a2) (+ a1 a2)))
double code(double a1, double a2, double th) {
return (a1 + a2) * (a1 + a2);
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = (a1 + a2) * (a1 + a2)
end function
public static double code(double a1, double a2, double th) {
return (a1 + a2) * (a1 + a2);
}
def code(a1, a2, th): return (a1 + a2) * (a1 + a2)
function code(a1, a2, th) return Float64(Float64(a1 + a2) * Float64(a1 + a2)) end
function tmp = code(a1, a2, th) tmp = (a1 + a2) * (a1 + a2); end
code[a1_, a2_, th_] := N[(N[(a1 + a2), $MachinePrecision] * N[(a1 + a2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(a1 + a2\right) \cdot \left(a1 + a2\right)
\end{array}
Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 63.6%
Applied egg-rr35.3%
distribute-lft-out40.0%
+-commutative40.0%
Simplified40.0%
Final simplification40.0%
(FPCore (a1 a2 th) :precision binary64 (* a1 -2.0))
double code(double a1, double a2, double th) {
return a1 * -2.0;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a1 * (-2.0d0)
end function
public static double code(double a1, double a2, double th) {
return a1 * -2.0;
}
def code(a1, a2, th): return a1 * -2.0
function code(a1, a2, th) return Float64(a1 * -2.0) end
function tmp = code(a1, a2, th) tmp = a1 * -2.0; end
code[a1_, a2_, th_] := N[(a1 * -2.0), $MachinePrecision]
\begin{array}{l}
\\
a1 \cdot -2
\end{array}
Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 63.6%
Taylor expanded in a1 around inf 37.8%
unpow237.8%
Simplified37.8%
Applied egg-rr3.9%
Final simplification3.9%
(FPCore (a1 a2 th) :precision binary64 (* a1 a1))
double code(double a1, double a2, double th) {
return a1 * a1;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a1 * a1
end function
public static double code(double a1, double a2, double th) {
return a1 * a1;
}
def code(a1, a2, th): return a1 * a1
function code(a1, a2, th) return Float64(a1 * a1) end
function tmp = code(a1, a2, th) tmp = a1 * a1; end
code[a1_, a2_, th_] := N[(a1 * a1), $MachinePrecision]
\begin{array}{l}
\\
a1 \cdot a1
\end{array}
Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 63.6%
Taylor expanded in a1 around inf 37.8%
unpow237.8%
Simplified37.8%
Applied egg-rr28.1%
Final simplification28.1%
(FPCore (a1 a2 th) :precision binary64 (- a1))
double code(double a1, double a2, double th) {
return -a1;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = -a1
end function
public static double code(double a1, double a2, double th) {
return -a1;
}
def code(a1, a2, th): return -a1
function code(a1, a2, th) return Float64(-a1) end
function tmp = code(a1, a2, th) tmp = -a1; end
code[a1_, a2_, th_] := (-a1)
\begin{array}{l}
\\
-a1
\end{array}
Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 63.6%
Taylor expanded in a1 around inf 37.8%
unpow237.8%
Simplified37.8%
Applied egg-rr3.9%
neg-sub03.9%
Simplified3.9%
Final simplification3.9%
(FPCore (a1 a2 th) :precision binary64 1.0)
double code(double a1, double a2, double th) {
return 1.0;
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = 1.0d0
end function
public static double code(double a1, double a2, double th) {
return 1.0;
}
def code(a1, a2, th): return 1.0
function code(a1, a2, th) return 1.0 end
function tmp = code(a1, a2, th) tmp = 1.0; end
code[a1_, a2_, th_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
clear-num99.5%
associate-/r/99.5%
pow1/299.5%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Applied egg-rr3.6%
*-inverses3.6%
Simplified3.6%
Final simplification3.6%
herbie shell --seed 2023178
(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))))