
(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 93.6%
+-commutative93.6%
unpow293.6%
unpow293.6%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.04)
(* (sin ky) (fabs (/ th (sin ky))))
(if (or (<= (sin ky) 5e-68)
(and (not (<= (sin ky) 5e-47)) (<= (sin ky) 4e-21)))
(* (sin th) (fabs (/ ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.04) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if ((sin(ky) <= 5e-68) || (!(sin(ky) <= 5e-47) && (sin(ky) <= 4e-21))) {
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) <= (-0.04d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if ((sin(ky) <= 5d-68) .or. (.not. (sin(ky) <= 5d-47)) .and. (sin(ky) <= 4d-21)) 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) <= -0.04) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if ((Math.sin(ky) <= 5e-68) || (!(Math.sin(ky) <= 5e-47) && (Math.sin(ky) <= 4e-21))) {
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) <= -0.04: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif (math.sin(ky) <= 5e-68) or (not (math.sin(ky) <= 5e-47) and (math.sin(ky) <= 4e-21)): 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) <= -0.04) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif ((sin(ky) <= 5e-68) || (!(sin(ky) <= 5e-47) && (sin(ky) <= 4e-21))) 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) <= -0.04) tmp = sin(ky) * abs((th / sin(ky))); elseif ((sin(ky) <= 5e-68) || (~((sin(ky) <= 5e-47)) && (sin(ky) <= 4e-21))) 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], -0.04], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-68], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 5e-47]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 4e-21]]], 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 -0.04:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-68} \lor \neg \left(\sin ky \leq 5 \cdot 10^{-47}\right) \land \sin ky \leq 4 \cdot 10^{-21}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0400000000000000008Initial 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.7%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.3%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.0%
Simplified35.0%
Taylor expanded in th around 0 16.7%
if -0.0400000000000000008 < (sin.f64 ky) < 4.99999999999999971e-68 or 5.00000000000000011e-47 < (sin.f64 ky) < 3.99999999999999963e-21Initial program 86.8%
Taylor expanded in ky around 0 53.4%
add-sqr-sqrt24.0%
sqrt-unprod42.0%
pow242.0%
Applied egg-rr42.0%
unpow242.0%
rem-sqrt-square52.3%
Simplified52.3%
if 4.99999999999999971e-68 < (sin.f64 ky) < 5.00000000000000011e-47 or 3.99999999999999963e-21 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 67.6%
Final simplification47.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(fabs (sin th))
(if (or (<= (sin ky) 5e-68)
(and (not (<= (sin ky) 5e-47)) (<= (sin ky) 4e-21)))
(* (sin th) (fabs (/ ky (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if ((sin(ky) <= 5e-68) || (!(sin(ky) <= 5e-47) && (sin(ky) <= 4e-21))) {
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) <= (-0.005d0)) then
tmp = abs(sin(th))
else if ((sin(ky) <= 5d-68) .or. (.not. (sin(ky) <= 5d-47)) .and. (sin(ky) <= 4d-21)) 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) <= -0.005) {
tmp = Math.abs(Math.sin(th));
} else if ((Math.sin(ky) <= 5e-68) || (!(Math.sin(ky) <= 5e-47) && (Math.sin(ky) <= 4e-21))) {
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) <= -0.005: tmp = math.fabs(math.sin(th)) elif (math.sin(ky) <= 5e-68) or (not (math.sin(ky) <= 5e-47) and (math.sin(ky) <= 4e-21)): 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) <= -0.005) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-68) || (!(sin(ky) <= 5e-47) && (sin(ky) <= 4e-21))) 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) <= -0.005) tmp = abs(sin(th)); elseif ((sin(ky) <= 5e-68) || (~((sin(ky) <= 5e-47)) && (sin(ky) <= 4e-21))) 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], -0.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-68], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 5e-47]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 4e-21]]], 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 -0.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-68} \lor \neg \left(\sin ky \leq 5 \cdot 10^{-47}\right) \land \sin ky \leq 4 \cdot 10^{-21}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.7%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.6%
sqrt-unprod24.8%
pow224.8%
Applied egg-rr24.8%
unpow224.8%
rem-sqrt-square32.1%
associate-*r/32.1%
associate-*l/32.2%
*-inverses32.2%
*-lft-identity32.2%
Simplified32.2%
if -0.0050000000000000001 < (sin.f64 ky) < 4.99999999999999971e-68 or 5.00000000000000011e-47 < (sin.f64 ky) < 3.99999999999999963e-21Initial program 86.4%
Taylor expanded in ky around 0 54.6%
add-sqr-sqrt24.6%
sqrt-unprod43.1%
pow243.1%
Applied egg-rr43.1%
unpow243.1%
rem-sqrt-square53.6%
Simplified53.6%
if 4.99999999999999971e-68 < (sin.f64 ky) < 5.00000000000000011e-47 or 3.99999999999999963e-21 < (sin.f64 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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 67.6%
Final simplification51.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (fabs (/ ky (sin kx))))) (t_2 (/ (sin th) (sin ky))))
(if (<= (sin ky) -0.005)
(* (sin ky) (fabs t_2))
(if (<= (sin ky) 5e-68)
t_1
(if (<= (sin ky) 5e-47)
(* (sin ky) t_2)
(if (<= (sin ky) 4e-21) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * fabs((ky / sin(kx)));
double t_2 = sin(th) / sin(ky);
double tmp;
if (sin(ky) <= -0.005) {
tmp = sin(ky) * fabs(t_2);
} else if (sin(ky) <= 5e-68) {
tmp = t_1;
} else if (sin(ky) <= 5e-47) {
tmp = sin(ky) * t_2;
} else if (sin(ky) <= 4e-21) {
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) :: t_2
real(8) :: tmp
t_1 = sin(th) * abs((ky / sin(kx)))
t_2 = sin(th) / sin(ky)
if (sin(ky) <= (-0.005d0)) then
tmp = sin(ky) * abs(t_2)
else if (sin(ky) <= 5d-68) then
tmp = t_1
else if (sin(ky) <= 5d-47) then
tmp = sin(ky) * t_2
else if (sin(ky) <= 4d-21) 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 = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
double t_2 = Math.sin(th) / Math.sin(ky);
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = Math.sin(ky) * Math.abs(t_2);
} else if (Math.sin(ky) <= 5e-68) {
tmp = t_1;
} else if (Math.sin(ky) <= 5e-47) {
tmp = Math.sin(ky) * t_2;
} else if (Math.sin(ky) <= 4e-21) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * math.fabs((ky / math.sin(kx))) t_2 = math.sin(th) / math.sin(ky) tmp = 0 if math.sin(ky) <= -0.005: tmp = math.sin(ky) * math.fabs(t_2) elif math.sin(ky) <= 5e-68: tmp = t_1 elif math.sin(ky) <= 5e-47: tmp = math.sin(ky) * t_2 elif math.sin(ky) <= 4e-21: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * abs(Float64(ky / sin(kx)))) t_2 = Float64(sin(th) / sin(ky)) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(sin(ky) * abs(t_2)); elseif (sin(ky) <= 5e-68) tmp = t_1; elseif (sin(ky) <= 5e-47) tmp = Float64(sin(ky) * t_2); elseif (sin(ky) <= 4e-21) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * abs((ky / sin(kx))); t_2 = sin(th) / sin(ky); tmp = 0.0; if (sin(ky) <= -0.005) tmp = sin(ky) * abs(t_2); elseif (sin(ky) <= 5e-68) tmp = t_1; elseif (sin(ky) <= 5e-47) tmp = sin(ky) * t_2; elseif (sin(ky) <= 4e-21) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[(N[Sin[ky], $MachinePrecision] * N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-68], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-47], N[(N[Sin[ky], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-21], t$95$1, N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
t_2 := \frac{\sin th}{\sin ky}\\
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\sin ky \cdot \left|t\_2\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-47}:\\
\;\;\;\;\sin ky \cdot t\_2\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.7%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.3%
sqrt-unprod28.2%
pow228.2%
Applied egg-rr28.2%
unpow228.2%
rem-sqrt-square35.2%
Simplified35.2%
if -0.0050000000000000001 < (sin.f64 ky) < 4.99999999999999971e-68 or 5.00000000000000011e-47 < (sin.f64 ky) < 3.99999999999999963e-21Initial program 86.4%
Taylor expanded in ky around 0 54.6%
add-sqr-sqrt24.6%
sqrt-unprod43.1%
pow243.1%
Applied egg-rr43.1%
unpow243.1%
rem-sqrt-square53.6%
Simplified53.6%
if 4.99999999999999971e-68 < (sin.f64 ky) < 5.00000000000000011e-47Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/99.7%
associate-/l*100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in kx around 0 81.5%
if 3.99999999999999963e-21 < (sin.f64 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.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 66.6%
Final simplification52.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (fabs (/ ky (sin kx))))))
(if (<= (sin ky) -0.04)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 5e-68)
t_1
(if (<= (sin ky) 5e-47)
(* (sin ky) (/ (sin th) (sin ky)))
(if (<= (sin ky) 4e-21) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * fabs((ky / sin(kx)));
double tmp;
if (sin(ky) <= -0.04) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 5e-68) {
tmp = t_1;
} else if (sin(ky) <= 5e-47) {
tmp = sin(ky) * (sin(th) / sin(ky));
} else if (sin(ky) <= 4e-21) {
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 = sin(th) * abs((ky / sin(kx)))
if (sin(ky) <= (-0.04d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 5d-68) then
tmp = t_1
else if (sin(ky) <= 5d-47) then
tmp = sin(ky) * (sin(th) / sin(ky))
else if (sin(ky) <= 4d-21) 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 = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
double tmp;
if (Math.sin(ky) <= -0.04) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 5e-68) {
tmp = t_1;
} else if (Math.sin(ky) <= 5e-47) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(ky));
} else if (Math.sin(ky) <= 4e-21) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * math.fabs((ky / math.sin(kx))) tmp = 0 if math.sin(ky) <= -0.04: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 5e-68: tmp = t_1 elif math.sin(ky) <= 5e-47: tmp = math.sin(ky) * (math.sin(th) / math.sin(ky)) elif math.sin(ky) <= 4e-21: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * abs(Float64(ky / sin(kx)))) tmp = 0.0 if (sin(ky) <= -0.04) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 5e-68) tmp = t_1; elseif (sin(ky) <= 5e-47) tmp = Float64(sin(ky) * Float64(sin(th) / sin(ky))); elseif (sin(ky) <= 4e-21) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * abs((ky / sin(kx))); tmp = 0.0; if (sin(ky) <= -0.04) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 5e-68) tmp = t_1; elseif (sin(ky) <= 5e-47) tmp = sin(ky) * (sin(th) / sin(ky)); elseif (sin(ky) <= 4e-21) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.04], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-68], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-47], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-21], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{if}\;\sin ky \leq -0.04:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-47}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin ky}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0400000000000000008Initial 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.7%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.3%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.0%
Simplified35.0%
Taylor expanded in th around 0 16.7%
if -0.0400000000000000008 < (sin.f64 ky) < 4.99999999999999971e-68 or 5.00000000000000011e-47 < (sin.f64 ky) < 3.99999999999999963e-21Initial program 86.8%
Taylor expanded in ky around 0 53.4%
add-sqr-sqrt24.0%
sqrt-unprod42.0%
pow242.0%
Applied egg-rr42.0%
unpow242.0%
rem-sqrt-square52.3%
Simplified52.3%
if 4.99999999999999971e-68 < (sin.f64 ky) < 5.00000000000000011e-47Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/99.7%
associate-/l*100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in kx around 0 81.5%
if 3.99999999999999963e-21 < (sin.f64 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.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 66.6%
Final simplification47.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.04)
(/ (* (sin ky) th) t_1)
(if (<= (sin ky) 1e-211)
(/ (sin th) (fabs (/ (sin kx) (sin ky))))
(if (<= (sin ky) 6e-6) (/ (* ky (sin th)) t_1) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.04) {
tmp = (sin(ky) * th) / t_1;
} else if (sin(ky) <= 1e-211) {
tmp = sin(th) / fabs((sin(kx) / sin(ky)));
} else if (sin(ky) <= 6e-6) {
tmp = (ky * sin(th)) / t_1;
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.04) {
tmp = (Math.sin(ky) * th) / t_1;
} else if (Math.sin(ky) <= 1e-211) {
tmp = Math.sin(th) / Math.abs((Math.sin(kx) / Math.sin(ky)));
} else if (Math.sin(ky) <= 6e-6) {
tmp = (ky * Math.sin(th)) / t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.04: tmp = (math.sin(ky) * th) / t_1 elif math.sin(ky) <= 1e-211: tmp = math.sin(th) / math.fabs((math.sin(kx) / math.sin(ky))) elif math.sin(ky) <= 6e-6: tmp = (ky * math.sin(th)) / t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.04) tmp = Float64(Float64(sin(ky) * th) / t_1); elseif (sin(ky) <= 1e-211) tmp = Float64(sin(th) / abs(Float64(sin(kx) / sin(ky)))); elseif (sin(ky) <= 6e-6) tmp = Float64(Float64(ky * sin(th)) / t_1); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.04) tmp = (sin(ky) * th) / t_1; elseif (sin(ky) <= 1e-211) tmp = sin(th) / abs((sin(kx) / sin(ky))); elseif (sin(ky) <= 6e-6) tmp = (ky * sin(th)) / t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.04], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-211], N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 6e-6], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.04:\\
\;\;\;\;\frac{\sin ky \cdot th}{t\_1}\\
\mathbf{elif}\;\sin ky \leq 10^{-211}:\\
\;\;\;\;\frac{\sin th}{\left|\frac{\sin kx}{\sin ky}\right|}\\
\mathbf{elif}\;\sin ky \leq 6 \cdot 10^{-6}:\\
\;\;\;\;\frac{ky \cdot \sin th}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0400000000000000008Initial 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.7%
*-commutative99.7%
associate-*l/99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 49.7%
*-commutative49.7%
Simplified49.7%
if -0.0400000000000000008 < (sin.f64 ky) < 1.00000000000000009e-211Initial program 85.0%
+-commutative85.0%
unpow285.0%
unpow285.0%
hypot-undefine99.7%
Applied egg-rr99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 58.0%
add-sqr-sqrt21.6%
sqrt-unprod32.7%
pow232.7%
Applied egg-rr32.7%
unpow232.7%
rem-sqrt-square42.2%
Simplified42.2%
if 1.00000000000000009e-211 < (sin.f64 ky) < 6.0000000000000002e-6Initial program 93.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/90.7%
associate-/l*93.0%
unpow293.0%
Simplified99.6%
*-commutative99.6%
associate-*l/95.3%
Applied egg-rr95.3%
Taylor expanded in ky around 0 94.5%
if 6.0000000000000002e-6 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 66.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.04)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 1e-211)
(/ (sin th) (fabs (/ (sin kx) (sin ky))))
(if (<= (sin ky) 6e-6)
(/ (* ky (sin th)) (hypot (sin ky) (sin kx)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.04) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 1e-211) {
tmp = sin(th) / fabs((sin(kx) / sin(ky)));
} else if (sin(ky) <= 6e-6) {
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.04) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-211) {
tmp = Math.sin(th) / Math.abs((Math.sin(kx) / Math.sin(ky)));
} else if (Math.sin(ky) <= 6e-6) {
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.04: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 1e-211: tmp = math.sin(th) / math.fabs((math.sin(kx) / math.sin(ky))) elif math.sin(ky) <= 6e-6: 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.04) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 1e-211) tmp = Float64(sin(th) / abs(Float64(sin(kx) / sin(ky)))); elseif (sin(ky) <= 6e-6) tmp = Float64(Float64(ky * 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.04) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 1e-211) tmp = sin(th) / abs((sin(kx) / sin(ky))); elseif (sin(ky) <= 6e-6) 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.04], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-211], N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 6e-6], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.04:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-211}:\\
\;\;\;\;\frac{\sin th}{\left|\frac{\sin kx}{\sin ky}\right|}\\
\mathbf{elif}\;\sin ky \leq 6 \cdot 10^{-6}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0400000000000000008Initial 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.7%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.3%
sqrt-unprod27.7%
pow227.7%
Applied egg-rr27.7%
unpow227.7%
rem-sqrt-square35.0%
Simplified35.0%
if -0.0400000000000000008 < (sin.f64 ky) < 1.00000000000000009e-211Initial program 85.0%
+-commutative85.0%
unpow285.0%
unpow285.0%
hypot-undefine99.7%
Applied egg-rr99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 58.0%
add-sqr-sqrt21.6%
sqrt-unprod32.7%
pow232.7%
Applied egg-rr32.7%
unpow232.7%
rem-sqrt-square42.2%
Simplified42.2%
if 1.00000000000000009e-211 < (sin.f64 ky) < 6.0000000000000002e-6Initial program 93.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/90.7%
associate-/l*93.0%
unpow293.0%
Simplified99.6%
*-commutative99.6%
associate-*l/95.3%
Applied egg-rr95.3%
Taylor expanded in ky around 0 94.5%
if 6.0000000000000002e-6 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 66.8%
(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 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/91.8%
associate-/l*93.5%
unpow293.5%
Simplified99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (fabs (sin th)) (if (<= (sin ky) 5e-68) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-68) {
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) <= (-0.005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-68) 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) <= -0.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-68) {
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) <= -0.005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-68: 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) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-68) 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) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-68) 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], -0.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-68], 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 -0.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-68}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.7%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.6%
sqrt-unprod24.8%
pow224.8%
Applied egg-rr24.8%
unpow224.8%
rem-sqrt-square32.1%
associate-*r/32.1%
associate-*l/32.2%
*-inverses32.2%
*-lft-identity32.2%
Simplified32.2%
if -0.0050000000000000001 < (sin.f64 ky) < 4.99999999999999971e-68Initial program 86.0%
unpow286.0%
sqr-neg86.0%
sin-neg86.0%
sin-neg86.0%
unpow286.0%
associate-*l/81.9%
associate-/l*85.9%
unpow285.9%
Simplified99.7%
Taylor expanded in ky around 0 50.8%
associate-/l*54.9%
Simplified54.9%
if 4.99999999999999971e-68 < (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.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 64.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.45e-113) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.45e-113) {
tmp = sin(th) * (ky / 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 <= 2.45d-113) then
tmp = sin(th) * (ky / 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 <= 2.45e-113) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.45e-113: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.45e-113) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.45e-113) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.45e-113], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.45 \cdot 10^{-113}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.4500000000000001e-113Initial program 90.6%
Taylor expanded in ky around 0 35.6%
Taylor expanded in kx around 0 26.0%
if 2.4500000000000001e-113 < 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 42.7%
Final simplification31.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.4e-111) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.4e-111) {
tmp = ky * (sin(th) / 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 <= 2.4d-111) then
tmp = ky * (sin(th) / 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 <= 2.4e-111) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.4e-111: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.4e-111) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.4e-111) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.4e-111], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.4 \cdot 10^{-111}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.4000000000000001e-111Initial program 90.6%
unpow290.6%
sqr-neg90.6%
sin-neg90.6%
sin-neg90.6%
unpow290.6%
associate-*l/87.9%
associate-/l*90.5%
unpow290.5%
Simplified99.6%
Taylor expanded in ky around 0 32.9%
associate-/l*35.6%
Simplified35.6%
Taylor expanded in kx around 0 23.3%
associate-/l*26.0%
Simplified26.0%
if 2.4000000000000001e-111 < 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 42.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky 6.2e-148) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6.2e-148) {
tmp = 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 (ky <= 6.2d-148) then
tmp = 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 (ky <= 6.2e-148) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6.2e-148: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6.2e-148) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6.2e-148) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6.2e-148], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6.2 \cdot 10^{-148}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 6.2000000000000003e-148Initial program 90.5%
unpow290.5%
sqr-neg90.5%
sin-neg90.5%
sin-neg90.5%
unpow290.5%
associate-*l/88.3%
associate-/l*90.4%
unpow290.4%
Simplified99.6%
Taylor expanded in ky around 0 33.4%
associate-/l*35.6%
Simplified35.6%
Taylor expanded in th around 0 22.8%
associate-/l*25.0%
Simplified25.0%
if 6.2000000000000003e-148 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 43.6%
(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 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/91.8%
associate-/l*93.5%
unpow293.5%
Simplified99.7%
Taylor expanded in kx around 0 24.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 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/91.8%
associate-/l*93.5%
unpow293.5%
Simplified99.7%
Taylor expanded in kx around 0 24.8%
Taylor expanded in th around 0 12.8%
herbie shell --seed 2024101
(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)))