
(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 18 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 (/ (* (hypot a1 a2) (cos th)) (/ (sqrt 2.0) (hypot a1 a2))))
double code(double a1, double a2, double th) {
return (hypot(a1, a2) * cos(th)) / (sqrt(2.0) / hypot(a1, a2));
}
public static double code(double a1, double a2, double th) {
return (Math.hypot(a1, a2) * Math.cos(th)) / (Math.sqrt(2.0) / Math.hypot(a1, a2));
}
def code(a1, a2, th): return (math.hypot(a1, a2) * math.cos(th)) / (math.sqrt(2.0) / math.hypot(a1, a2))
function code(a1, a2, th) return Float64(Float64(hypot(a1, a2) * cos(th)) / Float64(sqrt(2.0) / hypot(a1, a2))) end
function tmp = code(a1, a2, th) tmp = (hypot(a1, a2) * cos(th)) / (sqrt(2.0) / hypot(a1, a2)); end
code[a1_, a2_, th_] := N[(N[(N[Sqrt[a1 ^ 2 + a2 ^ 2], $MachinePrecision] * N[Cos[th], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[2.0], $MachinePrecision] / N[Sqrt[a1 ^ 2 + a2 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{hypot}\left(a1, a2\right) \cdot \cos th}{\frac{\sqrt{2}}{\mathsf{hypot}\left(a1, a2\right)}}
\end{array}
Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
fma-def99.3%
add-sqr-sqrt99.3%
*-un-lft-identity99.3%
times-frac99.3%
hypot-def99.2%
hypot-def99.2%
Applied egg-rr99.2%
/-rgt-identity99.2%
associate-*r*99.5%
clear-num99.5%
un-div-inv99.6%
*-commutative99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (a1 a2 th) :precision binary64 (* (cos th) (/ (fma a1 a1 (* a2 a2)) (sqrt 2.0))))
double code(double a1, double a2, double th) {
return cos(th) * (fma(a1, a1, (a2 * a2)) / sqrt(2.0));
}
function code(a1, a2, th) return Float64(cos(th) * Float64(fma(a1, a1, Float64(a2 * a2)) / sqrt(2.0))) end
code[a1_, a2_, th_] := N[(N[Cos[th], $MachinePrecision] * N[(N[(a1 * a1 + N[(a2 * a2), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos th \cdot \frac{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}{\sqrt{2}}
\end{array}
Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (a1 a2 th) :precision binary64 (/ (fma a2 a2 (* a1 a1)) (/ (sqrt 2.0) (cos th))))
double code(double a1, double a2, double th) {
return fma(a2, a2, (a1 * a1)) / (sqrt(2.0) / cos(th));
}
function code(a1, a2, th) return Float64(fma(a2, a2, Float64(a1 * a1)) / Float64(sqrt(2.0) / cos(th))) end
code[a1_, a2_, th_] := N[(N[(a2 * a2 + N[(a1 * a1), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[2.0], $MachinePrecision] / N[Cos[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(a2, a2, a1 \cdot a1\right)}{\frac{\sqrt{2}}{\cos th}}
\end{array}
Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
fma-def99.3%
add-sqr-sqrt99.3%
*-un-lft-identity99.3%
times-frac99.3%
hypot-def99.2%
hypot-def99.2%
Applied egg-rr99.2%
Taylor expanded in th around inf 99.3%
associate-/l*99.3%
unpow299.3%
fma-def99.3%
unpow299.3%
Simplified99.3%
Final simplification99.3%
(FPCore (a1 a2 th) :precision binary64 (* (* (cos th) (/ -1.0 (- (sqrt 2.0)))) (+ (* a1 a1) (* a2 a2))))
double code(double a1, double a2, double th) {
return (cos(th) * (-1.0 / -sqrt(2.0))) * ((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) * ((-1.0d0) / -sqrt(2.0d0))) * ((a1 * a1) + (a2 * a2))
end function
public static double code(double a1, double a2, double th) {
return (Math.cos(th) * (-1.0 / -Math.sqrt(2.0))) * ((a1 * a1) + (a2 * a2));
}
def code(a1, a2, th): return (math.cos(th) * (-1.0 / -math.sqrt(2.0))) * ((a1 * a1) + (a2 * a2))
function code(a1, a2, th) return Float64(Float64(cos(th) * Float64(-1.0 / Float64(-sqrt(2.0)))) * Float64(Float64(a1 * a1) + Float64(a2 * a2))) end
function tmp = code(a1, a2, th) tmp = (cos(th) * (-1.0 / -sqrt(2.0))) * ((a1 * a1) + (a2 * a2)); end
code[a1_, a2_, th_] := N[(N[(N[Cos[th], $MachinePrecision] * N[(-1.0 / (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] * N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\cos th \cdot \frac{-1}{-\sqrt{2}}\right) \cdot \left(a1 \cdot a1 + a2 \cdot a2\right)
\end{array}
Initial program 99.2%
distribute-lft-out99.2%
Simplified99.2%
frac-2neg99.2%
div-inv99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (a1 a2 th) :precision binary64 (if (<= (cos th) 0.65) (* (cos th) (* a2 a2)) (/ (+ (* a1 a1) (* a2 a2)) (sqrt 2.0))))
double code(double a1, double a2, double th) {
double tmp;
if (cos(th) <= 0.65) {
tmp = cos(th) * (a2 * a2);
} else {
tmp = ((a1 * a1) + (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 (cos(th) <= 0.65d0) then
tmp = cos(th) * (a2 * a2)
else
tmp = ((a1 * a1) + (a2 * a2)) / sqrt(2.0d0)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if (Math.cos(th) <= 0.65) {
tmp = Math.cos(th) * (a2 * a2);
} else {
tmp = ((a1 * a1) + (a2 * a2)) / Math.sqrt(2.0);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if math.cos(th) <= 0.65: tmp = math.cos(th) * (a2 * a2) else: tmp = ((a1 * a1) + (a2 * a2)) / math.sqrt(2.0) return tmp
function code(a1, a2, th) tmp = 0.0 if (cos(th) <= 0.65) tmp = Float64(cos(th) * Float64(a2 * a2)); else tmp = Float64(Float64(Float64(a1 * a1) + Float64(a2 * a2)) / sqrt(2.0)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (cos(th) <= 0.65) tmp = cos(th) * (a2 * a2); else tmp = ((a1 * a1) + (a2 * a2)) / sqrt(2.0); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[N[Cos[th], $MachinePrecision], 0.65], N[(N[Cos[th], $MachinePrecision] * N[(a2 * a2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos th \leq 0.65:\\
\;\;\;\;\cos th \cdot \left(a2 \cdot a2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a1 \cdot a1 + a2 \cdot a2}{\sqrt{2}}\\
\end{array}
\end{array}
if (cos.f64 th) < 0.650000000000000022Initial program 98.8%
distribute-lft-out98.8%
associate-*l/98.8%
associate-*r/98.9%
fma-def98.9%
Simplified98.9%
Taylor expanded in a1 around 0 60.9%
unpow260.9%
Simplified60.9%
Applied egg-rr35.3%
if 0.650000000000000022 < (cos.f64 th) Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
frac-2neg99.5%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 91.2%
unpow291.2%
unpow291.2%
Simplified91.2%
Final simplification68.3%
(FPCore (a1 a2 th) :precision binary64 (* (+ (* a1 a1) (* a2 a2)) (/ (cos th) (sqrt 2.0))))
double code(double a1, double a2, double th) {
return ((a1 * a1) + (a2 * a2)) * (cos(th) / sqrt(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 * a1) + (a2 * a2)) * (cos(th) / sqrt(2.0d0))
end function
public static double code(double a1, double a2, double th) {
return ((a1 * a1) + (a2 * a2)) * (Math.cos(th) / Math.sqrt(2.0));
}
def code(a1, a2, th): return ((a1 * a1) + (a2 * a2)) * (math.cos(th) / math.sqrt(2.0))
function code(a1, a2, th) return Float64(Float64(Float64(a1 * a1) + Float64(a2 * a2)) * Float64(cos(th) / sqrt(2.0))) end
function tmp = code(a1, a2, th) tmp = ((a1 * a1) + (a2 * a2)) * (cos(th) / sqrt(2.0)); end
code[a1_, a2_, th_] := N[(N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot \frac{\cos th}{\sqrt{2}}
\end{array}
Initial program 99.2%
distribute-lft-out99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (a1 a2 th) :precision binary64 (if (<= (cos th) -0.001) (* (+ (* a1 a1) (* a2 a2)) -0.5) (* a2 (/ a2 (sqrt 2.0)))))
double code(double a1, double a2, double th) {
double tmp;
if (cos(th) <= -0.001) {
tmp = ((a1 * a1) + (a2 * a2)) * -0.5;
} 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 (cos(th) <= (-0.001d0)) then
tmp = ((a1 * a1) + (a2 * a2)) * (-0.5d0)
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 (Math.cos(th) <= -0.001) {
tmp = ((a1 * a1) + (a2 * a2)) * -0.5;
} else {
tmp = a2 * (a2 / Math.sqrt(2.0));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if math.cos(th) <= -0.001: tmp = ((a1 * a1) + (a2 * a2)) * -0.5 else: tmp = a2 * (a2 / math.sqrt(2.0)) return tmp
function code(a1, a2, th) tmp = 0.0 if (cos(th) <= -0.001) tmp = Float64(Float64(Float64(a1 * a1) + Float64(a2 * a2)) * -0.5); else tmp = Float64(a2 * Float64(a2 / sqrt(2.0))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (cos(th) <= -0.001) tmp = ((a1 * a1) + (a2 * a2)) * -0.5; else tmp = a2 * (a2 / sqrt(2.0)); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[N[Cos[th], $MachinePrecision], -0.001], N[(N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision], N[(a2 * N[(a2 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos th \leq -0.001:\\
\;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \frac{a2}{\sqrt{2}}\\
\end{array}
\end{array}
if (cos.f64 th) < -1e-3Initial program 98.6%
distribute-lft-out98.6%
Simplified98.6%
Taylor expanded in th around 0 4.9%
Applied egg-rr54.5%
if -1e-3 < (cos.f64 th) 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 60.6%
unpow260.6%
associate-*r/60.5%
associate-*l*60.5%
Simplified60.5%
Taylor expanded in th around 0 52.4%
Final simplification53.1%
(FPCore (a1 a2 th) :precision binary64 (if (<= (cos th) 0.65) (* (cos th) (* a2 a2)) (* a2 (/ a2 (sqrt 2.0)))))
double code(double a1, double a2, double th) {
double tmp;
if (cos(th) <= 0.65) {
tmp = cos(th) * (a2 * a2);
} 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 (cos(th) <= 0.65d0) then
tmp = cos(th) * (a2 * a2)
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 (Math.cos(th) <= 0.65) {
tmp = Math.cos(th) * (a2 * a2);
} else {
tmp = a2 * (a2 / Math.sqrt(2.0));
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if math.cos(th) <= 0.65: tmp = math.cos(th) * (a2 * a2) else: tmp = a2 * (a2 / math.sqrt(2.0)) return tmp
function code(a1, a2, th) tmp = 0.0 if (cos(th) <= 0.65) tmp = Float64(cos(th) * Float64(a2 * a2)); else tmp = Float64(a2 * Float64(a2 / sqrt(2.0))); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (cos(th) <= 0.65) tmp = cos(th) * (a2 * a2); else tmp = a2 * (a2 / sqrt(2.0)); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[N[Cos[th], $MachinePrecision], 0.65], N[(N[Cos[th], $MachinePrecision] * N[(a2 * a2), $MachinePrecision]), $MachinePrecision], N[(a2 * N[(a2 / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos th \leq 0.65:\\
\;\;\;\;\cos th \cdot \left(a2 \cdot a2\right)\\
\mathbf{else}:\\
\;\;\;\;a2 \cdot \frac{a2}{\sqrt{2}}\\
\end{array}
\end{array}
if (cos.f64 th) < 0.650000000000000022Initial program 98.8%
distribute-lft-out98.8%
associate-*l/98.8%
associate-*r/98.9%
fma-def98.9%
Simplified98.9%
Taylor expanded in a1 around 0 60.9%
unpow260.9%
Simplified60.9%
Applied egg-rr35.3%
if 0.650000000000000022 < (cos.f64 th) Initial program 99.5%
distribute-lft-out99.5%
associate-*l/99.7%
associate-*r/99.6%
fma-def99.6%
Simplified99.6%
Taylor expanded in a1 around 0 60.4%
unpow260.4%
associate-*r/60.3%
associate-*l*60.3%
Simplified60.3%
Taylor expanded in th around 0 56.1%
Final simplification47.6%
(FPCore (a1 a2 th) :precision binary64 (if (<= (cos th) 0.65) (* (cos th) (* a2 a2)) (/ (* a2 a2) (sqrt 2.0))))
double code(double a1, double a2, double th) {
double tmp;
if (cos(th) <= 0.65) {
tmp = cos(th) * (a2 * a2);
} 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 (cos(th) <= 0.65d0) then
tmp = cos(th) * (a2 * a2)
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 (Math.cos(th) <= 0.65) {
tmp = Math.cos(th) * (a2 * a2);
} else {
tmp = (a2 * a2) / Math.sqrt(2.0);
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if math.cos(th) <= 0.65: tmp = math.cos(th) * (a2 * a2) else: tmp = (a2 * a2) / math.sqrt(2.0) return tmp
function code(a1, a2, th) tmp = 0.0 if (cos(th) <= 0.65) tmp = Float64(cos(th) * Float64(a2 * a2)); else tmp = Float64(Float64(a2 * a2) / sqrt(2.0)); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if (cos(th) <= 0.65) tmp = cos(th) * (a2 * a2); else tmp = (a2 * a2) / sqrt(2.0); end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[LessEqual[N[Cos[th], $MachinePrecision], 0.65], N[(N[Cos[th], $MachinePrecision] * N[(a2 * a2), $MachinePrecision]), $MachinePrecision], N[(N[(a2 * a2), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos th \leq 0.65:\\
\;\;\;\;\cos th \cdot \left(a2 \cdot a2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a2 \cdot a2}{\sqrt{2}}\\
\end{array}
\end{array}
if (cos.f64 th) < 0.650000000000000022Initial program 98.8%
distribute-lft-out98.8%
associate-*l/98.8%
associate-*r/98.9%
fma-def98.9%
Simplified98.9%
Taylor expanded in a1 around 0 60.9%
unpow260.9%
Simplified60.9%
Applied egg-rr35.3%
if 0.650000000000000022 < (cos.f64 th) Initial program 99.5%
distribute-lft-out99.5%
associate-*l/99.7%
associate-*r/99.6%
fma-def99.6%
Simplified99.6%
Taylor expanded in a1 around 0 60.4%
unpow260.4%
associate-*r/60.3%
associate-*l*60.3%
Simplified60.3%
Taylor expanded in th around 0 56.2%
unpow256.2%
Simplified56.2%
Final simplification47.6%
(FPCore (a1 a2 th) :precision binary64 (* a2 (* a2 (/ (cos th) (sqrt 2.0)))))
double code(double a1, double a2, double th) {
return a2 * (a2 * (cos(th) / sqrt(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 = a2 * (a2 * (cos(th) / sqrt(2.0d0)))
end function
public static double code(double a1, double a2, double th) {
return a2 * (a2 * (Math.cos(th) / Math.sqrt(2.0)));
}
def code(a1, a2, th): return a2 * (a2 * (math.cos(th) / math.sqrt(2.0)))
function code(a1, a2, th) return Float64(a2 * Float64(a2 * Float64(cos(th) / sqrt(2.0)))) end
function tmp = code(a1, a2, th) tmp = a2 * (a2 * (cos(th) / sqrt(2.0))); end
code[a1_, a2_, th_] := N[(a2 * N[(a2 * N[(N[Cos[th], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a2 \cdot \left(a2 \cdot \frac{\cos th}{\sqrt{2}}\right)
\end{array}
Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in a1 around 0 60.5%
unpow260.5%
associate-*r/60.5%
associate-*l*60.8%
Simplified60.8%
Final simplification60.8%
(FPCore (a1 a2 th) :precision binary64 (* a2 (/ a2 (/ (sqrt 2.0) (cos th)))))
double code(double a1, double a2, double th) {
return a2 * (a2 / (sqrt(2.0) / cos(th)));
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a2 * (a2 / (sqrt(2.0d0) / cos(th)))
end function
public static double code(double a1, double a2, double th) {
return a2 * (a2 / (Math.sqrt(2.0) / Math.cos(th)));
}
def code(a1, a2, th): return a2 * (a2 / (math.sqrt(2.0) / math.cos(th)))
function code(a1, a2, th) return Float64(a2 * Float64(a2 / Float64(sqrt(2.0) / cos(th)))) end
function tmp = code(a1, a2, th) tmp = a2 * (a2 / (sqrt(2.0) / cos(th))); end
code[a1_, a2_, th_] := N[(a2 * N[(a2 / N[(N[Sqrt[2.0], $MachinePrecision] / N[Cos[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a2 \cdot \frac{a2}{\frac{\sqrt{2}}{\cos th}}
\end{array}
Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in a1 around 0 60.5%
unpow260.5%
associate-*r/60.5%
associate-*l*60.8%
Simplified60.8%
clear-num60.8%
un-div-inv60.8%
Applied egg-rr60.8%
Final simplification60.8%
(FPCore (a1 a2 th) :precision binary64 (/ a2 (/ (/ (sqrt 2.0) (cos th)) a2)))
double code(double a1, double a2, double th) {
return a2 / ((sqrt(2.0) / cos(th)) / a2);
}
real(8) function code(a1, a2, th)
real(8), intent (in) :: a1
real(8), intent (in) :: a2
real(8), intent (in) :: th
code = a2 / ((sqrt(2.0d0) / cos(th)) / a2)
end function
public static double code(double a1, double a2, double th) {
return a2 / ((Math.sqrt(2.0) / Math.cos(th)) / a2);
}
def code(a1, a2, th): return a2 / ((math.sqrt(2.0) / math.cos(th)) / a2)
function code(a1, a2, th) return Float64(a2 / Float64(Float64(sqrt(2.0) / cos(th)) / a2)) end
function tmp = code(a1, a2, th) tmp = a2 / ((sqrt(2.0) / cos(th)) / a2); end
code[a1_, a2_, th_] := N[(a2 / N[(N[(N[Sqrt[2.0], $MachinePrecision] / N[Cos[th], $MachinePrecision]), $MachinePrecision] / a2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a2}{\frac{\frac{\sqrt{2}}{\cos th}}{a2}}
\end{array}
Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
fma-def99.3%
add-sqr-sqrt99.3%
*-un-lft-identity99.3%
times-frac99.3%
hypot-def99.2%
hypot-def99.2%
Applied egg-rr99.2%
Taylor expanded in a1 around 0 60.5%
associate-/l*60.6%
unpow260.6%
associate-/l*60.8%
Simplified60.8%
Final simplification60.8%
(FPCore (a1 a2 th) :precision binary64 (let* ((t_1 (+ (* a1 a1) (* a2 a2)))) (if (<= (cos th) -0.001) (* t_1 -0.5) (* t_1 0.5))))
double code(double a1, double a2, double th) {
double t_1 = (a1 * a1) + (a2 * a2);
double tmp;
if (cos(th) <= -0.001) {
tmp = t_1 * -0.5;
} else {
tmp = t_1 * 0.5;
}
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.001d0)) then
tmp = t_1 * (-0.5d0)
else
tmp = t_1 * 0.5d0
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.001) {
tmp = t_1 * -0.5;
} else {
tmp = t_1 * 0.5;
}
return tmp;
}
def code(a1, a2, th): t_1 = (a1 * a1) + (a2 * a2) tmp = 0 if math.cos(th) <= -0.001: tmp = t_1 * -0.5 else: tmp = t_1 * 0.5 return tmp
function code(a1, a2, th) t_1 = Float64(Float64(a1 * a1) + Float64(a2 * a2)) tmp = 0.0 if (cos(th) <= -0.001) tmp = Float64(t_1 * -0.5); else tmp = Float64(t_1 * 0.5); end return tmp end
function tmp_2 = code(a1, a2, th) t_1 = (a1 * a1) + (a2 * a2); tmp = 0.0; if (cos(th) <= -0.001) tmp = t_1 * -0.5; else tmp = t_1 * 0.5; 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.001], N[(t$95$1 * -0.5), $MachinePrecision], N[(t$95$1 * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a1 \cdot a1 + a2 \cdot a2\\
\mathbf{if}\;\cos th \leq -0.001:\\
\;\;\;\;t_1 \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot 0.5\\
\end{array}
\end{array}
if (cos.f64 th) < -1e-3Initial program 98.6%
distribute-lft-out98.6%
Simplified98.6%
Taylor expanded in th around 0 4.9%
Applied egg-rr54.5%
if -1e-3 < (cos.f64 th) Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 85.0%
Applied egg-rr57.1%
Final simplification56.3%
(FPCore (a1 a2 th) :precision binary64 (if (or (<= th 6e+43) (and (not (<= th 1.72e+75)) (<= th 1.5e+129))) (* a2 a2) (* (+ (* a1 a1) (* a2 a2)) -0.5)))
double code(double a1, double a2, double th) {
double tmp;
if ((th <= 6e+43) || (!(th <= 1.72e+75) && (th <= 1.5e+129))) {
tmp = a2 * a2;
} else {
tmp = ((a1 * a1) + (a2 * a2)) * -0.5;
}
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 ((th <= 6d+43) .or. (.not. (th <= 1.72d+75)) .and. (th <= 1.5d+129)) then
tmp = a2 * a2
else
tmp = ((a1 * a1) + (a2 * a2)) * (-0.5d0)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if ((th <= 6e+43) || (!(th <= 1.72e+75) && (th <= 1.5e+129))) {
tmp = a2 * a2;
} else {
tmp = ((a1 * a1) + (a2 * a2)) * -0.5;
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if (th <= 6e+43) or (not (th <= 1.72e+75) and (th <= 1.5e+129)): tmp = a2 * a2 else: tmp = ((a1 * a1) + (a2 * a2)) * -0.5 return tmp
function code(a1, a2, th) tmp = 0.0 if ((th <= 6e+43) || (!(th <= 1.72e+75) && (th <= 1.5e+129))) tmp = Float64(a2 * a2); else tmp = Float64(Float64(Float64(a1 * a1) + Float64(a2 * a2)) * -0.5); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if ((th <= 6e+43) || (~((th <= 1.72e+75)) && (th <= 1.5e+129))) tmp = a2 * a2; else tmp = ((a1 * a1) + (a2 * a2)) * -0.5; end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[Or[LessEqual[th, 6e+43], And[N[Not[LessEqual[th, 1.72e+75]], $MachinePrecision], LessEqual[th, 1.5e+129]]], N[(a2 * a2), $MachinePrecision], N[(N[(N[(a1 * a1), $MachinePrecision] + N[(a2 * a2), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 6 \cdot 10^{+43} \lor \neg \left(th \leq 1.72 \cdot 10^{+75}\right) \land th \leq 1.5 \cdot 10^{+129}:\\
\;\;\;\;a2 \cdot a2\\
\mathbf{else}:\\
\;\;\;\;\left(a1 \cdot a1 + a2 \cdot a2\right) \cdot -0.5\\
\end{array}
\end{array}
if th < 6.00000000000000033e43 or 1.72e75 < th < 1.50000000000000015e129Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in a1 around 0 62.3%
unpow262.3%
Simplified62.3%
Applied egg-rr39.0%
Taylor expanded in th around 0 30.2%
unpow230.2%
Simplified30.2%
if 6.00000000000000033e43 < th < 1.72e75 or 1.50000000000000015e129 < th Initial program 99.6%
distribute-lft-out99.6%
Simplified99.6%
Taylor expanded in th around 0 20.8%
Applied egg-rr30.3%
Final simplification30.3%
(FPCore (a1 a2 th)
:precision binary64
(let* ((t_1 (+ (* a1 a1) (* a2 a2))))
(if (<= th 6e+43)
(* a2 a2)
(if (or (<= th 1.72e+75) (not (<= th 4.3e+130)))
(* t_1 -0.5)
(* t_1 0.125)))))
double code(double a1, double a2, double th) {
double t_1 = (a1 * a1) + (a2 * a2);
double tmp;
if (th <= 6e+43) {
tmp = a2 * a2;
} else if ((th <= 1.72e+75) || !(th <= 4.3e+130)) {
tmp = t_1 * -0.5;
} else {
tmp = t_1 * 0.125;
}
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 (th <= 6d+43) then
tmp = a2 * a2
else if ((th <= 1.72d+75) .or. (.not. (th <= 4.3d+130))) then
tmp = t_1 * (-0.5d0)
else
tmp = t_1 * 0.125d0
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 (th <= 6e+43) {
tmp = a2 * a2;
} else if ((th <= 1.72e+75) || !(th <= 4.3e+130)) {
tmp = t_1 * -0.5;
} else {
tmp = t_1 * 0.125;
}
return tmp;
}
def code(a1, a2, th): t_1 = (a1 * a1) + (a2 * a2) tmp = 0 if th <= 6e+43: tmp = a2 * a2 elif (th <= 1.72e+75) or not (th <= 4.3e+130): tmp = t_1 * -0.5 else: tmp = t_1 * 0.125 return tmp
function code(a1, a2, th) t_1 = Float64(Float64(a1 * a1) + Float64(a2 * a2)) tmp = 0.0 if (th <= 6e+43) tmp = Float64(a2 * a2); elseif ((th <= 1.72e+75) || !(th <= 4.3e+130)) tmp = Float64(t_1 * -0.5); else tmp = Float64(t_1 * 0.125); end return tmp end
function tmp_2 = code(a1, a2, th) t_1 = (a1 * a1) + (a2 * a2); tmp = 0.0; if (th <= 6e+43) tmp = a2 * a2; elseif ((th <= 1.72e+75) || ~((th <= 4.3e+130))) tmp = t_1 * -0.5; else tmp = t_1 * 0.125; 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[th, 6e+43], N[(a2 * a2), $MachinePrecision], If[Or[LessEqual[th, 1.72e+75], N[Not[LessEqual[th, 4.3e+130]], $MachinePrecision]], N[(t$95$1 * -0.5), $MachinePrecision], N[(t$95$1 * 0.125), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a1 \cdot a1 + a2 \cdot a2\\
\mathbf{if}\;th \leq 6 \cdot 10^{+43}:\\
\;\;\;\;a2 \cdot a2\\
\mathbf{elif}\;th \leq 1.72 \cdot 10^{+75} \lor \neg \left(th \leq 4.3 \cdot 10^{+130}\right):\\
\;\;\;\;t_1 \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot 0.125\\
\end{array}
\end{array}
if th < 6.00000000000000033e43Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in a1 around 0 62.1%
unpow262.1%
Simplified62.1%
Applied egg-rr38.9%
Taylor expanded in th around 0 30.1%
unpow230.1%
Simplified30.1%
if 6.00000000000000033e43 < th < 1.72e75 or 4.29999999999999984e130 < th Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 21.4%
Applied egg-rr28.5%
if 1.72e75 < th < 4.29999999999999984e130Initial program 99.7%
distribute-lft-out99.7%
Simplified99.7%
Taylor expanded in th around 0 40.8%
Applied egg-rr40.8%
Final simplification30.2%
(FPCore (a1 a2 th)
:precision binary64
(let* ((t_1 (+ (* a1 a1) (* a2 a2))))
(if (<= th 6e+43)
(* a2 a2)
(if (or (<= th 1.72e+75) (not (<= th 1.5e+129)))
(* t_1 -0.5)
(* t_1 0.25)))))
double code(double a1, double a2, double th) {
double t_1 = (a1 * a1) + (a2 * a2);
double tmp;
if (th <= 6e+43) {
tmp = a2 * a2;
} else if ((th <= 1.72e+75) || !(th <= 1.5e+129)) {
tmp = t_1 * -0.5;
} else {
tmp = t_1 * 0.25;
}
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 (th <= 6d+43) then
tmp = a2 * a2
else if ((th <= 1.72d+75) .or. (.not. (th <= 1.5d+129))) then
tmp = t_1 * (-0.5d0)
else
tmp = t_1 * 0.25d0
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 (th <= 6e+43) {
tmp = a2 * a2;
} else if ((th <= 1.72e+75) || !(th <= 1.5e+129)) {
tmp = t_1 * -0.5;
} else {
tmp = t_1 * 0.25;
}
return tmp;
}
def code(a1, a2, th): t_1 = (a1 * a1) + (a2 * a2) tmp = 0 if th <= 6e+43: tmp = a2 * a2 elif (th <= 1.72e+75) or not (th <= 1.5e+129): tmp = t_1 * -0.5 else: tmp = t_1 * 0.25 return tmp
function code(a1, a2, th) t_1 = Float64(Float64(a1 * a1) + Float64(a2 * a2)) tmp = 0.0 if (th <= 6e+43) tmp = Float64(a2 * a2); elseif ((th <= 1.72e+75) || !(th <= 1.5e+129)) tmp = Float64(t_1 * -0.5); else tmp = Float64(t_1 * 0.25); end return tmp end
function tmp_2 = code(a1, a2, th) t_1 = (a1 * a1) + (a2 * a2); tmp = 0.0; if (th <= 6e+43) tmp = a2 * a2; elseif ((th <= 1.72e+75) || ~((th <= 1.5e+129))) tmp = t_1 * -0.5; else tmp = t_1 * 0.25; 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[th, 6e+43], N[(a2 * a2), $MachinePrecision], If[Or[LessEqual[th, 1.72e+75], N[Not[LessEqual[th, 1.5e+129]], $MachinePrecision]], N[(t$95$1 * -0.5), $MachinePrecision], N[(t$95$1 * 0.25), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a1 \cdot a1 + a2 \cdot a2\\
\mathbf{if}\;th \leq 6 \cdot 10^{+43}:\\
\;\;\;\;a2 \cdot a2\\
\mathbf{elif}\;th \leq 1.72 \cdot 10^{+75} \lor \neg \left(th \leq 1.5 \cdot 10^{+129}\right):\\
\;\;\;\;t_1 \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot 0.25\\
\end{array}
\end{array}
if th < 6.00000000000000033e43Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in a1 around 0 62.1%
unpow262.1%
Simplified62.1%
Applied egg-rr38.9%
Taylor expanded in th around 0 30.1%
unpow230.1%
Simplified30.1%
if 6.00000000000000033e43 < th < 1.72e75 or 1.50000000000000015e129 < th Initial program 99.6%
distribute-lft-out99.6%
Simplified99.6%
Taylor expanded in th around 0 20.8%
Applied egg-rr30.3%
if 1.72e75 < th < 1.50000000000000015e129Initial program 99.7%
distribute-lft-out99.7%
Simplified99.7%
Taylor expanded in th around 0 45.3%
Applied egg-rr45.3%
Final simplification30.6%
(FPCore (a1 a2 th) :precision binary64 (if (or (<= th 6e+43) (and (not (<= th 1.72e+75)) (<= th 4.3e+130))) (* a2 a2) (* (* a2 a2) -0.25)))
double code(double a1, double a2, double th) {
double tmp;
if ((th <= 6e+43) || (!(th <= 1.72e+75) && (th <= 4.3e+130))) {
tmp = a2 * a2;
} else {
tmp = (a2 * a2) * -0.25;
}
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 ((th <= 6d+43) .or. (.not. (th <= 1.72d+75)) .and. (th <= 4.3d+130)) then
tmp = a2 * a2
else
tmp = (a2 * a2) * (-0.25d0)
end if
code = tmp
end function
public static double code(double a1, double a2, double th) {
double tmp;
if ((th <= 6e+43) || (!(th <= 1.72e+75) && (th <= 4.3e+130))) {
tmp = a2 * a2;
} else {
tmp = (a2 * a2) * -0.25;
}
return tmp;
}
def code(a1, a2, th): tmp = 0 if (th <= 6e+43) or (not (th <= 1.72e+75) and (th <= 4.3e+130)): tmp = a2 * a2 else: tmp = (a2 * a2) * -0.25 return tmp
function code(a1, a2, th) tmp = 0.0 if ((th <= 6e+43) || (!(th <= 1.72e+75) && (th <= 4.3e+130))) tmp = Float64(a2 * a2); else tmp = Float64(Float64(a2 * a2) * -0.25); end return tmp end
function tmp_2 = code(a1, a2, th) tmp = 0.0; if ((th <= 6e+43) || (~((th <= 1.72e+75)) && (th <= 4.3e+130))) tmp = a2 * a2; else tmp = (a2 * a2) * -0.25; end tmp_2 = tmp; end
code[a1_, a2_, th_] := If[Or[LessEqual[th, 6e+43], And[N[Not[LessEqual[th, 1.72e+75]], $MachinePrecision], LessEqual[th, 4.3e+130]]], N[(a2 * a2), $MachinePrecision], N[(N[(a2 * a2), $MachinePrecision] * -0.25), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 6 \cdot 10^{+43} \lor \neg \left(th \leq 1.72 \cdot 10^{+75}\right) \land th \leq 4.3 \cdot 10^{+130}:\\
\;\;\;\;a2 \cdot a2\\
\mathbf{else}:\\
\;\;\;\;\left(a2 \cdot a2\right) \cdot -0.25\\
\end{array}
\end{array}
if th < 6.00000000000000033e43 or 1.72e75 < th < 4.29999999999999984e130Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in a1 around 0 62.5%
unpow262.5%
Simplified62.5%
Applied egg-rr39.3%
Taylor expanded in th around 0 30.1%
unpow230.1%
Simplified30.1%
if 6.00000000000000033e43 < th < 1.72e75 or 4.29999999999999984e130 < th Initial program 99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in th around 0 21.4%
Applied egg-rr27.6%
Taylor expanded in a1 around 0 14.0%
unpow214.0%
Simplified14.0%
Final simplification27.7%
(FPCore (a1 a2 th) :precision binary64 (* a2 a2))
double code(double a1, double a2, double th) {
return 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 = a2 * a2
end function
public static double code(double a1, double a2, double th) {
return a2 * a2;
}
def code(a1, a2, th): return a2 * a2
function code(a1, a2, th) return Float64(a2 * a2) end
function tmp = code(a1, a2, th) tmp = a2 * a2; end
code[a1_, a2_, th_] := N[(a2 * a2), $MachinePrecision]
\begin{array}{l}
\\
a2 \cdot a2
\end{array}
Initial program 99.2%
distribute-lft-out99.2%
associate-*l/99.3%
associate-*r/99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in a1 around 0 60.6%
unpow260.6%
Simplified60.6%
Applied egg-rr37.4%
Taylor expanded in th around 0 28.0%
unpow228.0%
Simplified28.0%
Final simplification28.0%
herbie shell --seed 2023229
(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))))