
(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 16 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 91.3%
remove-double-neg91.3%
sin-neg91.3%
neg-mul-191.3%
*-commutative91.3%
associate-*l*91.3%
associate-*l/90.7%
associate-/r/90.7%
associate-*l/91.3%
associate-/r/91.2%
sin-neg91.2%
neg-mul-191.2%
associate-/r*91.2%
associate-/r/91.3%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* (sin ky) (/ th (sin kx)))) (if (<= (sin kx) 2e-81) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((sin(ky) * (th / sin(kx))));
} else if (sin(kx) <= 2e-81) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
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(kx) <= (-0.05d0)) then
tmp = abs((sin(ky) * (th / sin(kx))))
else if (sin(kx) <= 2d-81) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((Math.sin(ky) * (th / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-81) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs((math.sin(ky) * (th / math.sin(kx)))) elif math.sin(kx) <= 2e-81: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(Float64(sin(ky) * Float64(th / sin(kx)))); elseif (sin(kx) <= 2e-81) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs((sin(ky) * (th / sin(kx)))); elseif (sin(kx) <= 2e-81) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-81], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|\sin ky \cdot \frac{th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-81}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.4%
associate-/r/99.3%
sin-neg99.3%
neg-mul-199.3%
associate-/r*99.3%
associate-/r/99.4%
Simplified99.5%
Taylor expanded in th around 0 53.3%
Taylor expanded in ky around 0 15.1%
add-sqr-sqrt13.8%
sqrt-unprod16.7%
pow216.7%
associate-*l*16.7%
div-inv16.7%
Applied egg-rr16.7%
unpow216.7%
rem-sqrt-square21.1%
associate-*r/21.1%
associate-/l*21.0%
associate-/r/21.0%
Simplified21.0%
if -0.050000000000000003 < (sin.f64 kx) < 1.9999999999999999e-81Initial program 79.9%
remove-double-neg79.9%
sin-neg79.9%
neg-mul-179.9%
*-commutative79.9%
associate-*l*79.9%
associate-*l/78.8%
associate-/r/78.8%
associate-*l/79.9%
associate-/r/79.8%
sin-neg79.8%
neg-mul-179.8%
associate-/r*79.8%
associate-/r/79.9%
Simplified99.9%
Taylor expanded in kx around 0 39.7%
if 1.9999999999999999e-81 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 59.7%
Final simplification39.9%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (* (sin th) (/ (sin ky) (sin kx))))) (if (<= (sin kx) -0.05) (fabs t_1) (if (<= (sin kx) 2e-81) (sin th) t_1))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / sin(kx));
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs(t_1);
} else if (sin(kx) <= 2e-81) {
tmp = sin(th);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = sin(th) * (sin(ky) / sin(kx))
if (sin(kx) <= (-0.05d0)) then
tmp = abs(t_1)
else if (sin(kx) <= 2d-81) then
tmp = sin(th)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs(t_1);
} else if (Math.sin(kx) <= 2e-81) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * (math.sin(ky) / math.sin(kx)) tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs(t_1) elif math.sin(kx) <= 2e-81: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / sin(kx))) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(t_1); elseif (sin(kx) <= 2e-81) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * (sin(ky) / sin(kx)); tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs(t_1); elseif (sin(kx) <= 2e-81) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-81], N[Sin[th], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|t_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-81}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.4%
Taylor expanded in ky around 0 14.7%
Taylor expanded in ky around inf 14.7%
*-commutative14.7%
*-rgt-identity14.7%
times-frac14.7%
/-rgt-identity14.7%
associate-/r/14.7%
Simplified14.7%
add-sqr-sqrt13.6%
sqrt-unprod22.1%
pow222.1%
div-inv22.1%
clear-num22.1%
Applied egg-rr22.1%
unpow222.1%
rem-sqrt-square32.6%
Simplified32.6%
if -0.050000000000000003 < (sin.f64 kx) < 1.9999999999999999e-81Initial program 79.9%
remove-double-neg79.9%
sin-neg79.9%
neg-mul-179.9%
*-commutative79.9%
associate-*l*79.9%
associate-*l/78.8%
associate-/r/78.8%
associate-*l/79.9%
associate-/r/79.8%
sin-neg79.8%
neg-mul-179.8%
associate-/r*79.8%
associate-/r/79.9%
Simplified99.9%
Taylor expanded in kx around 0 39.7%
if 1.9999999999999999e-81 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 59.7%
Final simplification43.3%
(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 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-udef99.7%
expm1-log1p-u99.6%
hypot-udef91.2%
unpow291.2%
unpow291.2%
+-commutative91.2%
unpow291.2%
unpow291.2%
hypot-def99.6%
Applied egg-rr99.6%
expm1-log1p-u99.7%
associate-*l/97.1%
expm1-log1p-u97.1%
expm1-udef40.3%
Applied egg-rr40.3%
expm1-def99.6%
expm1-log1p99.7%
associate-*l/97.1%
associate-*r/99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* (sin ky) (/ th (sin kx)))) (if (<= (sin kx) 1e-69) (sin th) (* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((sin(ky) * (th / sin(kx))));
} else if (sin(kx) <= 1e-69) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
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(kx) <= (-0.05d0)) then
tmp = abs((sin(ky) * (th / sin(kx))))
else if (sin(kx) <= 1d-69) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.05) {
tmp = Math.abs((Math.sin(ky) * (th / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-69) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.05: tmp = math.fabs((math.sin(ky) * (th / math.sin(kx)))) elif math.sin(kx) <= 1e-69: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.05) tmp = abs(Float64(sin(ky) * Float64(th / sin(kx)))); elseif (sin(kx) <= 1e-69) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.05) tmp = abs((sin(ky) * (th / sin(kx)))); elseif (sin(kx) <= 1e-69) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.05], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-69], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.05:\\
\;\;\;\;\left|\sin ky \cdot \frac{th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-69}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.4%
remove-double-neg99.4%
sin-neg99.4%
neg-mul-199.4%
*-commutative99.4%
associate-*l*99.4%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.4%
associate-/r/99.3%
sin-neg99.3%
neg-mul-199.3%
associate-/r*99.3%
associate-/r/99.4%
Simplified99.5%
Taylor expanded in th around 0 53.3%
Taylor expanded in ky around 0 15.1%
add-sqr-sqrt13.8%
sqrt-unprod16.7%
pow216.7%
associate-*l*16.7%
div-inv16.7%
Applied egg-rr16.7%
unpow216.7%
rem-sqrt-square21.1%
associate-*r/21.1%
associate-/l*21.0%
associate-/r/21.0%
Simplified21.0%
if -0.050000000000000003 < (sin.f64 kx) < 9.9999999999999996e-70Initial program 80.3%
remove-double-neg80.3%
sin-neg80.3%
neg-mul-180.3%
*-commutative80.3%
associate-*l*80.3%
associate-*l/79.2%
associate-/r/79.2%
associate-*l/80.3%
associate-/r/80.1%
sin-neg80.1%
neg-mul-180.1%
associate-/r*80.1%
associate-/r/80.3%
Simplified99.9%
Taylor expanded in kx around 0 39.1%
if 9.9999999999999996e-70 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 52.0%
Final simplification37.3%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.48) (/ th (/ (hypot (sin ky) (sin kx)) (sin ky))) (* (sin th) (fabs (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.48) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.48) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.48: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) else: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.48) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); else tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.48) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); else tmp = sin(th) * abs((sin(ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.48], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.48:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if th < 0.47999999999999998Initial program 91.6%
remove-double-neg91.6%
sin-neg91.6%
neg-mul-191.6%
*-commutative91.6%
associate-*l*91.6%
associate-*l/90.9%
associate-/r/90.9%
associate-*l/91.6%
associate-/r/91.5%
sin-neg91.5%
neg-mul-191.5%
associate-/r*91.5%
associate-/r/91.6%
Simplified99.7%
Taylor expanded in th around 0 62.0%
associate-*l*62.8%
sqrt-div62.8%
metadata-eval62.8%
unpow262.8%
unpow262.8%
hypot-udef68.4%
div-inv68.5%
clear-num68.4%
un-div-inv68.4%
Applied egg-rr68.4%
if 0.47999999999999998 < th Initial program 90.4%
Taylor expanded in ky around 0 21.1%
add-sqr-sqrt9.7%
sqrt-unprod18.7%
pow218.7%
Applied egg-rr18.7%
unpow218.7%
rem-sqrt-square22.9%
Simplified22.9%
Final simplification57.2%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.027) (/ th (/ (hypot (sin ky) (sin kx)) (sin ky))) (/ (* ky (sin th)) (hypot (sin kx) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.027) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else {
tmp = (ky * sin(th)) / hypot(sin(kx), sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.027) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else {
tmp = (ky * Math.sin(th)) / Math.hypot(Math.sin(kx), Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.027: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) else: tmp = (ky * math.sin(th)) / math.hypot(math.sin(kx), math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.027) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); else tmp = Float64(Float64(ky * sin(th)) / hypot(sin(kx), sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.027) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); else tmp = (ky * sin(th)) / hypot(sin(kx), sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.027], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.027:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\end{array}
\end{array}
if th < 0.0269999999999999997Initial program 91.5%
remove-double-neg91.5%
sin-neg91.5%
neg-mul-191.5%
*-commutative91.5%
associate-*l*91.5%
associate-*l/90.8%
associate-/r/90.8%
associate-*l/91.5%
associate-/r/91.4%
sin-neg91.4%
neg-mul-191.4%
associate-/r*91.4%
associate-/r/91.5%
Simplified99.7%
Taylor expanded in th around 0 62.4%
associate-*l*63.2%
sqrt-div63.2%
metadata-eval63.2%
unpow263.2%
unpow263.2%
hypot-udef68.8%
div-inv68.9%
clear-num68.8%
un-div-inv68.9%
Applied egg-rr68.9%
if 0.0269999999999999997 < th Initial program 90.7%
remove-double-neg90.7%
sin-neg90.7%
neg-mul-190.7%
*-commutative90.7%
associate-*l*90.7%
associate-*l/90.6%
associate-/r/90.6%
associate-*l/90.7%
associate-/r/90.5%
sin-neg90.5%
neg-mul-190.5%
associate-/r*90.5%
associate-/r/90.7%
Simplified99.7%
expm1-log1p-u99.6%
expm1-udef52.7%
hypot-udef48.1%
unpow248.1%
unpow248.1%
+-commutative48.1%
unpow248.1%
unpow248.1%
hypot-def52.7%
Applied egg-rr52.7%
expm1-def99.6%
expm1-log1p99.7%
associate-*l/99.5%
Simplified99.5%
Taylor expanded in ky around 0 67.1%
Final simplification68.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-88) (* (sin th) (expm1 (/ ky (sin kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-88) {
tmp = sin(th) * expm1((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) <= 2e-88) {
tmp = Math.sin(th) * Math.expm1((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-88: tmp = math.sin(th) * math.expm1((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-88) tmp = Float64(sin(th) * expm1(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-88], N[(N[Sin[th], $MachinePrecision] * N[(Exp[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-88}:\\
\;\;\;\;\sin th \cdot \mathsf{expm1}\left(\frac{ky}{\sin kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.99999999999999987e-88Initial program 88.2%
+-commutative88.2%
unpow288.2%
unpow288.2%
hypot-udef99.7%
expm1-log1p-u99.7%
hypot-udef88.0%
unpow288.0%
unpow288.0%
+-commutative88.0%
unpow288.0%
unpow288.0%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 43.6%
if 1.99999999999999987e-88 < (sin.f64 ky) Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 56.5%
Final simplification47.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.12e-69) (sin th) (* (sin th) (fabs (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.12e-69) {
tmp = sin(th);
} else {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
}
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 (kx <= 1.12d-69) then
tmp = sin(th)
else
tmp = sin(th) * abs((sin(ky) / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.12e-69) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.12e-69: tmp = math.sin(th) else: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.12e-69) tmp = sin(th); else tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.12e-69) tmp = sin(th); else tmp = sin(th) * abs((sin(ky) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.12e-69], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.12 \cdot 10^{-69}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 1.12e-69Initial program 87.6%
remove-double-neg87.6%
sin-neg87.6%
neg-mul-187.6%
*-commutative87.6%
associate-*l*87.6%
associate-*l/87.0%
associate-/r/87.0%
associate-*l/87.6%
associate-/r/87.5%
sin-neg87.5%
neg-mul-187.5%
associate-/r*87.5%
associate-/r/87.6%
Simplified99.8%
Taylor expanded in kx around 0 26.7%
if 1.12e-69 < kx Initial program 99.4%
Taylor expanded in ky around 0 33.5%
add-sqr-sqrt17.4%
sqrt-unprod27.4%
pow227.4%
Applied egg-rr27.4%
unpow227.4%
rem-sqrt-square30.7%
Simplified30.7%
Final simplification28.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.25e-133) (/ ky (/ kx (sin th))) (if (<= ky 2.05e-80) (fabs (* th (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.25e-133) {
tmp = ky / (kx / sin(th));
} else if (ky <= 2.05e-80) {
tmp = fabs((th * (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 (ky <= 1.25d-133) then
tmp = ky / (kx / sin(th))
else if (ky <= 2.05d-80) then
tmp = abs((th * (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 (ky <= 1.25e-133) {
tmp = ky / (kx / Math.sin(th));
} else if (ky <= 2.05e-80) {
tmp = Math.abs((th * (ky / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.25e-133: tmp = ky / (kx / math.sin(th)) elif ky <= 2.05e-80: tmp = math.fabs((th * (ky / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.25e-133) tmp = Float64(ky / Float64(kx / sin(th))); elseif (ky <= 2.05e-80) tmp = abs(Float64(th * Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.25e-133) tmp = ky / (kx / sin(th)); elseif (ky <= 2.05e-80) tmp = abs((th * (ky / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.25e-133], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.05e-80], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.25 \cdot 10^{-133}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{elif}\;ky \leq 2.05 \cdot 10^{-80}:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.25e-133Initial program 87.2%
Taylor expanded in ky around 0 28.0%
Taylor expanded in kx around 0 16.9%
associate-/l*18.4%
Simplified18.4%
Taylor expanded in ky around 0 16.5%
associate-/l*18.0%
Simplified18.0%
if 1.25e-133 < ky < 2.05e-80Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.2%
associate-/r/99.2%
associate-*l/99.7%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in th around 0 54.3%
Taylor expanded in ky around 0 49.0%
associate-/l*49.0%
Simplified49.0%
add-sqr-sqrt36.2%
sqrt-unprod32.2%
pow232.2%
div-inv32.2%
clear-num32.2%
Applied egg-rr32.2%
unpow232.2%
rem-sqrt-square42.9%
associate-*r/42.5%
associate-*l/42.9%
*-commutative42.9%
Simplified42.9%
if 2.05e-80 < ky Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 30.7%
Final simplification23.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7.5e-86) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.5e-86) {
tmp = sin(th) * (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 (ky <= 7.5d-86) then
tmp = sin(th) * (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 (ky <= 7.5e-86) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.5e-86: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.5e-86) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.5e-86) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.5e-86], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.5 \cdot 10^{-86}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 7.50000000000000055e-86Initial program 88.3%
Taylor expanded in ky around 0 30.2%
if 7.50000000000000055e-86 < ky Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 30.7%
Final simplification30.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8e-85) (/ (sin th) (/ (sin kx) ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8e-85) {
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 (ky <= 8d-85) 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 (ky <= 8e-85) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8e-85: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8e-85) 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 (ky <= 8e-85) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8e-85], 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}\;ky \leq 8 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 7.9999999999999998e-85Initial program 88.3%
+-commutative88.3%
unpow288.3%
unpow288.3%
hypot-udef99.7%
expm1-log1p-u99.6%
hypot-udef88.1%
unpow288.1%
unpow288.1%
+-commutative88.1%
unpow288.1%
unpow288.1%
hypot-def99.6%
Applied egg-rr99.6%
expm1-log1p-u99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.6%
hypot-udef88.3%
unpow288.3%
unpow288.3%
+-commutative88.3%
unpow288.3%
unpow288.3%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 30.1%
if 7.9999999999999998e-85 < ky Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 30.7%
Final simplification30.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7.5e-106) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.5e-106) {
tmp = ky / (kx / 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 <= 7.5d-106) then
tmp = ky / (kx / 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 <= 7.5e-106) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.5e-106: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.5e-106) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.5e-106) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.5e-106], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.5 \cdot 10^{-106}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 7.5000000000000002e-106Initial program 87.8%
Taylor expanded in ky around 0 30.5%
Taylor expanded in kx around 0 18.4%
associate-/l*19.9%
Simplified19.9%
Taylor expanded in ky around 0 18.0%
associate-/l*19.4%
Simplified19.4%
if 7.5000000000000002e-106 < ky Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in kx around 0 31.8%
Final simplification23.1%
(FPCore (kx ky th) :precision binary64 (if (<= th 2.05e-188) (/ ky (/ kx th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 2.05e-188) {
tmp = ky / (kx / 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 (th <= 2.05d-188) then
tmp = ky / (kx / th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 2.05e-188) {
tmp = ky / (kx / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 2.05e-188: tmp = ky / (kx / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 2.05e-188) tmp = Float64(ky / Float64(kx / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 2.05e-188) tmp = ky / (kx / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 2.05e-188], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 2.05 \cdot 10^{-188}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 2.04999999999999991e-188Initial program 91.9%
remove-double-neg91.9%
sin-neg91.9%
neg-mul-191.9%
*-commutative91.9%
associate-*l*91.9%
associate-*l/91.2%
associate-/r/91.2%
associate-*l/91.9%
associate-/r/91.8%
sin-neg91.8%
neg-mul-191.8%
associate-/r*91.8%
associate-/r/91.9%
Simplified99.7%
Taylor expanded in th around 0 55.9%
Taylor expanded in ky around 0 16.2%
associate-/l*17.7%
Simplified17.7%
Taylor expanded in kx around 0 15.5%
associate-/l*17.2%
Simplified17.2%
if 2.04999999999999991e-188 < th Initial program 90.5%
remove-double-neg90.5%
sin-neg90.5%
neg-mul-190.5%
*-commutative90.5%
associate-*l*90.5%
associate-*l/90.2%
associate-/r/90.2%
associate-*l/90.5%
associate-/r/90.3%
sin-neg90.3%
neg-mul-190.3%
associate-/r*90.3%
associate-/r/90.5%
Simplified99.7%
Taylor expanded in kx around 0 18.9%
Final simplification17.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.4e-80) (* th (/ ky kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.4e-80) {
tmp = th * (ky / kx);
} 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.4d-80) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.4e-80) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.4e-80: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.4e-80) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.4e-80) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.4e-80], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.4 \cdot 10^{-80}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 2.3999999999999999e-80Initial program 88.3%
remove-double-neg88.3%
sin-neg88.3%
neg-mul-188.3%
*-commutative88.3%
associate-*l*88.3%
associate-*l/87.5%
associate-/r/87.5%
associate-*l/88.3%
associate-/r/88.2%
sin-neg88.2%
neg-mul-188.2%
associate-/r*88.2%
associate-/r/88.3%
Simplified99.7%
Taylor expanded in th around 0 46.6%
Taylor expanded in ky around 0 18.5%
associate-/l*19.9%
Simplified19.9%
Taylor expanded in kx around 0 15.0%
associate-/l*16.4%
Simplified16.4%
associate-/r/16.5%
Applied egg-rr16.5%
if 2.3999999999999999e-80 < ky Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.4%
sin-neg99.4%
neg-mul-199.4%
associate-/r*99.4%
associate-/r/99.6%
Simplified99.7%
Taylor expanded in th around 0 50.6%
Taylor expanded in kx around 0 15.3%
Final simplification16.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 91.3%
remove-double-neg91.3%
sin-neg91.3%
neg-mul-191.3%
*-commutative91.3%
associate-*l*91.3%
associate-*l/90.7%
associate-/r/90.7%
associate-*l/91.3%
associate-/r/91.2%
sin-neg91.2%
neg-mul-191.2%
associate-/r*91.2%
associate-/r/91.3%
Simplified99.7%
Taylor expanded in th around 0 47.6%
Taylor expanded in kx around 0 12.6%
Final simplification12.6%
herbie shell --seed 2024024
(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)))