
(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 21 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 th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/89.6%
associate-/l*92.2%
unpow292.2%
Simplified99.6%
associate-*r/93.9%
hypot-undefine89.6%
unpow289.6%
unpow289.6%
+-commutative89.6%
associate-*l/92.3%
*-commutative92.3%
clear-num92.3%
un-div-inv92.3%
+-commutative92.3%
unpow292.3%
unpow292.3%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) ky)))
(if (<= (sin kx) -0.005)
(* t_1 (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))))
(if (<= (sin kx) 2.5e-119)
(sin th)
(if (or (<= (sin kx) 1e-98) (not (<= (sin kx) 2e-60)))
(* (sin th) (/ (sin ky) (sin kx)))
(/ t_1 ky))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * ky;
double tmp;
if (sin(kx) <= -0.005) {
tmp = t_1 * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(kx) <= 2.5e-119) {
tmp = sin(th);
} else if ((sin(kx) <= 1e-98) || !(sin(kx) <= 2e-60)) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = t_1 / ky;
}
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
if (sin(kx) <= (-0.005d0)) then
tmp = t_1 * sqrt((1.0d0 / (0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
else if (sin(kx) <= 2.5d-119) then
tmp = sin(th)
else if ((sin(kx) <= 1d-98) .or. (.not. (sin(kx) <= 2d-60))) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = t_1 / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * ky;
double tmp;
if (Math.sin(kx) <= -0.005) {
tmp = t_1 * Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(kx) <= 2.5e-119) {
tmp = Math.sin(th);
} else if ((Math.sin(kx) <= 1e-98) || !(Math.sin(kx) <= 2e-60)) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = t_1 / ky;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * ky tmp = 0 if math.sin(kx) <= -0.005: tmp = t_1 * math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(kx) <= 2.5e-119: tmp = math.sin(th) elif (math.sin(kx) <= 1e-98) or not (math.sin(kx) <= 2e-60): tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = t_1 / ky return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * ky) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(t_1 * sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(kx) <= 2.5e-119) tmp = sin(th); elseif ((sin(kx) <= 1e-98) || !(sin(kx) <= 2e-60)) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = Float64(t_1 / ky); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * ky; tmp = 0.0; if (sin(kx) <= -0.005) tmp = t_1 * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(kx) <= 2.5e-119) tmp = sin(th); elseif ((sin(kx) <= 1e-98) || ~((sin(kx) <= 2e-60))) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = t_1 / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(t$95$1 * N[Sqrt[N[(1.0 / N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2.5e-119], N[Sin[th], $MachinePrecision], If[Or[LessEqual[N[Sin[kx], $MachinePrecision], 1e-98], N[Not[LessEqual[N[Sin[kx], $MachinePrecision], 2e-60]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / ky), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot ky\\
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;t\_1 \cdot \sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin kx \leq 2.5 \cdot 10^{-119}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-98} \lor \neg \left(\sin kx \leq 2 \cdot 10^{-60}\right):\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{ky}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.5%
unpow299.5%
sin-mult98.0%
Applied egg-rr98.0%
div-sub98.0%
+-inverses98.0%
cos-098.0%
metadata-eval98.0%
count-298.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in ky around 0 64.3%
Taylor expanded in ky around 0 57.7%
if -0.0050000000000000001 < (sin.f64 kx) < 2.49999999999999996e-119Initial program 82.0%
unpow282.0%
sqr-neg82.0%
sin-neg82.0%
sin-neg82.0%
unpow282.0%
associate-*l/79.1%
associate-/l*81.9%
unpow281.9%
Simplified99.8%
Taylor expanded in kx around 0 41.9%
if 2.49999999999999996e-119 < (sin.f64 kx) < 9.99999999999999939e-99 or 1.9999999999999999e-60 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 69.7%
if 9.99999999999999939e-99 < (sin.f64 kx) < 1.9999999999999999e-60Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/81.8%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 23.3%
associate-*r/43.1%
sin-mult24.4%
associate-/l/24.4%
+-commutative24.4%
Applied egg-rr24.4%
Taylor expanded in ky around 0 43.1%
distribute-lft-out43.1%
fma-define43.1%
*-lft-identity43.1%
sin-neg43.1%
neg-mul-143.1%
distribute-rgt-out--43.1%
metadata-eval43.1%
cos-neg43.1%
+-inverses43.1%
Simplified43.1%
Taylor expanded in ky around 0 43.1%
Final simplification54.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(* (sin th) (/ ky (sqrt (- 0.5 (* 0.5 (cos (* kx 2.0)))))))
(if (<= (sin kx) 2.5e-119)
(sin th)
(if (or (<= (sin kx) 1e-98) (not (<= (sin kx) 2e-60)))
(* (sin th) (/ (sin ky) (sin kx)))
(/ (* (sin th) ky) ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = sin(th) * (ky / sqrt((0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(kx) <= 2.5e-119) {
tmp = sin(th);
} else if ((sin(kx) <= 1e-98) || !(sin(kx) <= 2e-60)) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = (sin(th) * ky) / ky;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.005d0)) then
tmp = sin(th) * (ky / sqrt((0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
else if (sin(kx) <= 2.5d-119) then
tmp = sin(th)
else if ((sin(kx) <= 1d-98) .or. (.not. (sin(kx) <= 2d-60))) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = (sin(th) * ky) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.005) {
tmp = Math.sin(th) * (ky / Math.sqrt((0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(kx) <= 2.5e-119) {
tmp = Math.sin(th);
} else if ((Math.sin(kx) <= 1e-98) || !(Math.sin(kx) <= 2e-60)) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = (Math.sin(th) * ky) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = math.sin(th) * (ky / math.sqrt((0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(kx) <= 2.5e-119: tmp = math.sin(th) elif (math.sin(kx) <= 1e-98) or not (math.sin(kx) <= 2e-60): tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = (math.sin(th) * ky) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(sin(th) * Float64(ky / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(kx) <= 2.5e-119) tmp = sin(th); elseif ((sin(kx) <= 1e-98) || !(sin(kx) <= 2e-60)) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = Float64(Float64(sin(th) * ky) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = sin(th) * (ky / sqrt((0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(kx) <= 2.5e-119) tmp = sin(th); elseif ((sin(kx) <= 1e-98) || ~((sin(kx) <= 2e-60))) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = (sin(th) * ky) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2.5e-119], N[Sin[th], $MachinePrecision], If[Or[LessEqual[N[Sin[kx], $MachinePrecision], 1e-98], N[Not[LessEqual[N[Sin[kx], $MachinePrecision], 2e-60]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / ky), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin kx \leq 2.5 \cdot 10^{-119}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-98} \lor \neg \left(\sin kx \leq 2 \cdot 10^{-60}\right):\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{ky}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.5%
unpow299.5%
sin-mult98.0%
Applied egg-rr98.0%
div-sub98.0%
+-inverses98.0%
cos-098.0%
metadata-eval98.0%
count-298.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in ky around 0 64.3%
Taylor expanded in ky around 0 57.6%
if -0.0050000000000000001 < (sin.f64 kx) < 2.49999999999999996e-119Initial program 82.0%
unpow282.0%
sqr-neg82.0%
sin-neg82.0%
sin-neg82.0%
unpow282.0%
associate-*l/79.1%
associate-/l*81.9%
unpow281.9%
Simplified99.8%
Taylor expanded in kx around 0 41.9%
if 2.49999999999999996e-119 < (sin.f64 kx) < 9.99999999999999939e-99 or 1.9999999999999999e-60 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 69.7%
if 9.99999999999999939e-99 < (sin.f64 kx) < 1.9999999999999999e-60Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/81.8%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 23.3%
associate-*r/43.1%
sin-mult24.4%
associate-/l/24.4%
+-commutative24.4%
Applied egg-rr24.4%
Taylor expanded in ky around 0 43.1%
distribute-lft-out43.1%
fma-define43.1%
*-lft-identity43.1%
sin-neg43.1%
neg-mul-143.1%
distribute-rgt-out--43.1%
metadata-eval43.1%
cos-neg43.1%
+-inverses43.1%
Simplified43.1%
Taylor expanded in ky around 0 43.1%
Final simplification53.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(* (* (sin th) ky) (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))))
(if (<= (sin kx) 2e-73)
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(kx) <= 2e-73) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.005d0)) then
tmp = (sin(th) * ky) * sqrt((1.0d0 / (0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
else if (sin(kx) <= 2d-73) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.005) {
tmp = (Math.sin(th) * ky) * Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(kx) <= 2e-73) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = (math.sin(th) * ky) * math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(kx) <= 2e-73: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(Float64(sin(th) * ky) * sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(kx) <= 2e-73) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(kx) <= 2e-73) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-73], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\left(\sin th \cdot ky\right) \cdot \sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-73}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.5%
unpow299.5%
sin-mult98.0%
Applied egg-rr98.0%
div-sub98.0%
+-inverses98.0%
cos-098.0%
metadata-eval98.0%
count-298.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in ky around 0 64.3%
Taylor expanded in ky around 0 57.7%
if -0.0050000000000000001 < (sin.f64 kx) < 1.99999999999999999e-73Initial program 83.7%
unpow283.7%
sqr-neg83.7%
sin-neg83.7%
sin-neg83.7%
unpow283.7%
associate-*l/77.9%
associate-/l*83.5%
unpow283.5%
Simplified99.7%
Taylor expanded in kx around 0 41.5%
add-sqr-sqrt40.0%
sqrt-prod67.2%
rem-sqrt-square75.0%
Applied egg-rr75.0%
if 1.99999999999999999e-73 < (sin.f64 kx) Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 71.4%
Final simplification68.8%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.3%
+-commutative92.3%
unpow292.3%
unpow292.3%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/89.6%
associate-/l*92.2%
unpow292.2%
Simplified99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0035)
(/ (sin th) (/ (hypot ky (sin kx)) (sin ky)))
(if (or (<= ky 1.3e+38) (not (<= ky 2.2e+148)))
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0035) {
tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky));
} else if ((ky <= 1.3e+38) || !(ky <= 2.2e+148)) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0035) {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / Math.sin(ky));
} else if ((ky <= 1.3e+38) || !(ky <= 2.2e+148)) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.0035: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / math.sin(ky)) elif (ky <= 1.3e+38) or not (ky <= 2.2e+148): tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0035) tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / sin(ky))); elseif ((ky <= 1.3e+38) || !(ky <= 2.2e+148)) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.0035) tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky)); elseif ((ky <= 1.3e+38) || ~((ky <= 2.2e+148))) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0035], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 1.3e+38], N[Not[LessEqual[ky, 2.2e+148]], $MachinePrecision]], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0035:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin ky}}\\
\mathbf{elif}\;ky \leq 1.3 \cdot 10^{+38} \lor \neg \left(ky \leq 2.2 \cdot 10^{+148}\right):\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\end{array}
\end{array}
if ky < 0.00350000000000000007Initial program 90.2%
unpow290.2%
sqr-neg90.2%
sin-neg90.2%
sin-neg90.2%
unpow290.2%
associate-*l/86.8%
associate-/l*90.1%
unpow290.1%
Simplified99.6%
associate-*r/92.3%
hypot-undefine86.8%
unpow286.8%
unpow286.8%
+-commutative86.8%
associate-*l/90.2%
*-commutative90.2%
clear-num90.2%
un-div-inv90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 78.1%
if 0.00350000000000000007 < ky < 1.3e38 or 2.1999999999999999e148 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 43.5%
add-sqr-sqrt42.5%
sqrt-prod68.4%
rem-sqrt-square68.4%
Applied egg-rr68.4%
if 1.3e38 < ky < 2.1999999999999999e148Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 65.2%
associate-*l/65.1%
+-commutative65.1%
unpow265.1%
unpow265.1%
hypot-undefine65.1%
*-lft-identity65.1%
hypot-undefine65.1%
unpow265.1%
unpow265.1%
+-commutative65.1%
unpow265.1%
unpow265.1%
hypot-define65.1%
Simplified65.1%
Final simplification75.8%
(FPCore (kx ky th)
:precision binary64
(if (<= ky 0.0115)
(* (sin th) (/ (sin ky) (hypot ky (sin kx))))
(if (or (<= ky 9.2e+43) (not (<= ky 7.7e+146)))
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0115) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else if ((ky <= 9.2e+43) || !(ky <= 7.7e+146)) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0115) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else if ((ky <= 9.2e+43) || !(ky <= 7.7e+146)) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.0115: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) elif (ky <= 9.2e+43) or not (ky <= 7.7e+146): tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0115) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); elseif ((ky <= 9.2e+43) || !(ky <= 7.7e+146)) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.0115) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); elseif ((ky <= 9.2e+43) || ~((ky <= 7.7e+146))) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0115], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 9.2e+43], N[Not[LessEqual[ky, 7.7e+146]], $MachinePrecision]], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0115:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{elif}\;ky \leq 9.2 \cdot 10^{+43} \lor \neg \left(ky \leq 7.7 \cdot 10^{+146}\right):\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\end{array}
\end{array}
if ky < 0.0115Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 78.1%
if 0.0115 < ky < 9.200000000000001e43 or 7.7000000000000002e146 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 43.5%
add-sqr-sqrt42.5%
sqrt-prod68.4%
rem-sqrt-square68.4%
Applied egg-rr68.4%
if 9.200000000000001e43 < ky < 7.7000000000000002e146Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 65.2%
associate-*l/65.1%
+-commutative65.1%
unpow265.1%
unpow265.1%
hypot-undefine65.1%
*-lft-identity65.1%
hypot-undefine65.1%
unpow265.1%
unpow265.1%
+-commutative65.1%
unpow265.1%
unpow265.1%
hypot-define65.1%
Simplified65.1%
Final simplification75.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 1e-104)
(* (sin th) (/ ky (sin kx)))
(/ (* (sin th) ky) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 1e-104) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = (sin(th) * ky) / ky;
}
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.01d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 1d-104) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = (sin(th) * ky) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 1e-104) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = (Math.sin(th) * ky) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 1e-104: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = (math.sin(th) * ky) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-104) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = Float64(Float64(sin(th) * ky) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-104) tmp = sin(th) * (ky / sin(kx)); else tmp = (sin(th) * ky) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-104], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / ky), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 10^{-104}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.3%
sqrt-unprod21.8%
pow221.8%
associate-*r/21.8%
*-commutative21.8%
associate-/l*21.8%
Applied egg-rr21.8%
*-inverses21.8%
*-commutative21.8%
Simplified21.8%
if -0.0100000000000000002 < (sin.f64 ky) < 9.99999999999999927e-105Initial program 85.8%
+-commutative85.8%
unpow285.8%
unpow285.8%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 45.8%
if 9.99999999999999927e-105 < (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.6%
Taylor expanded in kx around 0 60.7%
associate-*r/61.9%
sin-mult6.7%
associate-/l/6.7%
+-commutative6.7%
Applied egg-rr6.7%
Taylor expanded in ky around 0 61.9%
distribute-lft-out61.9%
fma-define61.9%
*-lft-identity61.9%
sin-neg61.9%
neg-mul-161.9%
distribute-rgt-out--61.9%
metadata-eval61.9%
cos-neg61.9%
+-inverses61.9%
Simplified61.9%
Taylor expanded in ky around 0 61.9%
Final simplification45.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(fabs (sin th))
(if (<= (sin ky) 1e-104)
(* (sin th) (/ ky (sin kx)))
(/ (* (sin th) ky) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-104) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = (sin(th) * ky) / ky;
}
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.01d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-104) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = (sin(th) * ky) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-104) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = (Math.sin(th) * ky) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-104: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = (math.sin(th) * ky) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-104) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = Float64(Float64(sin(th) * ky) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-104) tmp = sin(th) * (ky / sin(kx)); else tmp = (sin(th) * ky) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-104], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / ky), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-104}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.3%
sqrt-unprod21.8%
pow221.8%
associate-*r/21.8%
*-commutative21.8%
associate-/l*21.8%
Applied egg-rr21.8%
unpow221.8%
rem-sqrt-square24.6%
*-inverses24.6%
*-rgt-identity24.6%
Simplified24.6%
if -0.0100000000000000002 < (sin.f64 ky) < 9.99999999999999927e-105Initial program 85.8%
+-commutative85.8%
unpow285.8%
unpow285.8%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 45.8%
if 9.99999999999999927e-105 < (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.6%
Taylor expanded in kx around 0 60.7%
associate-*r/61.9%
sin-mult6.7%
associate-/l/6.7%
+-commutative6.7%
Applied egg-rr6.7%
Taylor expanded in ky around 0 61.9%
distribute-lft-out61.9%
fma-define61.9%
*-lft-identity61.9%
sin-neg61.9%
neg-mul-161.9%
distribute-rgt-out--61.9%
metadata-eval61.9%
cos-neg61.9%
+-inverses61.9%
Simplified61.9%
Taylor expanded in ky around 0 61.9%
Final simplification46.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(fabs (sin th))
(if (<= (sin ky) 1e-104)
(* ky (/ (sin th) (sin kx)))
(/ (* (sin th) ky) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-104) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = (sin(th) * ky) / ky;
}
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.01d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-104) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = (sin(th) * ky) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-104) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = (Math.sin(th) * ky) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-104: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = (math.sin(th) * ky) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-104) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = Float64(Float64(sin(th) * ky) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-104) tmp = ky * (sin(th) / sin(kx)); else tmp = (sin(th) * ky) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-104], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / ky), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-104}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 2.5%
add-sqr-sqrt1.3%
sqrt-unprod21.8%
pow221.8%
associate-*r/21.8%
*-commutative21.8%
associate-/l*21.8%
Applied egg-rr21.8%
unpow221.8%
rem-sqrt-square24.6%
*-inverses24.6%
*-rgt-identity24.6%
Simplified24.6%
if -0.0100000000000000002 < (sin.f64 ky) < 9.99999999999999927e-105Initial program 85.8%
unpow285.8%
sqr-neg85.8%
sin-neg85.8%
sin-neg85.8%
unpow285.8%
associate-*l/80.9%
associate-/l*85.8%
unpow285.8%
Simplified99.6%
Taylor expanded in ky around 0 42.2%
associate-/l*45.9%
Simplified45.9%
if 9.99999999999999927e-105 < (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.6%
Taylor expanded in kx around 0 60.7%
associate-*r/61.9%
sin-mult6.7%
associate-/l/6.7%
+-commutative6.7%
Applied egg-rr6.7%
Taylor expanded in ky around 0 61.9%
distribute-lft-out61.9%
fma-define61.9%
*-lft-identity61.9%
sin-neg61.9%
neg-mul-161.9%
distribute-rgt-out--61.9%
metadata-eval61.9%
cos-neg61.9%
+-inverses61.9%
Simplified61.9%
Taylor expanded in ky around 0 61.9%
Final simplification46.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 0.007) (* (sin th) (/ (sin ky) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.007) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.007) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.007: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.007) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.007) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.007], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.007:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 0.00700000000000000015Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 78.1%
if 0.00700000000000000015 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 37.7%
add-sqr-sqrt36.4%
sqrt-prod58.3%
rem-sqrt-square58.3%
Applied egg-rr58.3%
Final simplification73.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 0.0125) (* (sin ky) (/ (sin th) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0125) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0125) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.0125: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0125) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.0125) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0125], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0125:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 0.012500000000000001Initial program 90.2%
unpow290.2%
sqr-neg90.2%
sin-neg90.2%
sin-neg90.2%
unpow290.2%
associate-*l/86.8%
associate-/l*90.1%
unpow290.1%
Simplified99.6%
Taylor expanded in ky around 0 78.1%
if 0.012500000000000001 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 37.7%
add-sqr-sqrt36.4%
sqrt-prod58.3%
rem-sqrt-square58.3%
Applied egg-rr58.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.9e-73) (* (sin ky) (/ (sin th) (fabs (sin ky)))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.9e-73) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 2.9d-73) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
else
tmp = sin(th) * (sin(ky) / abs(sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.9e-73) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 2.9e-73: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 2.9e-73) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 2.9e-73) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.9e-73], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 2.9 \cdot 10^{-73}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 2.9e-73Initial program 89.8%
unpow289.8%
sqr-neg89.8%
sin-neg89.8%
sin-neg89.8%
unpow289.8%
associate-*l/86.2%
associate-/l*89.7%
unpow289.7%
Simplified99.6%
Taylor expanded in kx around 0 27.8%
add-sqr-sqrt26.2%
sqrt-prod45.2%
rem-sqrt-square50.2%
Applied egg-rr50.2%
if 2.9e-73 < kx Initial program 99.5%
unpow299.5%
sin-mult90.3%
Applied egg-rr90.3%
div-sub90.3%
+-inverses90.3%
cos-090.3%
metadata-eval90.3%
count-290.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in ky around 0 56.8%
add-sqr-sqrt56.8%
rem-sqrt-square56.8%
sqr-sin-a66.2%
sqrt-unprod35.5%
add-sqr-sqrt66.2%
Applied egg-rr66.2%
Final simplification54.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-104) (* (sin th) (/ (sin ky) (sin kx))) (/ (* (sin th) ky) ky)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-104) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = (sin(th) * ky) / ky;
}
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-104) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = (sin(th) * ky) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-104) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = (Math.sin(th) * ky) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-104: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = (math.sin(th) * ky) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-104) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = Float64(Float64(sin(th) * ky) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-104) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = (sin(th) * ky) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-104], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / ky), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-104}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999927e-105Initial program 89.4%
+-commutative89.4%
unpow289.4%
unpow289.4%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 36.2%
if 9.99999999999999927e-105 < (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.6%
Taylor expanded in kx around 0 60.7%
associate-*r/61.9%
sin-mult6.7%
associate-/l/6.7%
+-commutative6.7%
Applied egg-rr6.7%
Taylor expanded in ky around 0 61.9%
distribute-lft-out61.9%
fma-define61.9%
*-lft-identity61.9%
sin-neg61.9%
neg-mul-161.9%
distribute-rgt-out--61.9%
metadata-eval61.9%
cos-neg61.9%
+-inverses61.9%
Simplified61.9%
Taylor expanded in ky around 0 61.9%
Final simplification43.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 4.7e-101) (sin th) (/ (* (sin th) ky) ky)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.7e-101) {
tmp = sin(th);
} else {
tmp = (sin(th) * ky) / ky;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 4.7d-101) then
tmp = sin(th)
else
tmp = (sin(th) * ky) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.7e-101) {
tmp = Math.sin(th);
} else {
tmp = (Math.sin(th) * ky) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 4.7e-101: tmp = math.sin(th) else: tmp = (math.sin(th) * ky) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 4.7e-101) tmp = sin(th); else tmp = Float64(Float64(sin(th) * ky) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 4.7e-101) tmp = sin(th); else tmp = (sin(th) * ky) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 4.7e-101], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / ky), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 4.7 \cdot 10^{-101}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{ky}\\
\end{array}
\end{array}
if kx < 4.6999999999999999e-101Initial program 89.6%
unpow289.6%
sqr-neg89.6%
sin-neg89.6%
sin-neg89.6%
unpow289.6%
associate-*l/86.4%
associate-/l*89.5%
unpow289.5%
Simplified99.6%
Taylor expanded in kx around 0 27.8%
if 4.6999999999999999e-101 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/98.1%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 10.9%
associate-*r/23.0%
sin-mult18.6%
associate-/l/18.6%
+-commutative18.6%
Applied egg-rr18.6%
Taylor expanded in ky around 0 23.0%
distribute-lft-out23.0%
fma-define23.0%
*-lft-identity23.0%
sin-neg23.0%
neg-mul-123.0%
distribute-rgt-out--23.0%
metadata-eval23.0%
cos-neg23.0%
+-inverses23.0%
Simplified23.0%
Taylor expanded in ky around 0 23.0%
Final simplification26.5%
(FPCore (kx ky th) :precision binary64 (if (<= kx 6.5e-5) (sin th) (+ (+ (sin th) 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.5e-5) {
tmp = sin(th);
} else {
tmp = (sin(th) + 1.0) + -1.0;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 6.5d-5) then
tmp = sin(th)
else
tmp = (sin(th) + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.5e-5) {
tmp = Math.sin(th);
} else {
tmp = (Math.sin(th) + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 6.5e-5: tmp = math.sin(th) else: tmp = (math.sin(th) + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 6.5e-5) tmp = sin(th); else tmp = Float64(Float64(sin(th) + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 6.5e-5) tmp = sin(th); else tmp = (sin(th) + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 6.5e-5], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 6.5 \cdot 10^{-5}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left(\sin th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 6.49999999999999943e-5Initial program 90.2%
unpow290.2%
sqr-neg90.2%
sin-neg90.2%
sin-neg90.2%
unpow290.2%
associate-*l/86.7%
associate-/l*90.1%
unpow290.1%
Simplified99.6%
Taylor expanded in kx around 0 27.5%
if 6.49999999999999943e-5 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 8.9%
expm1-log1p-u8.9%
expm1-undefine22.5%
associate-*r/22.5%
*-commutative22.5%
associate-/l*22.5%
Applied egg-rr22.5%
expm1-define8.9%
*-inverses8.9%
*-rgt-identity8.9%
Simplified8.9%
expm1-undefine22.5%
log1p-undefine22.5%
rem-exp-log22.5%
+-commutative22.5%
Applied egg-rr22.5%
Final simplification26.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 980.0) (sin th) (log (+ th 1.0))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 980.0) {
tmp = sin(th);
} else {
tmp = log((th + 1.0));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 980.0d0) then
tmp = sin(th)
else
tmp = log((th + 1.0d0))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 980.0) {
tmp = Math.sin(th);
} else {
tmp = Math.log((th + 1.0));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 980.0: tmp = math.sin(th) else: tmp = math.log((th + 1.0)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 980.0) tmp = sin(th); else tmp = log(Float64(th + 1.0)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 980.0) tmp = sin(th); else tmp = log((th + 1.0)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 980.0], N[Sin[th], $MachinePrecision], N[Log[N[(th + 1.0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 980:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\log \left(th + 1\right)\\
\end{array}
\end{array}
if kx < 980Initial program 90.2%
unpow290.2%
sqr-neg90.2%
sin-neg90.2%
sin-neg90.2%
unpow290.2%
associate-*l/86.8%
associate-/l*90.1%
unpow290.1%
Simplified99.6%
Taylor expanded in kx around 0 27.6%
if 980 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 8.2%
add-log-exp22.0%
associate-*r/22.0%
*-commutative22.0%
associate-/l*22.0%
Applied egg-rr22.0%
Taylor expanded in th around 0 19.3%
+-commutative19.3%
Simplified19.3%
(FPCore (kx ky th) :precision binary64 (if (<= kx 2.1e-67) (sin th) (/ (* th ky) ky)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.1e-67) {
tmp = sin(th);
} else {
tmp = (th * ky) / ky;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 2.1d-67) then
tmp = sin(th)
else
tmp = (th * ky) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 2.1e-67) {
tmp = Math.sin(th);
} else {
tmp = (th * ky) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 2.1e-67: tmp = math.sin(th) else: tmp = (th * ky) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 2.1e-67) tmp = sin(th); else tmp = Float64(Float64(th * ky) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 2.1e-67) tmp = sin(th); else tmp = (th * ky) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 2.1e-67], N[Sin[th], $MachinePrecision], N[(N[(th * ky), $MachinePrecision] / ky), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 2.1 \cdot 10^{-67}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{th \cdot ky}{ky}\\
\end{array}
\end{array}
if kx < 2.1000000000000002e-67Initial program 89.8%
unpow289.8%
sqr-neg89.8%
sin-neg89.8%
sin-neg89.8%
unpow289.8%
associate-*l/86.2%
associate-/l*89.7%
unpow289.7%
Simplified99.6%
Taylor expanded in kx around 0 27.8%
if 2.1000000000000002e-67 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 9.9%
associate-*r/22.7%
sin-mult19.4%
associate-/l/19.4%
+-commutative19.4%
Applied egg-rr19.4%
Taylor expanded in ky around 0 22.7%
distribute-lft-out22.7%
fma-define22.7%
*-lft-identity22.7%
sin-neg22.7%
neg-mul-122.7%
distribute-rgt-out--22.7%
metadata-eval22.7%
cos-neg22.7%
+-inverses22.7%
Simplified22.7%
Taylor expanded in th around 0 19.5%
Final simplification25.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1e-86) th (/ (* th ky) ky)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1e-86) {
tmp = th;
} else {
tmp = (th * ky) / ky;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1d-86) then
tmp = th
else
tmp = (th * ky) / ky
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1e-86) {
tmp = th;
} else {
tmp = (th * ky) / ky;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1e-86: tmp = th else: tmp = (th * ky) / ky return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1e-86) tmp = th; else tmp = Float64(Float64(th * ky) / ky); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1e-86) tmp = th; else tmp = (th * ky) / ky; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1e-86], th, N[(N[(th * ky), $MachinePrecision] / ky), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 10^{-86}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;\frac{th \cdot ky}{ky}\\
\end{array}
\end{array}
if kx < 1.00000000000000008e-86Initial program 89.7%
unpow289.7%
sqr-neg89.7%
sin-neg89.7%
sin-neg89.7%
unpow289.7%
associate-*l/86.6%
associate-/l*89.6%
unpow289.6%
Simplified99.6%
Taylor expanded in kx around 0 28.0%
Taylor expanded in th around 0 19.0%
if 1.00000000000000008e-86 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/98.1%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 9.7%
associate-*r/22.2%
sin-mult19.0%
associate-/l/19.0%
+-commutative19.0%
Applied egg-rr19.0%
Taylor expanded in ky around 0 22.2%
distribute-lft-out22.2%
fma-define22.2%
*-lft-identity22.2%
sin-neg22.2%
neg-mul-122.2%
distribute-rgt-out--22.2%
metadata-eval22.2%
cos-neg22.2%
+-inverses22.2%
Simplified22.2%
Taylor expanded in th around 0 19.1%
Final simplification19.0%
(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 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/89.6%
associate-/l*92.2%
unpow292.2%
Simplified99.6%
Taylor expanded in kx around 0 23.2%
Taylor expanded in th around 0 15.8%
herbie shell --seed 2024108
(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)))