
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 91.0%
associate-*l/88.4%
*-commutative88.4%
associate-*l/90.9%
remove-double-neg90.9%
sin-neg90.9%
distribute-rgt-neg-in90.9%
associate-/r/90.9%
distribute-neg-frac90.9%
neg-mul-190.9%
associate-*l/90.9%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(/ (* ky (- (sin th))) (sin kx))
(if (or (<= (sin kx) 5e-191)
(and (not (<= (sin kx) 1e-182)) (<= (sin kx) 5e-92)))
(sin th)
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = (ky * -sin(th)) / sin(kx);
} else if ((sin(kx) <= 5e-191) || (!(sin(kx) <= 1e-182) && (sin(kx) <= 5e-92))) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) / 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 = (ky * -sin(th)) / sin(kx)
else if ((sin(kx) <= 5d-191) .or. (.not. (sin(kx) <= 1d-182)) .and. (sin(kx) <= 5d-92)) then
tmp = sin(th)
else
tmp = sin(ky) * (sin(th) / 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 = (ky * -Math.sin(th)) / Math.sin(kx);
} else if ((Math.sin(kx) <= 5e-191) || (!(Math.sin(kx) <= 1e-182) && (Math.sin(kx) <= 5e-92))) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = (ky * -math.sin(th)) / math.sin(kx) elif (math.sin(kx) <= 5e-191) or (not (math.sin(kx) <= 1e-182) and (math.sin(kx) <= 5e-92)): tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif ((sin(kx) <= 5e-191) || (!(sin(kx) <= 1e-182) && (sin(kx) <= 5e-92))) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = (ky * -sin(th)) / sin(kx); elseif ((sin(kx) <= 5e-191) || (~((sin(kx) <= 1e-182)) && (sin(kx) <= 5e-92))) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[kx], $MachinePrecision], 5e-191], And[N[Not[LessEqual[N[Sin[kx], $MachinePrecision], 1e-182]], $MachinePrecision], LessEqual[N[Sin[kx], $MachinePrecision], 5e-92]]], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-191} \lor \neg \left(\sin kx \leq 10^{-182}\right) \land \sin kx \leq 5 \cdot 10^{-92}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
Taylor expanded in ky around 0 22.3%
associate-/l*22.3%
associate-/r/22.3%
Simplified22.3%
add-sqr-sqrt7.5%
sqrt-unprod33.1%
pow133.1%
pow-plus33.1%
metadata-eval33.1%
Applied egg-rr33.1%
Taylor expanded in ky around -inf 61.0%
associate-*r/61.0%
neg-mul-161.0%
*-commutative61.0%
distribute-rgt-neg-in61.0%
Simplified61.0%
if -0.0050000000000000001 < (sin.f64 kx) < 5.0000000000000001e-191 or 1e-182 < (sin.f64 kx) < 5.00000000000000011e-92Initial program 84.1%
Taylor expanded in kx around 0 46.7%
if 5.0000000000000001e-191 < (sin.f64 kx) < 1e-182 or 5.00000000000000011e-92 < (sin.f64 kx) Initial program 94.8%
frac-2neg94.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-udef99.6%
frac-2neg99.6%
expm1-log1p-u99.5%
expm1-udef40.4%
Applied egg-rr40.4%
expm1-def99.5%
expm1-log1p99.6%
Simplified99.6%
Taylor expanded in ky around 0 62.4%
Final simplification55.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(/ (* ky (- (sin th))) (sin kx))
(if (<= (sin kx) 5e-191)
(sin th)
(if (<= (sin kx) 1e-182)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin kx) 5e-92) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = (ky * -sin(th)) / sin(kx);
} else if (sin(kx) <= 5e-191) {
tmp = sin(th);
} else if (sin(kx) <= 1e-182) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(kx) <= 5e-92) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.005d0)) then
tmp = (ky * -sin(th)) / sin(kx)
else if (sin(kx) <= 5d-191) then
tmp = sin(th)
else if (sin(kx) <= 1d-182) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(kx) <= 5d-92) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.005) {
tmp = (ky * -Math.sin(th)) / Math.sin(kx);
} else if (Math.sin(kx) <= 5e-191) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-182) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(kx) <= 5e-92) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = (ky * -math.sin(th)) / math.sin(kx) elif math.sin(kx) <= 5e-191: tmp = math.sin(th) elif math.sin(kx) <= 1e-182: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(kx) <= 5e-92: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = (ky * -sin(th)) / sin(kx); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-191], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-182], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-92], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-191}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-182}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-92}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
Taylor expanded in ky around 0 22.3%
associate-/l*22.3%
associate-/r/22.3%
Simplified22.3%
add-sqr-sqrt7.5%
sqrt-unprod33.1%
pow133.1%
pow-plus33.1%
metadata-eval33.1%
Applied egg-rr33.1%
Taylor expanded in ky around -inf 61.0%
associate-*r/61.0%
neg-mul-161.0%
*-commutative61.0%
distribute-rgt-neg-in61.0%
Simplified61.0%
if -0.0050000000000000001 < (sin.f64 kx) < 5.0000000000000001e-191 or 1e-182 < (sin.f64 kx) < 5.00000000000000011e-92Initial program 84.1%
Taylor expanded in kx around 0 46.7%
if 5.0000000000000001e-191 < (sin.f64 kx) < 1e-182Initial program 2.2%
frac-2neg2.2%
+-commutative2.2%
unpow22.2%
unpow22.2%
hypot-udef99.2%
frac-2neg99.2%
expm1-log1p-u99.2%
expm1-udef6.8%
Applied egg-rr6.8%
expm1-def100.0%
expm1-log1p100.0%
Simplified100.0%
Taylor expanded in ky around 0 100.0%
if 5.00000000000000011e-92 < (sin.f64 kx) Initial program 99.6%
Taylor expanded in ky around 0 60.4%
Final simplification55.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(/ (* ky (- (sin th))) (sin kx))
(if (<= (sin kx) 5e-191)
(sin th)
(if (<= (sin kx) 1e-182)
(* (sin ky) (/ 1.0 (/ kx (sin th))))
(if (<= (sin kx) 5e-92)
(sin th)
(/
(/ (sin th) (sin kx))
(+ (* ky 0.16666666666666666) (/ 1.0 ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = (ky * -sin(th)) / sin(kx);
} else if (sin(kx) <= 5e-191) {
tmp = sin(th);
} else if (sin(kx) <= 1e-182) {
tmp = sin(ky) * (1.0 / (kx / sin(th)));
} else if (sin(kx) <= 5e-92) {
tmp = sin(th);
} else {
tmp = (sin(th) / sin(kx)) / ((ky * 0.16666666666666666) + (1.0 / 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 = (ky * -sin(th)) / sin(kx)
else if (sin(kx) <= 5d-191) then
tmp = sin(th)
else if (sin(kx) <= 1d-182) then
tmp = sin(ky) * (1.0d0 / (kx / sin(th)))
else if (sin(kx) <= 5d-92) then
tmp = sin(th)
else
tmp = (sin(th) / sin(kx)) / ((ky * 0.16666666666666666d0) + (1.0d0 / 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 = (ky * -Math.sin(th)) / Math.sin(kx);
} else if (Math.sin(kx) <= 5e-191) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-182) {
tmp = Math.sin(ky) * (1.0 / (kx / Math.sin(th)));
} else if (Math.sin(kx) <= 5e-92) {
tmp = Math.sin(th);
} else {
tmp = (Math.sin(th) / Math.sin(kx)) / ((ky * 0.16666666666666666) + (1.0 / ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = (ky * -math.sin(th)) / math.sin(kx) elif math.sin(kx) <= 5e-191: tmp = math.sin(th) elif math.sin(kx) <= 1e-182: tmp = math.sin(ky) * (1.0 / (kx / math.sin(th))) elif math.sin(kx) <= 5e-92: tmp = math.sin(th) else: tmp = (math.sin(th) / math.sin(kx)) / ((ky * 0.16666666666666666) + (1.0 / ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = Float64(sin(ky) * Float64(1.0 / Float64(kx / sin(th)))); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = Float64(Float64(sin(th) / sin(kx)) / Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = (ky * -sin(th)) / sin(kx); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = sin(ky) * (1.0 / (kx / sin(th))); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = (sin(th) / sin(kx)) / ((ky * 0.16666666666666666) + (1.0 / ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-191], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-182], N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-92], N[Sin[th], $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] / N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-191}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-182}:\\
\;\;\;\;\sin ky \cdot \frac{1}{\frac{kx}{\sin th}}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-92}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sin th}{\sin kx}}{ky \cdot 0.16666666666666666 + \frac{1}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
Taylor expanded in ky around 0 22.3%
associate-/l*22.3%
associate-/r/22.3%
Simplified22.3%
add-sqr-sqrt7.5%
sqrt-unprod33.1%
pow133.1%
pow-plus33.1%
metadata-eval33.1%
Applied egg-rr33.1%
Taylor expanded in ky around -inf 61.0%
associate-*r/61.0%
neg-mul-161.0%
*-commutative61.0%
distribute-rgt-neg-in61.0%
Simplified61.0%
if -0.0050000000000000001 < (sin.f64 kx) < 5.0000000000000001e-191 or 1e-182 < (sin.f64 kx) < 5.00000000000000011e-92Initial program 84.1%
Taylor expanded in kx around 0 46.7%
if 5.0000000000000001e-191 < (sin.f64 kx) < 1e-182Initial program 2.2%
associate-*l/1.4%
+-commutative1.4%
unpow21.4%
unpow21.4%
hypot-udef55.0%
*-commutative55.0%
associate-/l*98.8%
div-inv98.8%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
Taylor expanded in kx around 0 55.0%
associate-/l*99.6%
div-inv99.6%
Applied egg-rr99.6%
if 5.00000000000000011e-92 < (sin.f64 kx) Initial program 99.6%
associate-*l/97.4%
+-commutative97.4%
unpow297.4%
unpow297.4%
hypot-udef97.5%
*-commutative97.5%
associate-/l*99.4%
div-inv99.3%
associate-/r*99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 60.4%
Taylor expanded in ky around 0 53.6%
Final simplification52.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 0.04)
(/
(/ (sin th) (hypot (sin kx) (sin ky)))
(+ (* ky 0.16666666666666666) (/ 1.0 ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 0.04) {
tmp = (sin(th) / hypot(sin(kx), sin(ky))) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 0.04) {
tmp = (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky))) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 0.04: tmp = (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky))) / ((ky * 0.16666666666666666) + (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 0.04) tmp = Float64(Float64(sin(th) / hypot(sin(kx), sin(ky))) / Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 0.04) tmp = (sin(th) / hypot(sin(kx), sin(ky))) / ((ky * 0.16666666666666666) + (1.0 / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.04], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 0.04:\\
\;\;\;\;\frac{\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}}{ky \cdot 0.16666666666666666 + \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
frac-2neg99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-udef99.8%
frac-2neg99.8%
expm1-log1p-u99.6%
expm1-udef55.6%
Applied egg-rr55.4%
expm1-def99.4%
expm1-log1p99.5%
associate-*r/99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
associate-/r/2.8%
*-inverses2.8%
*-un-lft-identity2.8%
add-sqr-sqrt0.7%
sqrt-unprod36.2%
pow236.2%
Applied egg-rr36.2%
if -0.0200000000000000004 < (sin.f64 ky) < 0.0400000000000000008Initial program 84.1%
associate-*l/79.5%
+-commutative79.5%
unpow279.5%
unpow279.5%
hypot-udef91.3%
*-commutative91.3%
associate-/l*99.6%
div-inv99.5%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 97.3%
if 0.0400000000000000008 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 68.0%
Final simplification78.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(* (sin th) (/ (- ky) (sin kx)))
(if (<= (sin kx) 5e-191)
(sin th)
(if (<= (sin kx) 1e-182)
(* (sin th) (/ ky kx))
(if (<= (sin kx) 5e-92) (sin th) (* (sin th) (/ ky (sin kx))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = sin(th) * (-ky / sin(kx));
} else if (sin(kx) <= 5e-191) {
tmp = sin(th);
} else if (sin(kx) <= 1e-182) {
tmp = sin(th) * (ky / kx);
} else if (sin(kx) <= 5e-92) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.005d0)) then
tmp = sin(th) * (-ky / sin(kx))
else if (sin(kx) <= 5d-191) then
tmp = sin(th)
else if (sin(kx) <= 1d-182) then
tmp = sin(th) * (ky / kx)
else if (sin(kx) <= 5d-92) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.005) {
tmp = Math.sin(th) * (-ky / Math.sin(kx));
} else if (Math.sin(kx) <= 5e-191) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-182) {
tmp = Math.sin(th) * (ky / kx);
} else if (Math.sin(kx) <= 5e-92) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = math.sin(th) * (-ky / math.sin(kx)) elif math.sin(kx) <= 5e-191: tmp = math.sin(th) elif math.sin(kx) <= 1e-182: tmp = math.sin(th) * (ky / kx) elif math.sin(kx) <= 5e-92: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(sin(th) * Float64(Float64(-ky) / sin(kx))); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = Float64(sin(th) * Float64(ky / kx)); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = sin(th) * (-ky / sin(kx)); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = sin(th) * (ky / kx); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(N[Sin[th], $MachinePrecision] * N[((-ky) / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-191], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-182], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-92], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\sin th \cdot \frac{-ky}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-191}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-182}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-92}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
Taylor expanded in ky around 0 22.3%
associate-/l*22.3%
associate-/r/22.3%
Simplified22.3%
add-sqr-sqrt7.5%
sqrt-unprod33.1%
pow133.1%
pow-plus33.1%
metadata-eval33.1%
Applied egg-rr33.1%
Taylor expanded in ky around -inf 61.1%
associate-*r/61.1%
neg-mul-161.1%
Simplified61.1%
if -0.0050000000000000001 < (sin.f64 kx) < 5.0000000000000001e-191 or 1e-182 < (sin.f64 kx) < 5.00000000000000011e-92Initial program 84.1%
Taylor expanded in kx around 0 46.7%
if 5.0000000000000001e-191 < (sin.f64 kx) < 1e-182Initial program 2.2%
Taylor expanded in ky around 0 55.0%
associate-/l*99.6%
associate-/r/99.2%
Simplified99.2%
Taylor expanded in kx around 0 55.0%
associate-/l*99.6%
associate-/r/99.2%
Simplified99.2%
if 5.00000000000000011e-92 < (sin.f64 kx) Initial program 99.6%
Taylor expanded in ky around 0 50.7%
associate-/l*52.8%
associate-/r/52.8%
Simplified52.8%
Final simplification52.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(/ (* ky (- (sin th))) (sin kx))
(if (<= (sin kx) 5e-191)
(sin th)
(if (<= (sin kx) 1e-182)
(* (sin th) (/ ky kx))
(if (<= (sin kx) 5e-92) (sin th) (* (sin th) (/ ky (sin kx))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = (ky * -sin(th)) / sin(kx);
} else if (sin(kx) <= 5e-191) {
tmp = sin(th);
} else if (sin(kx) <= 1e-182) {
tmp = sin(th) * (ky / kx);
} else if (sin(kx) <= 5e-92) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.005d0)) then
tmp = (ky * -sin(th)) / sin(kx)
else if (sin(kx) <= 5d-191) then
tmp = sin(th)
else if (sin(kx) <= 1d-182) then
tmp = sin(th) * (ky / kx)
else if (sin(kx) <= 5d-92) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.005) {
tmp = (ky * -Math.sin(th)) / Math.sin(kx);
} else if (Math.sin(kx) <= 5e-191) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-182) {
tmp = Math.sin(th) * (ky / kx);
} else if (Math.sin(kx) <= 5e-92) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = (ky * -math.sin(th)) / math.sin(kx) elif math.sin(kx) <= 5e-191: tmp = math.sin(th) elif math.sin(kx) <= 1e-182: tmp = math.sin(th) * (ky / kx) elif math.sin(kx) <= 5e-92: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = Float64(sin(th) * Float64(ky / kx)); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = (ky * -sin(th)) / sin(kx); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = sin(th) * (ky / kx); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-191], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-182], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-92], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-191}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-182}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-92}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
Taylor expanded in ky around 0 22.3%
associate-/l*22.3%
associate-/r/22.3%
Simplified22.3%
add-sqr-sqrt7.5%
sqrt-unprod33.1%
pow133.1%
pow-plus33.1%
metadata-eval33.1%
Applied egg-rr33.1%
Taylor expanded in ky around -inf 61.0%
associate-*r/61.0%
neg-mul-161.0%
*-commutative61.0%
distribute-rgt-neg-in61.0%
Simplified61.0%
if -0.0050000000000000001 < (sin.f64 kx) < 5.0000000000000001e-191 or 1e-182 < (sin.f64 kx) < 5.00000000000000011e-92Initial program 84.1%
Taylor expanded in kx around 0 46.7%
if 5.0000000000000001e-191 < (sin.f64 kx) < 1e-182Initial program 2.2%
Taylor expanded in ky around 0 55.0%
associate-/l*99.6%
associate-/r/99.2%
Simplified99.2%
Taylor expanded in kx around 0 55.0%
associate-/l*99.6%
associate-/r/99.2%
Simplified99.2%
if 5.00000000000000011e-92 < (sin.f64 kx) Initial program 99.6%
Taylor expanded in ky around 0 50.7%
associate-/l*52.8%
associate-/r/52.8%
Simplified52.8%
Final simplification52.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(/ (* ky (- (sin th))) (sin kx))
(if (<= (sin kx) 5e-191)
(sin th)
(if (<= (sin kx) 1e-182)
(* (sin ky) (/ 1.0 (/ kx (sin th))))
(if (<= (sin kx) 5e-92) (sin th) (* (sin th) (/ ky (sin kx))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = (ky * -sin(th)) / sin(kx);
} else if (sin(kx) <= 5e-191) {
tmp = sin(th);
} else if (sin(kx) <= 1e-182) {
tmp = sin(ky) * (1.0 / (kx / sin(th)));
} else if (sin(kx) <= 5e-92) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.005d0)) then
tmp = (ky * -sin(th)) / sin(kx)
else if (sin(kx) <= 5d-191) then
tmp = sin(th)
else if (sin(kx) <= 1d-182) then
tmp = sin(ky) * (1.0d0 / (kx / sin(th)))
else if (sin(kx) <= 5d-92) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.005) {
tmp = (ky * -Math.sin(th)) / Math.sin(kx);
} else if (Math.sin(kx) <= 5e-191) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1e-182) {
tmp = Math.sin(ky) * (1.0 / (kx / Math.sin(th)));
} else if (Math.sin(kx) <= 5e-92) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = (ky * -math.sin(th)) / math.sin(kx) elif math.sin(kx) <= 5e-191: tmp = math.sin(th) elif math.sin(kx) <= 1e-182: tmp = math.sin(ky) * (1.0 / (kx / math.sin(th))) elif math.sin(kx) <= 5e-92: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(Float64(ky * Float64(-sin(th))) / sin(kx)); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = Float64(sin(ky) * Float64(1.0 / Float64(kx / sin(th)))); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = (ky * -sin(th)) / sin(kx); elseif (sin(kx) <= 5e-191) tmp = sin(th); elseif (sin(kx) <= 1e-182) tmp = sin(ky) * (1.0 / (kx / sin(th))); elseif (sin(kx) <= 5e-92) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(N[(ky * (-N[Sin[th], $MachinePrecision])), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-191], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-182], N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-92], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\frac{ky \cdot \left(-\sin th\right)}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-191}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-182}:\\
\;\;\;\;\sin ky \cdot \frac{1}{\frac{kx}{\sin th}}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-92}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
Taylor expanded in ky around 0 22.3%
associate-/l*22.3%
associate-/r/22.3%
Simplified22.3%
add-sqr-sqrt7.5%
sqrt-unprod33.1%
pow133.1%
pow-plus33.1%
metadata-eval33.1%
Applied egg-rr33.1%
Taylor expanded in ky around -inf 61.0%
associate-*r/61.0%
neg-mul-161.0%
*-commutative61.0%
distribute-rgt-neg-in61.0%
Simplified61.0%
if -0.0050000000000000001 < (sin.f64 kx) < 5.0000000000000001e-191 or 1e-182 < (sin.f64 kx) < 5.00000000000000011e-92Initial program 84.1%
Taylor expanded in kx around 0 46.7%
if 5.0000000000000001e-191 < (sin.f64 kx) < 1e-182Initial program 2.2%
associate-*l/1.4%
+-commutative1.4%
unpow21.4%
unpow21.4%
hypot-udef55.0%
*-commutative55.0%
associate-/l*98.8%
div-inv98.8%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
Taylor expanded in kx around 0 55.0%
associate-/l*99.6%
div-inv99.6%
Applied egg-rr99.6%
if 5.00000000000000011e-92 < (sin.f64 kx) Initial program 99.6%
Taylor expanded in ky around 0 50.7%
associate-/l*52.8%
associate-/r/52.8%
Simplified52.8%
Final simplification52.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.002)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 5e-7)
(/ (/ (sin th) (hypot (sin kx) (sin ky))) (/ 1.0 ky))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.002) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 5e-7) {
tmp = (sin(th) / hypot(sin(kx), sin(ky))) / (1.0 / ky);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.002) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 5e-7) {
tmp = (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky))) / (1.0 / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.002: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 5e-7: tmp = (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky))) / (1.0 / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.002) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 5e-7) tmp = Float64(Float64(sin(th) / hypot(sin(kx), sin(ky))) / Float64(1.0 / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.002) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 5e-7) tmp = (sin(th) / hypot(sin(kx), sin(ky))) / (1.0 / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.002], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-7], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(1.0 / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.002:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}}{\frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2e-3Initial program 99.7%
frac-2neg99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-udef99.8%
frac-2neg99.8%
expm1-log1p-u99.6%
expm1-udef55.3%
Applied egg-rr55.2%
expm1-def99.4%
expm1-log1p99.5%
associate-*r/99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
associate-/r/2.8%
*-inverses2.8%
*-un-lft-identity2.8%
add-sqr-sqrt0.7%
sqrt-unprod35.2%
pow235.2%
Applied egg-rr35.2%
if -2e-3 < (sin.f64 ky) < 4.99999999999999977e-7Initial program 83.7%
associate-*l/78.9%
+-commutative78.9%
unpow278.9%
unpow278.9%
hypot-udef91.1%
*-commutative91.1%
associate-/l*99.6%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.2%
if 4.99999999999999977e-7 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 66.3%
Final simplification77.7%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin kx) (sin ky)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(kx), sin(ky)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(kx), sin(ky)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(kx), sin(ky))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}
\end{array}
Initial program 91.0%
frac-2neg91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-udef99.7%
frac-2neg99.7%
expm1-log1p-u99.6%
expm1-udef49.1%
Applied egg-rr49.0%
expm1-def99.5%
expm1-log1p99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.9e-22) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.9e-22) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 3.9d-22) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.9e-22) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.9e-22: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.9e-22) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.9e-22) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.9e-22], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.9 \cdot 10^{-22}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.89999999999999998e-22Initial program 87.8%
Taylor expanded in ky around 0 33.7%
associate-/l*35.4%
associate-/r/35.4%
Simplified35.4%
if 3.89999999999999998e-22 < ky Initial program 99.7%
Taylor expanded in kx around 0 40.2%
Final simplification36.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky 6e-141) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-141) {
tmp = sin(th) * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 6d-141) then
tmp = sin(th) * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 6e-141) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 6e-141: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 6e-141) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 6e-141) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 6e-141], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 6 \cdot 10^{-141}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 5.99999999999999967e-141Initial program 85.7%
Taylor expanded in ky around 0 31.4%
associate-/l*33.5%
associate-/r/33.4%
Simplified33.4%
Taylor expanded in kx around 0 21.4%
associate-/l*23.5%
associate-/r/23.4%
Simplified23.4%
if 5.99999999999999967e-141 < ky Initial program 99.7%
Taylor expanded in kx around 0 41.1%
Final simplification30.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.8e-142) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.8e-142) {
tmp = ky / (kx / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 2.8d-142) then
tmp = ky / (kx / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.8e-142) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.8e-142: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.8e-142) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.8e-142) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.8e-142], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.8 \cdot 10^{-142}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.80000000000000004e-142Initial program 85.7%
Taylor expanded in ky around 0 31.4%
associate-/l*33.5%
associate-/r/33.4%
Simplified33.4%
Taylor expanded in kx around 0 21.4%
associate-/l*23.5%
Simplified23.5%
if 2.80000000000000004e-142 < ky Initial program 99.7%
Taylor expanded in kx around 0 41.1%
Final simplification30.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.15e-143) (* th (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.15e-143) {
tmp = th * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 3.15d-143) then
tmp = th * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.15e-143) {
tmp = th * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.15e-143: tmp = th * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.15e-143) tmp = Float64(th * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.15e-143) tmp = th * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.15e-143], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.15 \cdot 10^{-143}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.15000000000000019e-143Initial program 85.7%
Taylor expanded in ky around 0 31.4%
associate-/l*33.5%
associate-/r/33.4%
Simplified33.4%
Taylor expanded in kx around 0 21.4%
associate-/l*23.5%
associate-/r/23.4%
Simplified23.4%
Taylor expanded in th around 0 17.0%
associate-/l*19.0%
associate-/r/19.1%
Simplified19.1%
if 3.15000000000000019e-143 < ky Initial program 99.7%
Taylor expanded in kx around 0 41.1%
Final simplification27.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.6e-52) (* th (/ ky kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.6e-52) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 3.6d-52) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.6e-52) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.6e-52: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.6e-52) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.6e-52) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.6e-52], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.6 \cdot 10^{-52}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 3.59999999999999988e-52Initial program 87.3%
Taylor expanded in ky around 0 34.3%
associate-/l*36.1%
associate-/r/36.1%
Simplified36.1%
Taylor expanded in kx around 0 22.5%
associate-/l*24.3%
associate-/r/24.2%
Simplified24.2%
Taylor expanded in th around 0 18.4%
associate-/l*20.2%
associate-/r/20.3%
Simplified20.3%
if 3.59999999999999988e-52 < ky Initial program 99.7%
frac-2neg99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-udef99.8%
frac-2neg99.8%
expm1-log1p-u99.6%
expm1-udef56.7%
Applied egg-rr56.5%
expm1-def99.5%
expm1-log1p99.7%
associate-*r/99.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in kx around 0 40.8%
Taylor expanded in th around 0 16.3%
Final simplification19.1%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 91.0%
frac-2neg91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-udef99.7%
frac-2neg99.7%
expm1-log1p-u99.6%
expm1-udef49.1%
Applied egg-rr49.0%
expm1-def99.5%
expm1-log1p99.6%
associate-*r/95.0%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in kx around 0 26.7%
Taylor expanded in th around 0 13.1%
Final simplification13.1%
herbie shell --seed 2023336
(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)))