
(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 18 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 95.0%
+-commutative95.0%
unpow295.0%
unpow295.0%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (/ ky (sin kx)) (sin th))))
(if (<= (sin ky) -0.02)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 5e-87)
t_1
(if (<= (sin ky) 2e-47)
(/ (* ky (sin th)) (sin ky))
(if (<= (sin ky) 2e-24) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = (ky / sin(kx)) * sin(th);
double tmp;
if (sin(ky) <= -0.02) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 5e-87) {
tmp = t_1;
} else if (sin(ky) <= 2e-47) {
tmp = (ky * sin(th)) / sin(ky);
} else if (sin(ky) <= 2e-24) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (ky / sin(kx)) * sin(th)
if (sin(ky) <= (-0.02d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 5d-87) then
tmp = t_1
else if (sin(ky) <= 2d-47) then
tmp = (ky * sin(th)) / sin(ky)
else if (sin(ky) <= 2d-24) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = (ky / Math.sin(kx)) * Math.sin(th);
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 5e-87) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-47) {
tmp = (ky * Math.sin(th)) / Math.sin(ky);
} else if (Math.sin(ky) <= 2e-24) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = (ky / math.sin(kx)) * math.sin(th) tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 5e-87: tmp = t_1 elif math.sin(ky) <= 2e-47: tmp = (ky * math.sin(th)) / math.sin(ky) elif math.sin(ky) <= 2e-24: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(Float64(ky / sin(kx)) * sin(th)) tmp = 0.0 if (sin(ky) <= -0.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 5e-87) tmp = t_1; elseif (sin(ky) <= 2e-47) tmp = Float64(Float64(ky * sin(th)) / sin(ky)); elseif (sin(ky) <= 2e-24) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = (ky / sin(kx)) * sin(th); tmp = 0.0; if (sin(ky) <= -0.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 5e-87) tmp = t_1; elseif (sin(ky) <= 2e-47) tmp = (ky * sin(th)) / sin(ky); elseif (sin(ky) <= 2e-24) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-87], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-47], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-24], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ky}{\sin kx} \cdot \sin th\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-47}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin ky}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.5%
log1p-expm1-u2.5%
Applied egg-rr2.5%
Taylor expanded in ky around 0 2.5%
log1p-expm1-u2.5%
add-sqr-sqrt1.2%
sqrt-unprod30.0%
pow230.0%
Applied egg-rr30.0%
if -0.0200000000000000004 < (sin.f64 ky) < 5.00000000000000042e-87 or 1.9999999999999999e-47 < (sin.f64 ky) < 1.99999999999999985e-24Initial program 89.6%
+-commutative89.6%
unpow289.6%
unpow289.6%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 58.3%
if 5.00000000000000042e-87 < (sin.f64 ky) < 1.9999999999999999e-47Initial program 99.1%
unpow299.1%
sqr-neg99.1%
sin-neg99.1%
sin-neg99.1%
unpow299.1%
associate-*l/98.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
associate-*r/98.5%
hypot-undefine98.5%
unpow298.5%
unpow298.5%
+-commutative98.5%
clear-num98.5%
+-commutative98.5%
unpow298.5%
unpow298.5%
hypot-undefine98.5%
Applied egg-rr98.5%
Taylor expanded in ky around 0 98.5%
Taylor expanded in kx around 0 53.0%
if 1.99999999999999985e-24 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 70.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 0.001)
(* ky (/ (sin th) (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 0.001) {
tmp = ky * (sin(th) / hypot(sin(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.02) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 0.001) {
tmp = ky * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 0.001: tmp = ky * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 0.001) tmp = Float64(ky * Float64(sin(th) / hypot(sin(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.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 0.001) tmp = ky * (sin(th) / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.001], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 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.02:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 0.001:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.5%
log1p-expm1-u2.5%
Applied egg-rr2.5%
Taylor expanded in ky around 0 2.5%
log1p-expm1-u2.5%
add-sqr-sqrt1.2%
sqrt-unprod30.0%
pow230.0%
Applied egg-rr30.0%
if -0.0200000000000000004 < (sin.f64 ky) < 1e-3Initial program 90.3%
unpow290.3%
sqr-neg90.3%
sin-neg90.3%
sin-neg90.3%
unpow290.3%
associate-*l/87.3%
associate-/l*90.2%
unpow290.2%
Simplified99.6%
associate-*r/93.8%
hypot-undefine87.3%
unpow287.3%
unpow287.3%
+-commutative87.3%
clear-num87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-undefine93.6%
Applied egg-rr93.6%
Taylor expanded in ky around 0 92.5%
clear-num92.7%
associate-/l*98.5%
Applied egg-rr98.5%
if 1e-3 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 70.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (/ (sin th) (hypot (sin ky) kx)))
(if (<= (sin ky) 0.001)
(* ky (/ (sin th) (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
} else if (sin(ky) <= 0.001) {
tmp = ky * (sin(th) / hypot(sin(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.02) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
} else if (Math.sin(ky) <= 0.001) {
tmp = ky * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) elif math.sin(ky) <= 0.001: tmp = ky * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); elseif (sin(ky) <= 0.001) tmp = Float64(ky * Float64(sin(th) / hypot(sin(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.02) tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); elseif (sin(ky) <= 0.001) tmp = ky * (sin(th) / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.001], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 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.02:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin ky \leq 0.001:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 58.1%
if -0.0200000000000000004 < (sin.f64 ky) < 1e-3Initial program 90.3%
unpow290.3%
sqr-neg90.3%
sin-neg90.3%
sin-neg90.3%
unpow290.3%
associate-*l/87.3%
associate-/l*90.2%
unpow290.2%
Simplified99.6%
associate-*r/93.8%
hypot-undefine87.3%
unpow287.3%
unpow287.3%
+-commutative87.3%
clear-num87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-undefine93.6%
Applied egg-rr93.6%
Taylor expanded in ky around 0 92.5%
clear-num92.7%
associate-/l*98.5%
Applied egg-rr98.5%
if 1e-3 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 70.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (/ (sin th) (hypot (sin ky) kx)))
(if (<= (sin ky) 0.001)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
} else if (sin(ky) <= 0.001) {
tmp = sin(th) * (ky / hypot(sin(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.02) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
} else if (Math.sin(ky) <= 0.001) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) elif math.sin(ky) <= 0.001: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); elseif (sin(ky) <= 0.001) tmp = Float64(sin(th) * Float64(ky / hypot(sin(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.02) tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); elseif (sin(ky) <= 0.001) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.001], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 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.02:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;\sin ky \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 58.1%
if -0.0200000000000000004 < (sin.f64 ky) < 1e-3Initial program 90.3%
unpow290.3%
sqr-neg90.3%
sin-neg90.3%
sin-neg90.3%
unpow290.3%
associate-*l/87.3%
associate-/l*90.2%
unpow290.2%
Simplified99.6%
associate-*r/93.8%
hypot-undefine87.3%
unpow287.3%
unpow287.3%
+-commutative87.3%
clear-num87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-undefine93.6%
Applied egg-rr93.6%
Taylor expanded in ky around 0 92.5%
clear-num92.7%
*-commutative92.7%
associate-/l*98.6%
Applied egg-rr98.6%
if 1e-3 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 70.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (/ (sin ky) (hypot (sin ky) kx)) (sin th))
(if (<= (sin ky) 0.001)
(* (sin th) (/ ky (hypot (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = (sin(ky) / hypot(sin(ky), kx)) * sin(th);
} else if (sin(ky) <= 0.001) {
tmp = sin(th) * (ky / hypot(sin(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.02) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), kx)) * Math.sin(th);
} else if (Math.sin(ky) <= 0.001) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = (math.sin(ky) / math.hypot(math.sin(ky), kx)) * math.sin(th) elif math.sin(ky) <= 0.001: tmp = math.sin(th) * (ky / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), kx)) * sin(th)); elseif (sin(ky) <= 0.001) tmp = Float64(sin(th) * Float64(ky / hypot(sin(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.02) tmp = (sin(ky) / hypot(sin(ky), kx)) * sin(th); elseif (sin(ky) <= 0.001) tmp = sin(th) * (ky / hypot(sin(ky), sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.001], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 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.02:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)} \cdot \sin th\\
\mathbf{elif}\;\sin ky \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in kx around 0 58.2%
if -0.0200000000000000004 < (sin.f64 ky) < 1e-3Initial program 90.3%
unpow290.3%
sqr-neg90.3%
sin-neg90.3%
sin-neg90.3%
unpow290.3%
associate-*l/87.3%
associate-/l*90.2%
unpow290.2%
Simplified99.6%
associate-*r/93.8%
hypot-undefine87.3%
unpow287.3%
unpow287.3%
+-commutative87.3%
clear-num87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-undefine93.6%
Applied egg-rr93.6%
Taylor expanded in ky around 0 92.5%
clear-num92.7%
*-commutative92.7%
associate-/l*98.6%
Applied egg-rr98.6%
if 1e-3 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 70.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(/ 1.0 (/ (hypot (sin ky) (sin kx)) (* th (sin ky))))
(if (<= (sin kx) 1e-7)
(* (/ (sin ky) (hypot (sin ky) kx)) (sin th))
(* (/ (sin ky) (sin kx)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (th * sin(ky)));
} else if (sin(kx) <= 1e-7) {
tmp = (sin(ky) / hypot(sin(ky), kx)) * sin(th);
} else {
tmp = (sin(ky) / sin(kx)) * sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.005) {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (th * Math.sin(ky)));
} else if (Math.sin(kx) <= 1e-7) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), kx)) * Math.sin(th);
} else {
tmp = (Math.sin(ky) / Math.sin(kx)) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (th * math.sin(ky))) elif math.sin(kx) <= 1e-7: tmp = (math.sin(ky) / math.hypot(math.sin(ky), kx)) * math.sin(th) else: tmp = (math.sin(ky) / math.sin(kx)) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(th * sin(ky)))); elseif (sin(kx) <= 1e-7) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), kx)) * sin(th)); else tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (th * sin(ky))); elseif (sin(kx) <= 1e-7) tmp = (sin(ky) / hypot(sin(ky), kx)) * sin(th); else tmp = (sin(ky) / sin(kx)) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-7], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{th \cdot \sin ky}}\\
\mathbf{elif}\;\sin kx \leq 10^{-7}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
associate-*r/99.5%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
clear-num99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 59.2%
if -0.0050000000000000001 < (sin.f64 kx) < 9.9999999999999995e-8Initial program 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-undefine99.9%
Applied egg-rr99.9%
Taylor expanded in kx around 0 99.6%
if 9.9999999999999995e-8 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 67.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 5e-87)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 2e-47)
(/ (* ky (sin th)) (sin ky))
(if (<= (sin ky) 2e-24) (* (/ ky (sin kx)) (sin th)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-87) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 2e-47) {
tmp = (ky * sin(th)) / sin(ky);
} else if (sin(ky) <= 2e-24) {
tmp = (ky / sin(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 (sin(ky) <= 5d-87) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(ky) <= 2d-47) then
tmp = (ky * sin(th)) / sin(ky)
else if (sin(ky) <= 2d-24) then
tmp = (ky / sin(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 (Math.sin(ky) <= 5e-87) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 2e-47) {
tmp = (ky * Math.sin(th)) / Math.sin(ky);
} else if (Math.sin(ky) <= 2e-24) {
tmp = (ky / Math.sin(kx)) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-87: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 2e-47: tmp = (ky * math.sin(th)) / math.sin(ky) elif math.sin(ky) <= 2e-24: tmp = (ky / math.sin(kx)) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-87) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 2e-47) tmp = Float64(Float64(ky * sin(th)) / sin(ky)); elseif (sin(ky) <= 2e-24) tmp = Float64(Float64(ky / sin(kx)) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 5e-87) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 2e-47) tmp = (ky * sin(th)) / sin(ky); elseif (sin(ky) <= 2e-24) tmp = (ky / sin(kx)) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-87], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-47], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-24], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-87}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-47}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin ky}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 5.00000000000000042e-87Initial program 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/91.7%
associate-/l*93.5%
unpow293.5%
Simplified99.6%
Taylor expanded in ky around 0 37.3%
if 5.00000000000000042e-87 < (sin.f64 ky) < 1.9999999999999999e-47Initial program 99.1%
unpow299.1%
sqr-neg99.1%
sin-neg99.1%
sin-neg99.1%
unpow299.1%
associate-*l/98.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
associate-*r/98.5%
hypot-undefine98.5%
unpow298.5%
unpow298.5%
+-commutative98.5%
clear-num98.5%
+-commutative98.5%
unpow298.5%
unpow298.5%
hypot-undefine98.5%
Applied egg-rr98.5%
Taylor expanded in ky around 0 98.5%
Taylor expanded in kx around 0 53.0%
if 1.9999999999999999e-47 < (sin.f64 ky) < 1.99999999999999985e-24Initial program 100.0%
+-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in ky around 0 34.4%
if 1.99999999999999985e-24 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 70.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 5e-87)
(* (/ (sin ky) (sin kx)) (sin th))
(if (<= (sin ky) 2e-47)
(/ (* ky (sin th)) (sin ky))
(if (<= (sin ky) 2e-24) (* (/ ky (sin kx)) (sin th)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-87) {
tmp = (sin(ky) / sin(kx)) * sin(th);
} else if (sin(ky) <= 2e-47) {
tmp = (ky * sin(th)) / sin(ky);
} else if (sin(ky) <= 2e-24) {
tmp = (ky / sin(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 (sin(ky) <= 5d-87) then
tmp = (sin(ky) / sin(kx)) * sin(th)
else if (sin(ky) <= 2d-47) then
tmp = (ky * sin(th)) / sin(ky)
else if (sin(ky) <= 2d-24) then
tmp = (ky / sin(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 (Math.sin(ky) <= 5e-87) {
tmp = (Math.sin(ky) / Math.sin(kx)) * Math.sin(th);
} else if (Math.sin(ky) <= 2e-47) {
tmp = (ky * Math.sin(th)) / Math.sin(ky);
} else if (Math.sin(ky) <= 2e-24) {
tmp = (ky / Math.sin(kx)) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-87: tmp = (math.sin(ky) / math.sin(kx)) * math.sin(th) elif math.sin(ky) <= 2e-47: tmp = (ky * math.sin(th)) / math.sin(ky) elif math.sin(ky) <= 2e-24: tmp = (ky / math.sin(kx)) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-87) tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th)); elseif (sin(ky) <= 2e-47) tmp = Float64(Float64(ky * sin(th)) / sin(ky)); elseif (sin(ky) <= 2e-24) tmp = Float64(Float64(ky / sin(kx)) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 5e-87) tmp = (sin(ky) / sin(kx)) * sin(th); elseif (sin(ky) <= 2e-47) tmp = (ky * sin(th)) / sin(ky); elseif (sin(ky) <= 2e-24) tmp = (ky / sin(kx)) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-87], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-47], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-24], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-87}:\\
\;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-47}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin ky}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{ky}{\sin kx} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 5.00000000000000042e-87Initial program 93.6%
Taylor expanded in ky around 0 37.4%
if 5.00000000000000042e-87 < (sin.f64 ky) < 1.9999999999999999e-47Initial program 99.1%
unpow299.1%
sqr-neg99.1%
sin-neg99.1%
sin-neg99.1%
unpow299.1%
associate-*l/98.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
associate-*r/98.5%
hypot-undefine98.5%
unpow298.5%
unpow298.5%
+-commutative98.5%
clear-num98.5%
+-commutative98.5%
unpow298.5%
unpow298.5%
hypot-undefine98.5%
Applied egg-rr98.5%
Taylor expanded in ky around 0 98.5%
Taylor expanded in kx around 0 53.0%
if 1.9999999999999999e-47 < (sin.f64 ky) < 1.99999999999999985e-24Initial program 100.0%
+-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in ky around 0 34.4%
if 1.99999999999999985e-24 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 70.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 4e-119)
(* (/ (sin ky) (sin kx)) (sin th))
(if (<= (sin ky) 2e-46)
(/ 1.0 (/ (hypot (sin ky) (sin kx)) (* ky th)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 4e-119) {
tmp = (sin(ky) / sin(kx)) * sin(th);
} else if (sin(ky) <= 2e-46) {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * th));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 4e-119) {
tmp = (Math.sin(ky) / Math.sin(kx)) * Math.sin(th);
} else if (Math.sin(ky) <= 2e-46) {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (ky * th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 4e-119: tmp = (math.sin(ky) / math.sin(kx)) * math.sin(th) elif math.sin(ky) <= 2e-46: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (ky * th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 4e-119) tmp = Float64(Float64(sin(ky) / sin(kx)) * sin(th)); elseif (sin(ky) <= 2e-46) tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(ky * th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 4e-119) tmp = (sin(ky) / sin(kx)) * sin(th); elseif (sin(ky) <= 2e-46) tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-119], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-46], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(ky * th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4 \cdot 10^{-119}:\\
\;\;\;\;\frac{\sin ky}{\sin kx} \cdot \sin th\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-46}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky \cdot th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.00000000000000005e-119Initial program 93.4%
Taylor expanded in ky around 0 37.4%
if 4.00000000000000005e-119 < (sin.f64 ky) < 2.00000000000000005e-46Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.3%
associate-/l*99.9%
unpow299.9%
Simplified99.9%
associate-*r/99.3%
hypot-undefine99.3%
unpow299.3%
unpow299.3%
+-commutative99.3%
clear-num99.0%
+-commutative99.0%
unpow299.0%
unpow299.0%
hypot-undefine99.0%
Applied egg-rr99.0%
Taylor expanded in ky around 0 99.0%
Taylor expanded in th around 0 75.4%
if 2.00000000000000005e-46 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 68.0%
(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 95.0%
unpow295.0%
sqr-neg95.0%
sin-neg95.0%
sin-neg95.0%
unpow295.0%
associate-*l/93.5%
associate-/l*95.0%
unpow295.0%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-88) (* (sin ky) (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-88) {
tmp = sin(ky) * (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-88) then
tmp = sin(ky) * (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-88) {
tmp = Math.sin(ky) * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-88: tmp = math.sin(ky) * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-88) tmp = Float64(sin(ky) * Float64(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-88) tmp = sin(ky) * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-88], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-88}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999934e-89Initial program 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/91.6%
associate-/l*93.5%
unpow293.5%
Simplified99.6%
Taylor expanded in ky around 0 37.0%
Taylor expanded in th around 0 21.7%
if 9.99999999999999934e-89 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 65.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (/ ky (sin kx)) (sin th))))
(if (<= ky 1.65e-86)
t_1
(if (<= ky 9.2e-47) (sin th) (if (<= ky 1.9e-24) t_1 (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = (ky / sin(kx)) * sin(th);
double tmp;
if (ky <= 1.65e-86) {
tmp = t_1;
} else if (ky <= 9.2e-47) {
tmp = sin(th);
} else if (ky <= 1.9e-24) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (ky / sin(kx)) * sin(th)
if (ky <= 1.65d-86) then
tmp = t_1
else if (ky <= 9.2d-47) then
tmp = sin(th)
else if (ky <= 1.9d-24) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = (ky / Math.sin(kx)) * Math.sin(th);
double tmp;
if (ky <= 1.65e-86) {
tmp = t_1;
} else if (ky <= 9.2e-47) {
tmp = Math.sin(th);
} else if (ky <= 1.9e-24) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = (ky / math.sin(kx)) * math.sin(th) tmp = 0 if ky <= 1.65e-86: tmp = t_1 elif ky <= 9.2e-47: tmp = math.sin(th) elif ky <= 1.9e-24: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(Float64(ky / sin(kx)) * sin(th)) tmp = 0.0 if (ky <= 1.65e-86) tmp = t_1; elseif (ky <= 9.2e-47) tmp = sin(th); elseif (ky <= 1.9e-24) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = (ky / sin(kx)) * sin(th); tmp = 0.0; if (ky <= 1.65e-86) tmp = t_1; elseif (ky <= 9.2e-47) tmp = sin(th); elseif (ky <= 1.9e-24) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ky, 1.65e-86], t$95$1, If[LessEqual[ky, 9.2e-47], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.9e-24], t$95$1, N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ky}{\sin kx} \cdot \sin th\\
\mathbf{if}\;ky \leq 1.65 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ky \leq 9.2 \cdot 10^{-47}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.9 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.64999999999999993e-86 or 9.19999999999999928e-47 < ky < 1.90000000000000013e-24Initial program 93.4%
+-commutative93.4%
unpow293.4%
unpow293.4%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 37.0%
if 1.64999999999999993e-86 < ky < 9.19999999999999928e-47 or 1.90000000000000013e-24 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 36.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (/ ky (sin kx)) (sin th))))
(if (<= ky 1.12e-86)
t_1
(if (<= ky 1.5e-46)
(/ (* ky (sin th)) (sin ky))
(if (<= ky 1.9e-24) t_1 (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = (ky / sin(kx)) * sin(th);
double tmp;
if (ky <= 1.12e-86) {
tmp = t_1;
} else if (ky <= 1.5e-46) {
tmp = (ky * sin(th)) / sin(ky);
} else if (ky <= 1.9e-24) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (ky / sin(kx)) * sin(th)
if (ky <= 1.12d-86) then
tmp = t_1
else if (ky <= 1.5d-46) then
tmp = (ky * sin(th)) / sin(ky)
else if (ky <= 1.9d-24) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = (ky / Math.sin(kx)) * Math.sin(th);
double tmp;
if (ky <= 1.12e-86) {
tmp = t_1;
} else if (ky <= 1.5e-46) {
tmp = (ky * Math.sin(th)) / Math.sin(ky);
} else if (ky <= 1.9e-24) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = (ky / math.sin(kx)) * math.sin(th) tmp = 0 if ky <= 1.12e-86: tmp = t_1 elif ky <= 1.5e-46: tmp = (ky * math.sin(th)) / math.sin(ky) elif ky <= 1.9e-24: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(Float64(ky / sin(kx)) * sin(th)) tmp = 0.0 if (ky <= 1.12e-86) tmp = t_1; elseif (ky <= 1.5e-46) tmp = Float64(Float64(ky * sin(th)) / sin(ky)); elseif (ky <= 1.9e-24) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = (ky / sin(kx)) * sin(th); tmp = 0.0; if (ky <= 1.12e-86) tmp = t_1; elseif (ky <= 1.5e-46) tmp = (ky * sin(th)) / sin(ky); elseif (ky <= 1.9e-24) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[ky, 1.12e-86], t$95$1, If[LessEqual[ky, 1.5e-46], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 1.9e-24], t$95$1, N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ky}{\sin kx} \cdot \sin th\\
\mathbf{if}\;ky \leq 1.12 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;ky \leq 1.5 \cdot 10^{-46}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin ky}\\
\mathbf{elif}\;ky \leq 1.9 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.12e-86 or 1.49999999999999994e-46 < ky < 1.90000000000000013e-24Initial program 93.4%
+-commutative93.4%
unpow293.4%
unpow293.4%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 37.0%
if 1.12e-86 < ky < 1.49999999999999994e-46Initial program 99.1%
unpow299.1%
sqr-neg99.1%
sin-neg99.1%
sin-neg99.1%
unpow299.1%
associate-*l/98.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
associate-*r/98.5%
hypot-undefine98.5%
unpow298.5%
unpow298.5%
+-commutative98.5%
clear-num98.5%
+-commutative98.5%
unpow298.5%
unpow298.5%
hypot-undefine98.5%
Applied egg-rr98.5%
Taylor expanded in ky around 0 98.5%
Taylor expanded in kx around 0 53.0%
if 1.90000000000000013e-24 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 35.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.9e-160) (log (+ 1.0 th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.9e-160) {
tmp = log((1.0 + 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 <= 3.9d-160) then
tmp = log((1.0d0 + 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 <= 3.9e-160) {
tmp = Math.log((1.0 + th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.9e-160: tmp = math.log((1.0 + th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.9e-160) tmp = log(Float64(1.0 + th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.9e-160) tmp = log((1.0 + th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.9e-160], N[Log[N[(1.0 + th), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.9 \cdot 10^{-160}:\\
\;\;\;\;\log \left(1 + th\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.89999999999999989e-160Initial program 92.9%
unpow292.9%
sqr-neg92.9%
sin-neg92.9%
sin-neg92.9%
unpow292.9%
associate-*l/91.2%
associate-/l*92.8%
unpow292.8%
Simplified99.6%
Taylor expanded in kx around 0 13.3%
log1p-expm1-u13.3%
Applied egg-rr13.3%
Taylor expanded in th around 0 9.8%
log1p-undefine15.5%
Applied egg-rr15.5%
if 3.89999999999999989e-160 < ky Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/98.4%
associate-/l*99.4%
unpow299.4%
Simplified99.7%
Taylor expanded in kx around 0 36.5%
(FPCore (kx ky th) :precision binary64 (log1p th))
double code(double kx, double ky, double th) {
return log1p(th);
}
public static double code(double kx, double ky, double th) {
return Math.log1p(th);
}
def code(kx, ky, th): return math.log1p(th)
function code(kx, ky, th) return log1p(th) end
code[kx_, ky_, th_] := N[Log[1 + th], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{log1p}\left(th\right)
\end{array}
Initial program 95.0%
unpow295.0%
sqr-neg95.0%
sin-neg95.0%
sin-neg95.0%
unpow295.0%
associate-*l/93.5%
associate-/l*95.0%
unpow295.0%
Simplified99.6%
Taylor expanded in kx around 0 20.8%
log1p-expm1-u20.8%
Applied egg-rr20.8%
Taylor expanded in th around 0 14.3%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return 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(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 95.0%
unpow295.0%
sqr-neg95.0%
sin-neg95.0%
sin-neg95.0%
unpow295.0%
associate-*l/93.5%
associate-/l*95.0%
unpow295.0%
Simplified99.6%
Taylor expanded in kx around 0 20.8%
(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 95.0%
unpow295.0%
sqr-neg95.0%
sin-neg95.0%
sin-neg95.0%
unpow295.0%
associate-*l/93.5%
associate-/l*95.0%
unpow295.0%
Simplified99.6%
Taylor expanded in kx around 0 20.8%
Taylor expanded in th around 0 14.3%
herbie shell --seed 2024050 -o generate:simplify
(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)))