
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-72)
(- (sin th))
(if (<= (sin ky) 5e-284)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) 5e-77) (* (sin th) (fabs (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-72) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-284) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 5e-77) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-72)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-284) then
tmp = ky * (sin(th) / sin(kx))
else if (sin(ky) <= 5d-77) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-72) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-284) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 5e-77) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-72: tmp = -math.sin(th) elif math.sin(ky) <= 5e-284: tmp = ky * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 5e-77: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-72) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-284) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 5e-77) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-72) tmp = -sin(th); elseif (sin(ky) <= 5e-284) tmp = ky * (sin(th) / sin(kx)); elseif (sin(ky) <= 5e-77) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-72], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-284], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-77], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-72}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-284}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-77}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.9999999999999997e-73Initial program 99.8%
associate-*l/96.8%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 22.1%
Taylor expanded in ky around 0 39.2%
Taylor expanded in ky around -inf 62.0%
neg-mul-162.0%
Simplified62.0%
if -9.9999999999999997e-73 < (sin.f64 ky) < 4.99999999999999973e-284Initial program 82.3%
associate-*l/75.5%
associate-*r/82.4%
+-commutative82.4%
unpow282.4%
unpow282.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around 0 56.6%
if 4.99999999999999973e-284 < (sin.f64 ky) < 4.99999999999999963e-77Initial program 89.6%
+-commutative89.6%
unpow289.6%
unpow289.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 54.2%
add-sqr-sqrt49.7%
sqrt-unprod47.3%
pow247.3%
Applied egg-rr47.3%
unpow247.3%
rem-sqrt-square86.3%
Simplified86.3%
Taylor expanded in ky around 0 86.3%
if 4.99999999999999963e-77 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.6%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 61.6%
Final simplification64.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot ky (sin kx))))
(if (<= (sin th) -0.002)
(/ ky (/ t_1 (sin th)))
(if (<= (sin th) 4e-25)
(* (sin ky) (/ th (hypot (sin kx) (sin ky))))
(* ky (/ (sin th) t_1))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(ky, sin(kx));
double tmp;
if (sin(th) <= -0.002) {
tmp = ky / (t_1 / sin(th));
} else if (sin(th) <= 4e-25) {
tmp = sin(ky) * (th / hypot(sin(kx), sin(ky)));
} else {
tmp = ky * (sin(th) / t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(ky, Math.sin(kx));
double tmp;
if (Math.sin(th) <= -0.002) {
tmp = ky / (t_1 / Math.sin(th));
} else if (Math.sin(th) <= 4e-25) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = ky * (Math.sin(th) / t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(ky, math.sin(kx)) tmp = 0 if math.sin(th) <= -0.002: tmp = ky / (t_1 / math.sin(th)) elif math.sin(th) <= 4e-25: tmp = math.sin(ky) * (th / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = ky * (math.sin(th) / t_1) return tmp
function code(kx, ky, th) t_1 = hypot(ky, sin(kx)) tmp = 0.0 if (sin(th) <= -0.002) tmp = Float64(ky / Float64(t_1 / sin(th))); elseif (sin(th) <= 4e-25) tmp = Float64(sin(ky) * Float64(th / hypot(sin(kx), sin(ky)))); else tmp = Float64(ky * Float64(sin(th) / t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(ky, sin(kx)); tmp = 0.0; if (sin(th) <= -0.002) tmp = ky / (t_1 / sin(th)); elseif (sin(th) <= 4e-25) tmp = sin(ky) * (th / hypot(sin(kx), sin(ky))); else tmp = ky * (sin(th) / t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.002], N[(ky / N[(t$95$1 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 4e-25], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(ky, \sin kx\right)\\
\mathbf{if}\;\sin th \leq -0.002:\\
\;\;\;\;\frac{ky}{\frac{t_1}{\sin th}}\\
\mathbf{elif}\;\sin th \leq 4 \cdot 10^{-25}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{t_1}\\
\end{array}
\end{array}
if (sin.f64 th) < -2e-3Initial program 93.6%
associate-*l/93.3%
associate-*r/93.5%
+-commutative93.5%
unpow293.5%
unpow293.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 49.8%
Taylor expanded in ky around 0 61.9%
clear-num61.7%
un-div-inv61.9%
Applied egg-rr61.9%
if -2e-3 < (sin.f64 th) < 4.00000000000000015e-25Initial program 94.3%
associate-/r/94.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 94.1%
associate-*r/94.3%
unpow294.3%
unpow294.3%
hypot-def99.7%
*-rgt-identity99.7%
hypot-def94.3%
unpow294.3%
unpow294.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def99.7%
Simplified99.7%
div-inv99.6%
clear-num99.8%
Applied egg-rr99.8%
if 4.00000000000000015e-25 < (sin.f64 th) Initial program 95.8%
associate-*l/95.5%
associate-*r/95.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 54.4%
Taylor expanded in ky around 0 67.3%
Final simplification81.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot ky (sin kx))))
(if (<= (sin th) -0.002)
(/ ky (/ t_1 (sin th)))
(if (<= (sin th) 4e-25)
(* th (/ (sin ky) (hypot (sin kx) (sin ky))))
(* ky (/ (sin th) t_1))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(ky, sin(kx));
double tmp;
if (sin(th) <= -0.002) {
tmp = ky / (t_1 / sin(th));
} else if (sin(th) <= 4e-25) {
tmp = th * (sin(ky) / hypot(sin(kx), sin(ky)));
} else {
tmp = ky * (sin(th) / t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(ky, Math.sin(kx));
double tmp;
if (Math.sin(th) <= -0.002) {
tmp = ky / (t_1 / Math.sin(th));
} else if (Math.sin(th) <= 4e-25) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = ky * (Math.sin(th) / t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(ky, math.sin(kx)) tmp = 0 if math.sin(th) <= -0.002: tmp = ky / (t_1 / math.sin(th)) elif math.sin(th) <= 4e-25: tmp = th * (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = ky * (math.sin(th) / t_1) return tmp
function code(kx, ky, th) t_1 = hypot(ky, sin(kx)) tmp = 0.0 if (sin(th) <= -0.002) tmp = Float64(ky / Float64(t_1 / sin(th))); elseif (sin(th) <= 4e-25) tmp = Float64(th * Float64(sin(ky) / hypot(sin(kx), sin(ky)))); else tmp = Float64(ky * Float64(sin(th) / t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(ky, sin(kx)); tmp = 0.0; if (sin(th) <= -0.002) tmp = ky / (t_1 / sin(th)); elseif (sin(th) <= 4e-25) tmp = th * (sin(ky) / hypot(sin(kx), sin(ky))); else tmp = ky * (sin(th) / t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.002], N[(ky / N[(t$95$1 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 4e-25], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(ky, \sin kx\right)\\
\mathbf{if}\;\sin th \leq -0.002:\\
\;\;\;\;\frac{ky}{\frac{t_1}{\sin th}}\\
\mathbf{elif}\;\sin th \leq 4 \cdot 10^{-25}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{t_1}\\
\end{array}
\end{array}
if (sin.f64 th) < -2e-3Initial program 93.6%
associate-*l/93.3%
associate-*r/93.5%
+-commutative93.5%
unpow293.5%
unpow293.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 49.8%
Taylor expanded in ky around 0 61.9%
clear-num61.7%
un-div-inv61.9%
Applied egg-rr61.9%
if -2e-3 < (sin.f64 th) < 4.00000000000000015e-25Initial program 94.3%
associate-/r/94.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 94.1%
associate-*r/94.3%
unpow294.3%
unpow294.3%
hypot-def99.7%
*-rgt-identity99.7%
hypot-def94.3%
unpow294.3%
unpow294.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def99.7%
Simplified99.7%
associate-/r/99.8%
Applied egg-rr99.8%
if 4.00000000000000015e-25 < (sin.f64 th) Initial program 95.8%
associate-*l/95.5%
associate-*r/95.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 54.4%
Taylor expanded in ky around 0 67.3%
Final simplification81.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (- (sin th)) (if (<= (sin ky) 2e-18) (* ky (/ (sin th) (hypot ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = -sin(th);
} else if (sin(ky) <= 2e-18) {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 2e-18) {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = -math.sin(th) elif math.sin(ky) <= 2e-18: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(-sin(th)); elseif (sin(ky) <= 2e-18) tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = -sin(th); elseif (sin(ky) <= 2e-18) tmp = ky * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-18], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-18}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.8%
associate-*l/99.4%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 6.3%
Taylor expanded in ky around 0 26.9%
Taylor expanded in ky around -inf 60.6%
neg-mul-160.6%
Simplified60.6%
if -0.0100000000000000002 < (sin.f64 ky) < 2.0000000000000001e-18Initial program 88.8%
associate-*l/83.3%
associate-*r/88.8%
+-commutative88.8%
unpow288.8%
unpow288.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around 0 99.7%
if 2.0000000000000001e-18 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 62.2%
Final simplification79.7%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.5%
associate-*l/91.8%
associate-*r/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-72) (- (sin th)) (if (<= (sin ky) 5e-132) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-72) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-132) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-72)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-132) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-72) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-132) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-72: tmp = -math.sin(th) elif math.sin(ky) <= 5e-132: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-72) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-132) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-72) tmp = -sin(th); elseif (sin(ky) <= 5e-132) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-72], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-132], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-72}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-132}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.9999999999999997e-73Initial program 99.8%
associate-*l/96.8%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 22.1%
Taylor expanded in ky around 0 39.2%
Taylor expanded in ky around -inf 62.0%
neg-mul-162.0%
Simplified62.0%
if -9.9999999999999997e-73 < (sin.f64 ky) < 4.9999999999999999e-132Initial program 84.0%
associate-*l/78.5%
associate-*r/84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around 0 58.3%
if 4.9999999999999999e-132 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 59.9%
Final simplification60.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-72) (- (sin th)) (if (<= (sin ky) 5e-132) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-72) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-132) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-72)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-132) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-72) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-132) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-72: tmp = -math.sin(th) elif math.sin(ky) <= 5e-132: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-72) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-132) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-72) tmp = -sin(th); elseif (sin(ky) <= 5e-132) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-72], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-132], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-72}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-132}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.9999999999999997e-73Initial program 99.8%
associate-*l/96.8%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 22.1%
Taylor expanded in ky around 0 39.2%
Taylor expanded in ky around -inf 62.0%
neg-mul-162.0%
Simplified62.0%
if -9.9999999999999997e-73 < (sin.f64 ky) < 4.9999999999999999e-132Initial program 84.0%
associate-*l/78.5%
associate-*r/84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 55.8%
associate-/l*58.2%
Simplified58.2%
if 4.9999999999999999e-132 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 59.9%
Final simplification59.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-106) (- (sin th)) (if (<= (sin ky) 5e-132) (/ th (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-106) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-132) {
tmp = th / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-5d-106)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-132) then
tmp = th / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-106) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-132) {
tmp = th / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-106: tmp = -math.sin(th) elif math.sin(ky) <= 5e-132: tmp = th / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-106) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-132) tmp = Float64(th / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-106) tmp = -sin(th); elseif (sin(ky) <= 5e-132) tmp = th / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-106], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-132], N[(th / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-106}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-132}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -4.99999999999999983e-106Initial program 99.8%
associate-*l/94.7%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 30.0%
Taylor expanded in ky around 0 45.4%
Taylor expanded in ky around -inf 60.0%
neg-mul-160.0%
Simplified60.0%
if -4.99999999999999983e-106 < (sin.f64 ky) < 4.9999999999999999e-132Initial program 82.4%
associate-/r/82.5%
+-commutative82.5%
unpow282.5%
unpow282.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 40.4%
associate-*r/40.4%
unpow240.4%
unpow240.4%
hypot-def49.2%
*-rgt-identity49.2%
hypot-def40.4%
unpow240.4%
unpow240.4%
+-commutative40.4%
unpow240.4%
unpow240.4%
hypot-def49.2%
Simplified49.2%
Taylor expanded in ky around 0 31.1%
*-commutative31.1%
associate-/l*33.8%
Simplified33.8%
if 4.9999999999999999e-132 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 59.9%
Final simplification52.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-118) (- (sin th)) (if (<= (sin ky) 5e-132) (/ (sin th) (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-118) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-132) {
tmp = sin(th) / (kx / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-5d-118)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-132) then
tmp = sin(th) / (kx / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-118) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-132) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-118: tmp = -math.sin(th) elif math.sin(ky) <= 5e-132: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-118) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-132) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-118) tmp = -sin(th); elseif (sin(ky) <= 5e-132) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-118], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-132], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-118}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-132}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.00000000000000015e-118Initial program 99.8%
associate-*l/94.8%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 30.9%
Taylor expanded in ky around 0 46.1%
Taylor expanded in ky around -inf 59.3%
neg-mul-159.3%
Simplified59.3%
if -5.00000000000000015e-118 < (sin.f64 ky) < 4.9999999999999999e-132Initial program 82.2%
+-commutative82.2%
unpow282.2%
unpow282.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 60.1%
Taylor expanded in kx around 0 43.0%
Taylor expanded in ky around 0 43.0%
associate-/l*45.6%
Simplified45.6%
if 4.9999999999999999e-132 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 59.9%
Final simplification55.5%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -5e-311) (and (not (<= ky 9.6e+129)) (<= ky 1e+210))) (- (sin th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -5e-311) || (!(ky <= 9.6e+129) && (ky <= 1e+210))) {
tmp = -sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-5d-311)) .or. (.not. (ky <= 9.6d+129)) .and. (ky <= 1d+210)) then
tmp = -sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -5e-311) || (!(ky <= 9.6e+129) && (ky <= 1e+210))) {
tmp = -Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -5e-311) or (not (ky <= 9.6e+129) and (ky <= 1e+210)): tmp = -math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -5e-311) || (!(ky <= 9.6e+129) && (ky <= 1e+210))) tmp = Float64(-sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -5e-311) || (~((ky <= 9.6e+129)) && (ky <= 1e+210))) tmp = -sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -5e-311], And[N[Not[LessEqual[ky, 9.6e+129]], $MachinePrecision], LessEqual[ky, 1e+210]]], (-N[Sin[th], $MachinePrecision]), N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5 \cdot 10^{-311} \lor \neg \left(ky \leq 9.6 \cdot 10^{+129}\right) \land ky \leq 10^{+210}:\\
\;\;\;\;-\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -5.00000000000023e-311 or 9.5999999999999995e129 < ky < 9.99999999999999927e209Initial program 94.0%
associate-*l/90.1%
associate-*r/94.0%
+-commutative94.0%
unpow294.0%
unpow294.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 45.4%
Taylor expanded in ky around 0 54.5%
Taylor expanded in ky around -inf 32.3%
neg-mul-132.3%
Simplified32.3%
if -5.00000000000023e-311 < ky < 9.5999999999999995e129 or 9.99999999999999927e209 < ky Initial program 95.3%
associate-*l/94.1%
associate-*r/95.2%
+-commutative95.2%
unpow295.2%
unpow295.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 36.3%
Final simplification34.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -155.0) (sin th) (if (<= ky -2.06e-255) (- th) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -155.0) {
tmp = sin(th);
} else if (ky <= -2.06e-255) {
tmp = -th;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-155.0d0)) then
tmp = sin(th)
else if (ky <= (-2.06d-255)) then
tmp = -th
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -155.0) {
tmp = Math.sin(th);
} else if (ky <= -2.06e-255) {
tmp = -th;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -155.0: tmp = math.sin(th) elif ky <= -2.06e-255: tmp = -th else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -155.0) tmp = sin(th); elseif (ky <= -2.06e-255) tmp = Float64(-th); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -155.0) tmp = sin(th); elseif (ky <= -2.06e-255) tmp = -th; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -155.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -2.06e-255], (-th), N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -155:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -2.06 \cdot 10^{-255}:\\
\;\;\;\;-th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -155 or -2.05999999999999994e-255 < ky Initial program 95.6%
associate-*l/94.8%
associate-*r/95.4%
+-commutative95.4%
unpow295.4%
unpow295.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 32.5%
if -155 < ky < -2.05999999999999994e-255Initial program 90.7%
associate-*l/80.4%
associate-*r/90.8%
+-commutative90.8%
unpow290.8%
unpow290.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 98.4%
Taylor expanded in ky around 0 98.4%
Taylor expanded in ky around -inf 34.5%
associate-*r/34.5%
neg-mul-134.5%
Simplified34.5%
Taylor expanded in th around 0 25.9%
mul-1-neg25.9%
Simplified25.9%
Final simplification31.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -2.1e-233) (- th) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2.1e-233) {
tmp = -th;
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-2.1d-233)) then
tmp = -th
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2.1e-233) {
tmp = -th;
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -2.1e-233: tmp = -th else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -2.1e-233) tmp = Float64(-th); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -2.1e-233) tmp = -th; else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -2.1e-233], (-th), th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -2.1 \cdot 10^{-233}:\\
\;\;\;\;-th\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -2.0999999999999999e-233Initial program 95.5%
associate-*l/90.7%
associate-*r/95.5%
+-commutative95.5%
unpow295.5%
unpow295.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 43.7%
Taylor expanded in ky around 0 54.0%
Taylor expanded in ky around -inf 29.3%
associate-*r/29.3%
neg-mul-129.3%
Simplified29.3%
Taylor expanded in th around 0 21.5%
mul-1-neg21.5%
Simplified21.5%
if -2.0999999999999999e-233 < ky Initial program 93.7%
associate-/r/93.6%
+-commutative93.6%
unpow293.6%
unpow293.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 42.5%
associate-*r/42.6%
unpow242.6%
unpow242.6%
hypot-def44.8%
*-rgt-identity44.8%
hypot-def42.6%
unpow242.6%
unpow242.6%
+-commutative42.6%
unpow242.6%
unpow242.6%
hypot-def44.8%
Simplified44.8%
Taylor expanded in kx around 0 17.3%
Final simplification19.2%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.5%
associate-/r/94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 47.1%
associate-*r/47.2%
unpow247.2%
unpow247.2%
hypot-def49.8%
*-rgt-identity49.8%
hypot-def47.2%
unpow247.2%
unpow247.2%
+-commutative47.2%
unpow247.2%
unpow247.2%
hypot-def49.8%
Simplified49.8%
Taylor expanded in kx around 0 15.0%
Final simplification15.0%
herbie shell --seed 2023192
(FPCore (kx ky th)
:name "Toniolo and Linder, Equation (3b), real"
:precision binary64
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))