
(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 13 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 92.5%
remove-double-neg92.5%
sin-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-*l*92.5%
associate-*l/90.6%
associate-/r/90.6%
associate-*l/92.5%
associate-/r/92.5%
sin-neg92.5%
neg-mul-192.5%
associate-/r*92.5%
associate-/r/92.5%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (fabs (/ ky (sin kx))))))
(if (<= (sin ky) -0.005)
(- (sin th))
(if (<= (sin ky) 1e-134)
t_1
(if (<= (sin ky) 2e-115)
(/ (* ky (sin th)) ky)
(if (<= (sin ky) 1.1e-41) 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.005) {
tmp = -sin(th);
} else if (sin(ky) <= 1e-134) {
tmp = t_1;
} else if (sin(ky) <= 2e-115) {
tmp = (ky * sin(th)) / ky;
} else if (sin(ky) <= 1.1e-41) {
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.005d0)) then
tmp = -sin(th)
else if (sin(ky) <= 1d-134) then
tmp = t_1
else if (sin(ky) <= 2d-115) then
tmp = (ky * sin(th)) / ky
else if (sin(ky) <= 1.1d-41) 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.005) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 1e-134) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-115) {
tmp = (ky * Math.sin(th)) / ky;
} else if (Math.sin(ky) <= 1.1e-41) {
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.005: tmp = -math.sin(th) elif math.sin(ky) <= 1e-134: tmp = t_1 elif math.sin(ky) <= 2e-115: tmp = (ky * math.sin(th)) / ky elif math.sin(ky) <= 1.1e-41: 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.005) tmp = Float64(-sin(th)); elseif (sin(ky) <= 1e-134) tmp = t_1; elseif (sin(ky) <= 2e-115) tmp = Float64(Float64(ky * sin(th)) / ky); elseif (sin(ky) <= 1.1e-41) 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.005) tmp = -sin(th); elseif (sin(ky) <= 1e-134) tmp = t_1; elseif (sin(ky) <= 2e-115) tmp = (ky * sin(th)) / ky; elseif (sin(ky) <= 1.1e-41) 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.005], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-134], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-115], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1.1e-41], 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.005:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 10^{-134}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-115}:\\
\;\;\;\;\frac{ky \cdot \sin th}{ky}\\
\mathbf{elif}\;\sin ky \leq 1.1 \cdot 10^{-41}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
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 ky around 0 5.9%
associate-*l/5.9%
clear-num5.9%
Applied egg-rr5.9%
Taylor expanded in ky around 0 31.5%
*-commutative31.5%
Simplified31.5%
Taylor expanded in ky around -inf 57.2%
neg-mul-157.2%
Simplified57.2%
if -0.0050000000000000001 < (sin.f64 ky) < 1.00000000000000004e-134 or 2.0000000000000001e-115 < (sin.f64 ky) < 1.1e-41Initial program 84.5%
remove-double-neg84.5%
sin-neg84.5%
neg-mul-184.5%
*-commutative84.5%
associate-*l*84.5%
associate-*l/80.5%
associate-/r/80.5%
associate-*l/84.5%
associate-/r/84.5%
sin-neg84.5%
neg-mul-184.5%
associate-/r*84.5%
associate-/r/84.5%
Simplified99.6%
Taylor expanded in ky around 0 57.3%
add-sqr-sqrt34.0%
sqrt-unprod42.9%
pow242.9%
Applied egg-rr42.9%
unpow242.9%
rem-sqrt-square57.5%
Simplified57.5%
if 1.00000000000000004e-134 < (sin.f64 ky) < 2.0000000000000001e-115Initial program 100.0%
remove-double-neg100.0%
sin-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-*l*100.0%
associate-*l/100.0%
associate-/r/100.0%
associate-*l/100.0%
associate-/r/99.2%
sin-neg99.2%
neg-mul-199.2%
associate-/r*99.2%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in ky around 0 100.0%
Taylor expanded in ky around inf 87.6%
Taylor expanded in ky around 0 87.6%
*-commutative99.6%
Simplified87.6%
if 1.1e-41 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 61.1%
Final simplification59.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ ky (sin kx)))))
(if (<= (sin ky) -0.005)
(- (sin th))
(if (<= (sin ky) 1e-134)
t_1
(if (<= (sin ky) 4e-115)
(/ (* ky (sin th)) ky)
(if (<= (sin ky) 2e-59) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (ky / sin(kx));
double tmp;
if (sin(ky) <= -0.005) {
tmp = -sin(th);
} else if (sin(ky) <= 1e-134) {
tmp = t_1;
} else if (sin(ky) <= 4e-115) {
tmp = (ky * sin(th)) / ky;
} else if (sin(ky) <= 2e-59) {
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) * (ky / sin(kx))
if (sin(ky) <= (-0.005d0)) then
tmp = -sin(th)
else if (sin(ky) <= 1d-134) then
tmp = t_1
else if (sin(ky) <= 4d-115) then
tmp = (ky * sin(th)) / ky
else if (sin(ky) <= 2d-59) 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) * (ky / Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 1e-134) {
tmp = t_1;
} else if (Math.sin(ky) <= 4e-115) {
tmp = (ky * Math.sin(th)) / ky;
} else if (Math.sin(ky) <= 2e-59) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * (ky / math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.005: tmp = -math.sin(th) elif math.sin(ky) <= 1e-134: tmp = t_1 elif math.sin(ky) <= 4e-115: tmp = (ky * math.sin(th)) / ky elif math.sin(ky) <= 2e-59: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(ky / sin(kx))) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(-sin(th)); elseif (sin(ky) <= 1e-134) tmp = t_1; elseif (sin(ky) <= 4e-115) tmp = Float64(Float64(ky * sin(th)) / ky); elseif (sin(ky) <= 2e-59) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * (ky / sin(kx)); tmp = 0.0; if (sin(ky) <= -0.005) tmp = -sin(th); elseif (sin(ky) <= 1e-134) tmp = t_1; elseif (sin(ky) <= 4e-115) tmp = (ky * sin(th)) / ky; elseif (sin(ky) <= 2e-59) 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[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-134], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-115], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-59], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 10^{-134}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-115}:\\
\;\;\;\;\frac{ky \cdot \sin th}{ky}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-59}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
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 ky around 0 5.9%
associate-*l/5.9%
clear-num5.9%
Applied egg-rr5.9%
Taylor expanded in ky around 0 31.5%
*-commutative31.5%
Simplified31.5%
Taylor expanded in ky around -inf 57.2%
neg-mul-157.2%
Simplified57.2%
if -0.0050000000000000001 < (sin.f64 ky) < 1.00000000000000004e-134 or 4.0000000000000002e-115 < (sin.f64 ky) < 2.0000000000000001e-59Initial program 84.0%
remove-double-neg84.0%
sin-neg84.0%
neg-mul-184.0%
*-commutative84.0%
associate-*l*84.0%
associate-*l/79.8%
associate-/r/79.8%
associate-*l/84.0%
associate-/r/84.0%
sin-neg84.0%
neg-mul-184.0%
associate-/r*84.0%
associate-/r/84.0%
Simplified99.6%
Taylor expanded in ky around 0 58.4%
if 1.00000000000000004e-134 < (sin.f64 ky) < 4.0000000000000002e-115Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.7%
associate-/r/99.1%
sin-neg99.1%
neg-mul-199.1%
associate-/r*99.1%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around inf 71.1%
Taylor expanded in ky around 0 71.1%
*-commutative99.4%
Simplified71.1%
if 2.0000000000000001e-59 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 60.3%
Final simplification59.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(- (sin th))
(if (<= (sin ky) 1e-134)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) 4e-115)
(/ (* ky (sin th)) ky)
(if (<= (sin ky) 2e-59) (* (sin th) (/ ky (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = -sin(th);
} else if (sin(ky) <= 1e-134) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 4e-115) {
tmp = (ky * sin(th)) / ky;
} else if (sin(ky) <= 2e-59) {
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 (sin(ky) <= (-0.005d0)) then
tmp = -sin(th)
else if (sin(ky) <= 1d-134) then
tmp = ky * (sin(th) / sin(kx))
else if (sin(ky) <= 4d-115) then
tmp = (ky * sin(th)) / ky
else if (sin(ky) <= 2d-59) 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 (Math.sin(ky) <= -0.005) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 1e-134) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 4e-115) {
tmp = (ky * Math.sin(th)) / ky;
} else if (Math.sin(ky) <= 2e-59) {
tmp = Math.sin(th) * (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.sin(th) elif math.sin(ky) <= 1e-134: tmp = ky * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 4e-115: tmp = (ky * math.sin(th)) / ky elif math.sin(ky) <= 2e-59: tmp = math.sin(th) * (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 = Float64(-sin(th)); elseif (sin(ky) <= 1e-134) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 4e-115) tmp = Float64(Float64(ky * sin(th)) / ky); elseif (sin(ky) <= 2e-59) 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 (sin(ky) <= -0.005) tmp = -sin(th); elseif (sin(ky) <= 1e-134) tmp = ky * (sin(th) / sin(kx)); elseif (sin(ky) <= 4e-115) tmp = (ky * sin(th)) / ky; elseif (sin(ky) <= 2e-59) tmp = sin(th) * (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[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-134], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-115], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-59], 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}\;\sin ky \leq -0.005:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 10^{-134}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-115}:\\
\;\;\;\;\frac{ky \cdot \sin th}{ky}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-59}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
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 ky around 0 5.9%
associate-*l/5.9%
clear-num5.9%
Applied egg-rr5.9%
Taylor expanded in ky around 0 31.5%
*-commutative31.5%
Simplified31.5%
Taylor expanded in ky around -inf 57.2%
neg-mul-157.2%
Simplified57.2%
if -0.0050000000000000001 < (sin.f64 ky) < 1.00000000000000004e-134Initial program 81.8%
remove-double-neg81.8%
sin-neg81.8%
neg-mul-181.8%
*-commutative81.8%
associate-*l*81.8%
associate-*l/78.1%
associate-/r/78.1%
associate-*l/81.8%
associate-/r/81.8%
sin-neg81.8%
neg-mul-181.8%
associate-/r*81.8%
associate-/r/81.8%
Simplified99.7%
Taylor expanded in ky around 0 58.4%
*-commutative58.4%
clear-num58.3%
un-div-inv58.4%
Applied egg-rr58.4%
associate-/r/58.4%
Simplified58.4%
if 1.00000000000000004e-134 < (sin.f64 ky) < 4.0000000000000002e-115Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.7%
associate-/r/99.1%
sin-neg99.1%
neg-mul-199.1%
associate-/r*99.1%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around inf 71.1%
Taylor expanded in ky around 0 71.1%
*-commutative99.4%
Simplified71.1%
if 4.0000000000000002e-115 < (sin.f64 ky) < 2.0000000000000001e-59Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/92.8%
associate-/r/92.8%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 58.2%
if 2.0000000000000001e-59 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 60.3%
Final simplification59.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(- (sin th))
(if (<= (sin ky) 1e-134)
(/ ky (/ (sin kx) (sin th)))
(if (<= (sin ky) 4e-115)
(/ (* ky (sin th)) ky)
(if (<= (sin ky) 2e-59) (* (sin th) (/ ky (sin kx))) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = -sin(th);
} else if (sin(ky) <= 1e-134) {
tmp = ky / (sin(kx) / sin(th));
} else if (sin(ky) <= 4e-115) {
tmp = (ky * sin(th)) / ky;
} else if (sin(ky) <= 2e-59) {
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 (sin(ky) <= (-0.005d0)) then
tmp = -sin(th)
else if (sin(ky) <= 1d-134) then
tmp = ky / (sin(kx) / sin(th))
else if (sin(ky) <= 4d-115) then
tmp = (ky * sin(th)) / ky
else if (sin(ky) <= 2d-59) 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 (Math.sin(ky) <= -0.005) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 1e-134) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 4e-115) {
tmp = (ky * Math.sin(th)) / ky;
} else if (Math.sin(ky) <= 2e-59) {
tmp = Math.sin(th) * (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.sin(th) elif math.sin(ky) <= 1e-134: tmp = ky / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 4e-115: tmp = (ky * math.sin(th)) / ky elif math.sin(ky) <= 2e-59: tmp = math.sin(th) * (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 = Float64(-sin(th)); elseif (sin(ky) <= 1e-134) tmp = Float64(ky / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 4e-115) tmp = Float64(Float64(ky * sin(th)) / ky); elseif (sin(ky) <= 2e-59) 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 (sin(ky) <= -0.005) tmp = -sin(th); elseif (sin(ky) <= 1e-134) tmp = ky / (sin(kx) / sin(th)); elseif (sin(ky) <= 4e-115) tmp = (ky * sin(th)) / ky; elseif (sin(ky) <= 2e-59) tmp = sin(th) * (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[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-134], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-115], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-59], 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}\;\sin ky \leq -0.005:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 10^{-134}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-115}:\\
\;\;\;\;\frac{ky \cdot \sin th}{ky}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-59}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
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 ky around 0 5.9%
associate-*l/5.9%
clear-num5.9%
Applied egg-rr5.9%
Taylor expanded in ky around 0 31.5%
*-commutative31.5%
Simplified31.5%
Taylor expanded in ky around -inf 57.2%
neg-mul-157.2%
Simplified57.2%
if -0.0050000000000000001 < (sin.f64 ky) < 1.00000000000000004e-134Initial program 81.8%
Taylor expanded in ky around 0 54.8%
associate-/l*58.5%
Simplified58.5%
if 1.00000000000000004e-134 < (sin.f64 ky) < 4.0000000000000002e-115Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.7%
associate-/r/99.7%
associate-*l/99.7%
associate-/r/99.1%
sin-neg99.1%
neg-mul-199.1%
associate-/r*99.1%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around inf 71.1%
Taylor expanded in ky around 0 71.1%
*-commutative99.4%
Simplified71.1%
if 4.0000000000000002e-115 < (sin.f64 ky) < 2.0000000000000001e-59Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/92.8%
associate-/r/92.8%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 58.2%
if 2.0000000000000001e-59 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 60.3%
Final simplification59.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (- (sin th)) (* (sin th) (/ ky (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = -sin(th);
} else {
tmp = sin(th) * (ky / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = -Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = -math.sin(th) else: tmp = math.sin(th) * (ky / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(-sin(th)); else tmp = Float64(sin(th) * Float64(ky / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = -sin(th); else tmp = sin(th) * (ky / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], (-N[Sin[th], $MachinePrecision]), N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;-\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.5%
associate-/r/99.5%
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 ky around 0 5.9%
associate-*l/5.9%
clear-num5.9%
Applied egg-rr5.9%
Taylor expanded in ky around 0 31.5%
*-commutative31.5%
Simplified31.5%
Taylor expanded in ky around -inf 57.2%
neg-mul-157.2%
Simplified57.2%
if -0.0050000000000000001 < (sin.f64 ky) Initial program 90.7%
remove-double-neg90.7%
sin-neg90.7%
neg-mul-190.7%
*-commutative90.7%
associate-*l*90.7%
associate-*l/88.2%
associate-/r/88.2%
associate-*l/90.7%
associate-/r/90.6%
sin-neg90.6%
neg-mul-190.6%
associate-/r*90.6%
associate-/r/90.7%
Simplified99.7%
Taylor expanded in ky around 0 67.3%
Taylor expanded in ky around 0 76.5%
Final simplification72.4%
(FPCore (kx ky th) :precision binary64 (if (<= th 4.6e-5) (/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)) (* (sin th) (/ ky (hypot ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 4.6e-5) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = sin(th) * (ky / hypot(ky, sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 4.6e-5) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = Math.sin(th) * (ky / Math.hypot(ky, Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 4.6e-5: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = math.sin(th) * (ky / math.hypot(ky, math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 4.6e-5) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(sin(th) * Float64(ky / hypot(ky, sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 4.6e-5) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = sin(th) * (ky / hypot(ky, sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 4.6e-5], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 4.6 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 4.6e-5Initial program 92.9%
expm1-log1p-u92.8%
expm1-udef37.0%
Applied egg-rr39.4%
expm1-def99.7%
expm1-log1p99.7%
associate-/r/99.6%
hypot-def92.8%
unpow292.8%
unpow292.8%
+-commutative92.8%
unpow292.8%
unpow292.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 59.7%
associate-*l/59.8%
+-commutative59.8%
unpow259.8%
unpow259.8%
hypot-def63.4%
*-lft-identity63.4%
hypot-def59.8%
unpow259.8%
unpow259.8%
+-commutative59.8%
unpow259.8%
unpow259.8%
hypot-def63.4%
Simplified63.4%
if 4.6e-5 < th Initial program 91.5%
remove-double-neg91.5%
sin-neg91.5%
neg-mul-191.5%
*-commutative91.5%
associate-*l*91.5%
associate-*l/91.4%
associate-/r/91.4%
associate-*l/91.5%
associate-/r/91.5%
sin-neg91.5%
neg-mul-191.5%
associate-/r*91.5%
associate-/r/91.5%
Simplified99.6%
Taylor expanded in ky around 0 67.7%
Taylor expanded in ky around 0 76.3%
Final simplification66.6%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 7.2e-160)
(/ ky (/ kx (sin th)))
(if (<= ky 29000000.0)
(/ (* ky (sin th)) ky)
(if (<= ky 4.2e+78) (- (sin th)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.2e-160) {
tmp = ky / (kx / sin(th));
} else if (ky <= 29000000.0) {
tmp = (ky * sin(th)) / ky;
} else if (ky <= 4.2e+78) {
tmp = -sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 7.2d-160) then
tmp = ky / (kx / sin(th))
else if (ky <= 29000000.0d0) then
tmp = (ky * sin(th)) / ky
else if (ky <= 4.2d+78) then
tmp = -sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.2e-160) {
tmp = ky / (kx / Math.sin(th));
} else if (ky <= 29000000.0) {
tmp = (ky * Math.sin(th)) / ky;
} else if (ky <= 4.2e+78) {
tmp = -Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.2e-160: tmp = ky / (kx / math.sin(th)) elif ky <= 29000000.0: tmp = (ky * math.sin(th)) / ky elif ky <= 4.2e+78: tmp = -math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.2e-160) tmp = Float64(ky / Float64(kx / sin(th))); elseif (ky <= 29000000.0) tmp = Float64(Float64(ky * sin(th)) / ky); elseif (ky <= 4.2e+78) tmp = Float64(-sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.2e-160) tmp = ky / (kx / sin(th)); elseif (ky <= 29000000.0) tmp = (ky * sin(th)) / ky; elseif (ky <= 4.2e+78) tmp = -sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.2e-160], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 29000000.0], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / ky), $MachinePrecision], If[LessEqual[ky, 4.2e+78], (-N[Sin[th], $MachinePrecision]), N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.2 \cdot 10^{-160}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{elif}\;ky \leq 29000000:\\
\;\;\;\;\frac{ky \cdot \sin th}{ky}\\
\mathbf{elif}\;ky \leq 4.2 \cdot 10^{+78}:\\
\;\;\;\;-\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 7.1999999999999994e-160Initial program 88.2%
remove-double-neg88.2%
sin-neg88.2%
neg-mul-188.2%
*-commutative88.2%
associate-*l*88.2%
associate-*l/85.7%
associate-/r/85.7%
associate-*l/88.2%
associate-/r/88.1%
sin-neg88.1%
neg-mul-188.1%
associate-/r*88.1%
associate-/r/88.2%
Simplified99.7%
Taylor expanded in ky around 0 37.7%
Taylor expanded in kx around 0 29.4%
associate-*l/27.1%
associate-/l*29.5%
Applied egg-rr29.5%
if 7.1999999999999994e-160 < ky < 2.9e7Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/97.0%
associate-/r/97.0%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in ky around 0 94.2%
Taylor expanded in ky around inf 46.5%
Taylor expanded in ky around 0 49.5%
*-commutative94.5%
Simplified49.5%
if 2.9e7 < ky < 4.2000000000000002e78Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.9%
Taylor expanded in ky around 0 8.0%
associate-*l/8.0%
clear-num8.0%
Applied egg-rr8.0%
Taylor expanded in ky around 0 17.1%
*-commutative17.1%
Simplified17.1%
Taylor expanded in ky around -inf 44.3%
neg-mul-144.3%
Simplified44.3%
if 4.2000000000000002e78 < ky Initial program 99.5%
Taylor expanded in kx around 0 39.2%
Final simplification34.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7.6e-230) (/ ky (/ kx th)) (if (or (<= ky 29000000.0) (not (<= ky 4.2e+78))) (sin th) (- (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.6e-230) {
tmp = ky / (kx / th);
} else if ((ky <= 29000000.0) || !(ky <= 4.2e+78)) {
tmp = sin(th);
} else {
tmp = -sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 7.6d-230) then
tmp = ky / (kx / th)
else if ((ky <= 29000000.0d0) .or. (.not. (ky <= 4.2d+78))) then
tmp = sin(th)
else
tmp = -sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.6e-230) {
tmp = ky / (kx / th);
} else if ((ky <= 29000000.0) || !(ky <= 4.2e+78)) {
tmp = Math.sin(th);
} else {
tmp = -Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.6e-230: tmp = ky / (kx / th) elif (ky <= 29000000.0) or not (ky <= 4.2e+78): tmp = math.sin(th) else: tmp = -math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.6e-230) tmp = Float64(ky / Float64(kx / th)); elseif ((ky <= 29000000.0) || !(ky <= 4.2e+78)) tmp = sin(th); else tmp = Float64(-sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.6e-230) tmp = ky / (kx / th); elseif ((ky <= 29000000.0) || ~((ky <= 4.2e+78))) tmp = sin(th); else tmp = -sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.6e-230], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 29000000.0], N[Not[LessEqual[ky, 4.2e+78]], $MachinePrecision]], N[Sin[th], $MachinePrecision], (-N[Sin[th], $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.6 \cdot 10^{-230}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{elif}\;ky \leq 29000000 \lor \neg \left(ky \leq 4.2 \cdot 10^{+78}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;-\sin th\\
\end{array}
\end{array}
if ky < 7.5999999999999996e-230Initial program 87.5%
remove-double-neg87.5%
sin-neg87.5%
neg-mul-187.5%
*-commutative87.5%
associate-*l*87.5%
associate-*l/85.5%
associate-/r/85.5%
associate-*l/87.5%
associate-/r/87.4%
sin-neg87.4%
neg-mul-187.4%
associate-/r*87.4%
associate-/r/87.5%
Simplified99.7%
Taylor expanded in ky around 0 34.1%
Taylor expanded in kx around 0 28.1%
Taylor expanded in th around 0 19.0%
associate-/l*20.9%
Simplified20.9%
if 7.5999999999999996e-230 < ky < 2.9e7 or 4.2000000000000002e78 < ky Initial program 98.6%
Taylor expanded in kx around 0 36.2%
if 2.9e7 < ky < 4.2000000000000002e78Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.9%
Taylor expanded in ky around 0 8.0%
associate-*l/8.0%
clear-num8.0%
Applied egg-rr8.0%
Taylor expanded in ky around 0 17.1%
*-commutative17.1%
Simplified17.1%
Taylor expanded in ky around -inf 44.3%
neg-mul-144.3%
Simplified44.3%
Final simplification28.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8.6e-85) (* (sin th) (/ ky kx)) (if (or (<= ky 29000000.0) (not (<= ky 4.2e+78))) (sin th) (- (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.6e-85) {
tmp = sin(th) * (ky / kx);
} else if ((ky <= 29000000.0) || !(ky <= 4.2e+78)) {
tmp = sin(th);
} else {
tmp = -sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 8.6d-85) then
tmp = sin(th) * (ky / kx)
else if ((ky <= 29000000.0d0) .or. (.not. (ky <= 4.2d+78))) then
tmp = sin(th)
else
tmp = -sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.6e-85) {
tmp = Math.sin(th) * (ky / kx);
} else if ((ky <= 29000000.0) || !(ky <= 4.2e+78)) {
tmp = Math.sin(th);
} else {
tmp = -Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8.6e-85: tmp = math.sin(th) * (ky / kx) elif (ky <= 29000000.0) or not (ky <= 4.2e+78): tmp = math.sin(th) else: tmp = -math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8.6e-85) tmp = Float64(sin(th) * Float64(ky / kx)); elseif ((ky <= 29000000.0) || !(ky <= 4.2e+78)) tmp = sin(th); else tmp = Float64(-sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8.6e-85) tmp = sin(th) * (ky / kx); elseif ((ky <= 29000000.0) || ~((ky <= 4.2e+78))) tmp = sin(th); else tmp = -sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8.6e-85], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 29000000.0], N[Not[LessEqual[ky, 4.2e+78]], $MachinePrecision]], N[Sin[th], $MachinePrecision], (-N[Sin[th], $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8.6 \cdot 10^{-85}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{elif}\;ky \leq 29000000 \lor \neg \left(ky \leq 4.2 \cdot 10^{+78}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;-\sin th\\
\end{array}
\end{array}
if ky < 8.59999999999999998e-85Initial program 89.2%
remove-double-neg89.2%
sin-neg89.2%
neg-mul-189.2%
*-commutative89.2%
associate-*l*89.2%
associate-*l/86.4%
associate-/r/86.4%
associate-*l/89.2%
associate-/r/89.1%
sin-neg89.1%
neg-mul-189.1%
associate-/r*89.1%
associate-/r/89.2%
Simplified99.7%
Taylor expanded in ky around 0 39.0%
Taylor expanded in kx around 0 29.4%
if 8.59999999999999998e-85 < ky < 2.9e7 or 4.2000000000000002e78 < ky Initial program 99.6%
Taylor expanded in kx around 0 44.9%
if 2.9e7 < ky < 4.2000000000000002e78Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.9%
Taylor expanded in ky around 0 8.0%
associate-*l/8.0%
clear-num8.0%
Applied egg-rr8.0%
Taylor expanded in ky around 0 17.1%
*-commutative17.1%
Simplified17.1%
Taylor expanded in ky around -inf 44.3%
neg-mul-144.3%
Simplified44.3%
Final simplification34.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.25e-82) (/ ky (/ kx (sin th))) (if (or (<= ky 29000000.0) (not (<= ky 4.2e+78))) (sin th) (- (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.25e-82) {
tmp = ky / (kx / sin(th));
} else if ((ky <= 29000000.0) || !(ky <= 4.2e+78)) {
tmp = sin(th);
} else {
tmp = -sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 1.25d-82) then
tmp = ky / (kx / sin(th))
else if ((ky <= 29000000.0d0) .or. (.not. (ky <= 4.2d+78))) then
tmp = sin(th)
else
tmp = -sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.25e-82) {
tmp = ky / (kx / Math.sin(th));
} else if ((ky <= 29000000.0) || !(ky <= 4.2e+78)) {
tmp = Math.sin(th);
} else {
tmp = -Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.25e-82: tmp = ky / (kx / math.sin(th)) elif (ky <= 29000000.0) or not (ky <= 4.2e+78): tmp = math.sin(th) else: tmp = -math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.25e-82) tmp = Float64(ky / Float64(kx / sin(th))); elseif ((ky <= 29000000.0) || !(ky <= 4.2e+78)) tmp = sin(th); else tmp = Float64(-sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.25e-82) tmp = ky / (kx / sin(th)); elseif ((ky <= 29000000.0) || ~((ky <= 4.2e+78))) tmp = sin(th); else tmp = -sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.25e-82], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 29000000.0], N[Not[LessEqual[ky, 4.2e+78]], $MachinePrecision]], N[Sin[th], $MachinePrecision], (-N[Sin[th], $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.25 \cdot 10^{-82}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{elif}\;ky \leq 29000000 \lor \neg \left(ky \leq 4.2 \cdot 10^{+78}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;-\sin th\\
\end{array}
\end{array}
if ky < 1.25e-82Initial program 89.2%
remove-double-neg89.2%
sin-neg89.2%
neg-mul-189.2%
*-commutative89.2%
associate-*l*89.2%
associate-*l/86.4%
associate-/r/86.4%
associate-*l/89.2%
associate-/r/89.1%
sin-neg89.1%
neg-mul-189.1%
associate-/r*89.1%
associate-/r/89.2%
Simplified99.7%
Taylor expanded in ky around 0 39.0%
Taylor expanded in kx around 0 29.4%
associate-*l/27.3%
associate-/l*29.4%
Applied egg-rr29.4%
if 1.25e-82 < ky < 2.9e7 or 4.2000000000000002e78 < ky Initial program 99.6%
Taylor expanded in kx around 0 44.9%
if 2.9e7 < ky < 4.2000000000000002e78Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.5%
associate-/r/99.5%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.9%
Taylor expanded in ky around 0 8.0%
associate-*l/8.0%
clear-num8.0%
Applied egg-rr8.0%
Taylor expanded in ky around 0 17.1%
*-commutative17.1%
Simplified17.1%
Taylor expanded in ky around -inf 44.3%
neg-mul-144.3%
Simplified44.3%
Final simplification34.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7.2e-230) (/ ky (/ kx th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.2e-230) {
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 (ky <= 7.2d-230) 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 (ky <= 7.2e-230) {
tmp = ky / (kx / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.2e-230: tmp = ky / (kx / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.2e-230) 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 (ky <= 7.2e-230) tmp = ky / (kx / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.2e-230], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.2 \cdot 10^{-230}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 7.1999999999999997e-230Initial program 87.5%
remove-double-neg87.5%
sin-neg87.5%
neg-mul-187.5%
*-commutative87.5%
associate-*l*87.5%
associate-*l/85.5%
associate-/r/85.5%
associate-*l/87.5%
associate-/r/87.4%
sin-neg87.4%
neg-mul-187.4%
associate-/r*87.4%
associate-/r/87.5%
Simplified99.7%
Taylor expanded in ky around 0 34.1%
Taylor expanded in kx around 0 28.1%
Taylor expanded in th around 0 19.0%
associate-/l*20.9%
Simplified20.9%
if 7.1999999999999997e-230 < ky Initial program 98.8%
Taylor expanded in kx around 0 33.4%
Final simplification26.4%
(FPCore (kx ky th) :precision binary64 (/ ky (/ kx th)))
double code(double kx, double ky, double th) {
return ky / (kx / th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = ky / (kx / th)
end function
public static double code(double kx, double ky, double th) {
return ky / (kx / th);
}
def code(kx, ky, th): return ky / (kx / th)
function code(kx, ky, th) return Float64(ky / Float64(kx / th)) end
function tmp = code(kx, ky, th) tmp = ky / (kx / th); end
code[kx_, ky_, th_] := N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{ky}{\frac{kx}{th}}
\end{array}
Initial program 92.5%
remove-double-neg92.5%
sin-neg92.5%
neg-mul-192.5%
*-commutative92.5%
associate-*l*92.5%
associate-*l/90.6%
associate-/r/90.6%
associate-*l/92.5%
associate-/r/92.5%
sin-neg92.5%
neg-mul-192.5%
associate-/r*92.5%
associate-/r/92.5%
Simplified99.7%
Taylor expanded in ky around 0 28.6%
Taylor expanded in kx around 0 21.2%
Taylor expanded in th around 0 13.7%
associate-/l*15.1%
Simplified15.1%
Final simplification15.1%
herbie shell --seed 2023330
(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)))