
(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 22 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 kx) (sin ky)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(kx), sin(ky)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}
\end{array}
Initial program 94.1%
remove-double-neg94.1%
sin-neg94.1%
neg-mul-194.1%
*-commutative94.1%
associate-*l*94.1%
associate-*l/91.9%
associate-/r/91.9%
associate-*l/94.1%
associate-/r/94.0%
sin-neg94.0%
neg-mul-194.0%
associate-/r*94.0%
associate-/r/94.1%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef94.1%
unpow294.1%
unpow294.1%
+-commutative94.1%
unpow294.1%
unpow294.1%
hypot-def99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (* (sin th) (/ ky (sin kx))))))
(if (<= (sin kx) -0.92)
t_1
(if (<= (sin kx) -0.885)
(/ (* ky (fabs (sin th))) (sin kx))
(if (<= (sin kx) -0.02)
t_1
(if (<= (sin kx) 2e-38)
(sin th)
(* (sin ky) (/ (sin th) (sin kx)))))))))
double code(double kx, double ky, double th) {
double t_1 = fabs((sin(th) * (ky / sin(kx))));
double tmp;
if (sin(kx) <= -0.92) {
tmp = t_1;
} else if (sin(kx) <= -0.885) {
tmp = (ky * fabs(sin(th))) / sin(kx);
} else if (sin(kx) <= -0.02) {
tmp = t_1;
} else if (sin(kx) <= 2e-38) {
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) :: t_1
real(8) :: tmp
t_1 = abs((sin(th) * (ky / sin(kx))))
if (sin(kx) <= (-0.92d0)) then
tmp = t_1
else if (sin(kx) <= (-0.885d0)) then
tmp = (ky * abs(sin(th))) / sin(kx)
else if (sin(kx) <= (-0.02d0)) then
tmp = t_1
else if (sin(kx) <= 2d-38) 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 t_1 = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
double tmp;
if (Math.sin(kx) <= -0.92) {
tmp = t_1;
} else if (Math.sin(kx) <= -0.885) {
tmp = (ky * Math.abs(Math.sin(th))) / Math.sin(kx);
} else if (Math.sin(kx) <= -0.02) {
tmp = t_1;
} else if (Math.sin(kx) <= 2e-38) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs((math.sin(th) * (ky / math.sin(kx)))) tmp = 0 if math.sin(kx) <= -0.92: tmp = t_1 elif math.sin(kx) <= -0.885: tmp = (ky * math.fabs(math.sin(th))) / math.sin(kx) elif math.sin(kx) <= -0.02: tmp = t_1 elif math.sin(kx) <= 2e-38: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) t_1 = abs(Float64(sin(th) * Float64(ky / sin(kx)))) tmp = 0.0 if (sin(kx) <= -0.92) tmp = t_1; elseif (sin(kx) <= -0.885) tmp = Float64(Float64(ky * abs(sin(th))) / sin(kx)); elseif (sin(kx) <= -0.02) tmp = t_1; elseif (sin(kx) <= 2e-38) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs((sin(th) * (ky / sin(kx)))); tmp = 0.0; if (sin(kx) <= -0.92) tmp = t_1; elseif (sin(kx) <= -0.885) tmp = (ky * abs(sin(th))) / sin(kx); elseif (sin(kx) <= -0.02) tmp = t_1; elseif (sin(kx) <= 2e-38) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.92], t$95$1, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.885], N[(N[(ky * N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], t$95$1, If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-38], 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}
t_1 := \left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{if}\;\sin kx \leq -0.92:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin kx \leq -0.885:\\
\;\;\;\;\frac{ky \cdot \left|\sin th\right|}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq -0.02:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-38}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.92000000000000004 or -0.88500000000000001 < (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
remove-double-neg99.3%
sin-neg99.3%
neg-mul-199.3%
*-commutative99.3%
associate-*l*99.3%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.3%
associate-/r/99.3%
sin-neg99.3%
neg-mul-199.3%
associate-/r*99.3%
associate-/r/99.3%
Simplified99.3%
Taylor expanded in ky around 0 18.8%
add-sqr-sqrt17.4%
sqrt-unprod27.5%
pow227.5%
*-commutative27.5%
*-un-lft-identity27.5%
times-frac27.4%
/-rgt-identity27.4%
Applied egg-rr27.4%
*-commutative27.4%
associate-*l/27.5%
unpow227.5%
rem-sqrt-square34.0%
associate-*l/33.9%
*-commutative33.9%
Simplified33.9%
if -0.92000000000000004 < (sin.f64 kx) < -0.88500000000000001Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 4.1%
add-sqr-sqrt0.0%
sqrt-unprod5.0%
pow25.0%
Applied egg-rr53.3%
unpow25.0%
rem-sqrt-square3.8%
Simplified75.6%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999999e-38Initial program 88.8%
remove-double-neg88.8%
sin-neg88.8%
neg-mul-188.8%
*-commutative88.8%
associate-*l*88.8%
associate-*l/84.3%
associate-/r/84.3%
associate-*l/88.8%
associate-/r/88.6%
sin-neg88.6%
neg-mul-188.6%
associate-/r*88.6%
associate-/r/88.8%
Simplified99.9%
Taylor expanded in kx around 0 41.6%
if 1.9999999999999999e-38 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 56.9%
Taylor expanded in ky around inf 57.0%
*-commutative57.0%
associate-*l/57.0%
Simplified57.0%
Final simplification44.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (* (sin th) (/ (sin ky) (sin kx))))))
(if (<= (sin kx) -0.92)
t_1
(if (<= (sin kx) -0.885)
(/ (* ky (fabs (sin th))) (sin kx))
(if (<= (sin kx) -0.02)
t_1
(if (<= (sin kx) 2e-38)
(sin th)
(* (sin ky) (/ (sin th) (sin kx)))))))))
double code(double kx, double ky, double th) {
double t_1 = fabs((sin(th) * (sin(ky) / sin(kx))));
double tmp;
if (sin(kx) <= -0.92) {
tmp = t_1;
} else if (sin(kx) <= -0.885) {
tmp = (ky * fabs(sin(th))) / sin(kx);
} else if (sin(kx) <= -0.02) {
tmp = t_1;
} else if (sin(kx) <= 2e-38) {
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) :: t_1
real(8) :: tmp
t_1 = abs((sin(th) * (sin(ky) / sin(kx))))
if (sin(kx) <= (-0.92d0)) then
tmp = t_1
else if (sin(kx) <= (-0.885d0)) then
tmp = (ky * abs(sin(th))) / sin(kx)
else if (sin(kx) <= (-0.02d0)) then
tmp = t_1
else if (sin(kx) <= 2d-38) 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 t_1 = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
double tmp;
if (Math.sin(kx) <= -0.92) {
tmp = t_1;
} else if (Math.sin(kx) <= -0.885) {
tmp = (ky * Math.abs(Math.sin(th))) / Math.sin(kx);
} else if (Math.sin(kx) <= -0.02) {
tmp = t_1;
} else if (Math.sin(kx) <= 2e-38) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) tmp = 0 if math.sin(kx) <= -0.92: tmp = t_1 elif math.sin(kx) <= -0.885: tmp = (ky * math.fabs(math.sin(th))) / math.sin(kx) elif math.sin(kx) <= -0.02: tmp = t_1 elif math.sin(kx) <= 2e-38: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) t_1 = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))) tmp = 0.0 if (sin(kx) <= -0.92) tmp = t_1; elseif (sin(kx) <= -0.885) tmp = Float64(Float64(ky * abs(sin(th))) / sin(kx)); elseif (sin(kx) <= -0.02) tmp = t_1; elseif (sin(kx) <= 2e-38) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs((sin(th) * (sin(ky) / sin(kx)))); tmp = 0.0; if (sin(kx) <= -0.92) tmp = t_1; elseif (sin(kx) <= -0.885) tmp = (ky * abs(sin(th))) / sin(kx); elseif (sin(kx) <= -0.02) tmp = t_1; elseif (sin(kx) <= 2e-38) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.92], t$95$1, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.885], N[(N[(ky * N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], t$95$1, If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-38], 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}
t_1 := \left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{if}\;\sin kx \leq -0.92:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin kx \leq -0.885:\\
\;\;\;\;\frac{ky \cdot \left|\sin th\right|}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq -0.02:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-38}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.92000000000000004 or -0.88500000000000001 < (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
Taylor expanded in ky around 0 18.1%
clear-num18.1%
associate-/r/18.1%
Applied egg-rr18.1%
add-sqr-sqrt17.1%
sqrt-unprod29.6%
pow229.6%
*-commutative29.6%
associate-*l/29.6%
*-un-lft-identity29.6%
Applied egg-rr29.6%
unpow229.6%
rem-sqrt-square36.9%
Simplified36.9%
if -0.92000000000000004 < (sin.f64 kx) < -0.88500000000000001Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 4.1%
add-sqr-sqrt0.0%
sqrt-unprod5.0%
pow25.0%
Applied egg-rr53.3%
unpow25.0%
rem-sqrt-square3.8%
Simplified75.6%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999999e-38Initial program 88.8%
remove-double-neg88.8%
sin-neg88.8%
neg-mul-188.8%
*-commutative88.8%
associate-*l*88.8%
associate-*l/84.3%
associate-/r/84.3%
associate-*l/88.8%
associate-/r/88.6%
sin-neg88.6%
neg-mul-188.6%
associate-/r*88.6%
associate-/r/88.8%
Simplified99.9%
Taylor expanded in kx around 0 41.6%
if 1.9999999999999999e-38 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 56.9%
Taylor expanded in ky around inf 57.0%
*-commutative57.0%
associate-*l/57.0%
Simplified57.0%
Final simplification45.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin ky) (/ (sin th) (sin kx)))))
(if (<= (sin kx) -0.92)
(fabs t_1)
(if (<= (sin kx) -0.885)
(/ (* ky (fabs (sin th))) (sin kx))
(if (<= (sin kx) -0.02)
(fabs (* (sin th) (/ (sin ky) (sin kx))))
(if (<= (sin kx) 2e-38) (sin th) t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) * (sin(th) / sin(kx));
double tmp;
if (sin(kx) <= -0.92) {
tmp = fabs(t_1);
} else if (sin(kx) <= -0.885) {
tmp = (ky * fabs(sin(th))) / sin(kx);
} else if (sin(kx) <= -0.02) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 2e-38) {
tmp = sin(th);
} else {
tmp = t_1;
}
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(ky) * (sin(th) / sin(kx))
if (sin(kx) <= (-0.92d0)) then
tmp = abs(t_1)
else if (sin(kx) <= (-0.885d0)) then
tmp = (ky * abs(sin(th))) / sin(kx)
else if (sin(kx) <= (-0.02d0)) then
tmp = abs((sin(th) * (sin(ky) / sin(kx))))
else if (sin(kx) <= 2d-38) then
tmp = sin(th)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
double tmp;
if (Math.sin(kx) <= -0.92) {
tmp = Math.abs(t_1);
} else if (Math.sin(kx) <= -0.885) {
tmp = (ky * Math.abs(Math.sin(th))) / Math.sin(kx);
} else if (Math.sin(kx) <= -0.02) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-38) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) * (math.sin(th) / math.sin(kx)) tmp = 0 if math.sin(kx) <= -0.92: tmp = math.fabs(t_1) elif math.sin(kx) <= -0.885: tmp = (ky * math.fabs(math.sin(th))) / math.sin(kx) elif math.sin(kx) <= -0.02: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 2e-38: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) * Float64(sin(th) / sin(kx))) tmp = 0.0 if (sin(kx) <= -0.92) tmp = abs(t_1); elseif (sin(kx) <= -0.885) tmp = Float64(Float64(ky * abs(sin(th))) / sin(kx)); elseif (sin(kx) <= -0.02) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 2e-38) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) * (sin(th) / sin(kx)); tmp = 0.0; if (sin(kx) <= -0.92) tmp = abs(t_1); elseif (sin(kx) <= -0.885) tmp = (ky * abs(sin(th))) / sin(kx); elseif (sin(kx) <= -0.02) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 2e-38) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.92], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -0.885], N[(N[(ky * N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-38], N[Sin[th], $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.92:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{elif}\;\sin kx \leq -0.885:\\
\;\;\;\;\frac{ky \cdot \left|\sin th\right|}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq -0.02:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-38}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.92000000000000004Initial program 99.1%
Taylor expanded in ky around 0 15.9%
add-sqr-sqrt15.0%
sqrt-unprod25.7%
pow225.7%
associate-*l/25.8%
associate-/l*25.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square32.6%
associate-/l*32.7%
*-commutative32.7%
associate-*l/32.6%
Simplified32.6%
if -0.92000000000000004 < (sin.f64 kx) < -0.88500000000000001Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 4.1%
add-sqr-sqrt0.0%
sqrt-unprod5.0%
pow25.0%
Applied egg-rr53.3%
unpow25.0%
rem-sqrt-square3.8%
Simplified75.6%
if -0.88500000000000001 < (sin.f64 kx) < -0.0200000000000000004Initial program 99.4%
Taylor expanded in ky around 0 18.9%
clear-num18.9%
associate-/r/18.9%
Applied egg-rr18.9%
add-sqr-sqrt17.8%
sqrt-unprod31.0%
pow231.0%
*-commutative31.0%
associate-*l/31.0%
*-un-lft-identity31.0%
Applied egg-rr31.0%
unpow231.0%
rem-sqrt-square38.5%
Simplified38.5%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999999e-38Initial program 88.8%
remove-double-neg88.8%
sin-neg88.8%
neg-mul-188.8%
*-commutative88.8%
associate-*l*88.8%
associate-*l/84.3%
associate-/r/84.3%
associate-*l/88.8%
associate-/r/88.6%
sin-neg88.6%
neg-mul-188.6%
associate-/r*88.6%
associate-/r/88.8%
Simplified99.9%
Taylor expanded in kx around 0 41.6%
if 1.9999999999999999e-38 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 56.9%
Taylor expanded in ky around inf 57.0%
*-commutative57.0%
associate-*l/57.0%
Simplified57.0%
Final simplification45.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(fabs (sin th))
(if (<= (sin ky) 5e-17)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-17) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.01d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-17) then
tmp = sin(th) * abs((sin(ky) / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-17) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-17: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-17) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-17) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = sin(th); 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], 5e-17], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.5%
sqrt-unprod29.7%
pow229.7%
Applied egg-rr29.7%
unpow229.7%
rem-sqrt-square34.7%
Simplified34.7%
if -0.0100000000000000002 < (sin.f64 ky) < 4.9999999999999999e-17Initial program 87.9%
Taylor expanded in ky around 0 46.0%
add-sqr-sqrt23.1%
sqrt-unprod36.4%
pow236.4%
Applied egg-rr36.4%
unpow236.4%
rem-sqrt-square44.5%
Simplified44.5%
if 4.9999999999999999e-17 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.5%
Final simplification47.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (fabs (* (sin th) (/ ky (sin kx)))) (if (<= (sin kx) 2e-38) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else if (sin(kx) <= 2e-38) {
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.02d0)) then
tmp = abs((sin(th) * (ky / sin(kx))))
else if (sin(kx) <= 2d-38) 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.02) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-38) {
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.02: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) elif math.sin(kx) <= 2e-38: 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.02) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); elseif (sin(kx) <= 2e-38) 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.02) tmp = abs((sin(th) * (ky / sin(kx)))); elseif (sin(kx) <= 2e-38) 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.02], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-38], 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.02:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-38}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
remove-double-neg99.3%
sin-neg99.3%
neg-mul-199.3%
*-commutative99.3%
associate-*l*99.3%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.3%
associate-/r/99.3%
sin-neg99.3%
neg-mul-199.3%
associate-/r*99.3%
associate-/r/99.3%
Simplified99.4%
Taylor expanded in ky around 0 17.8%
add-sqr-sqrt16.4%
sqrt-unprod27.6%
pow227.6%
*-commutative27.6%
*-un-lft-identity27.6%
times-frac27.5%
/-rgt-identity27.5%
Applied egg-rr27.5%
*-commutative27.5%
associate-*l/27.6%
unpow227.6%
rem-sqrt-square33.6%
associate-*l/33.5%
*-commutative33.5%
Simplified33.5%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999999e-38Initial program 88.8%
remove-double-neg88.8%
sin-neg88.8%
neg-mul-188.8%
*-commutative88.8%
associate-*l*88.8%
associate-*l/84.3%
associate-/r/84.3%
associate-*l/88.8%
associate-/r/88.6%
sin-neg88.6%
neg-mul-188.6%
associate-/r*88.6%
associate-/r/88.8%
Simplified99.9%
Taylor expanded in kx around 0 41.6%
if 1.9999999999999999e-38 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 56.9%
Final simplification43.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (fabs (* (sin th) (/ ky (sin kx)))) (if (<= (sin kx) 2e-38) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else if (sin(kx) <= 2e-38) {
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.02d0)) then
tmp = abs((sin(th) * (ky / sin(kx))))
else if (sin(kx) <= 2d-38) 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.02) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-38) {
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.02: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) elif math.sin(kx) <= 2e-38: 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.02) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); elseif (sin(kx) <= 2e-38) 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.02) tmp = abs((sin(th) * (ky / sin(kx)))); elseif (sin(kx) <= 2e-38) 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.02], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-38], 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.02:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-38}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
remove-double-neg99.3%
sin-neg99.3%
neg-mul-199.3%
*-commutative99.3%
associate-*l*99.3%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.3%
associate-/r/99.3%
sin-neg99.3%
neg-mul-199.3%
associate-/r*99.3%
associate-/r/99.3%
Simplified99.4%
Taylor expanded in ky around 0 17.8%
add-sqr-sqrt16.4%
sqrt-unprod27.6%
pow227.6%
*-commutative27.6%
*-un-lft-identity27.6%
times-frac27.5%
/-rgt-identity27.5%
Applied egg-rr27.5%
*-commutative27.5%
associate-*l/27.6%
unpow227.6%
rem-sqrt-square33.6%
associate-*l/33.5%
*-commutative33.5%
Simplified33.5%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999999e-38Initial program 88.8%
remove-double-neg88.8%
sin-neg88.8%
neg-mul-188.8%
*-commutative88.8%
associate-*l*88.8%
associate-*l/84.3%
associate-/r/84.3%
associate-*l/88.8%
associate-/r/88.6%
sin-neg88.6%
neg-mul-188.6%
associate-/r*88.6%
associate-/r/88.8%
Simplified99.9%
Taylor expanded in kx around 0 41.6%
if 1.9999999999999999e-38 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 56.9%
Taylor expanded in ky around inf 57.0%
*-commutative57.0%
associate-*l/57.0%
Simplified57.0%
Final simplification43.7%
(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 94.1%
remove-double-neg94.1%
sin-neg94.1%
neg-mul-194.1%
*-commutative94.1%
associate-*l*94.1%
associate-*l/91.9%
associate-/r/91.9%
associate-*l/94.1%
associate-/r/94.0%
sin-neg94.0%
neg-mul-194.0%
associate-/r*94.0%
associate-/r/94.1%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.25)
(fabs (sin th))
(if (<= (sin ky) 2e-140)
(/ (sin th) (+ (/ (sin kx) ky) (+ (* 0.25 (* kx ky)) (* 0.5 (/ ky kx)))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.25) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-140) {
tmp = sin(th) / ((sin(kx) / ky) + ((0.25 * (kx * ky)) + (0.5 * (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 (sin(ky) <= (-0.25d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-140) then
tmp = sin(th) / ((sin(kx) / ky) + ((0.25d0 * (kx * ky)) + (0.5d0 * (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 (Math.sin(ky) <= -0.25) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-140) {
tmp = Math.sin(th) / ((Math.sin(kx) / ky) + ((0.25 * (kx * ky)) + (0.5 * (ky / kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.25: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-140: tmp = math.sin(th) / ((math.sin(kx) / ky) + ((0.25 * (kx * ky)) + (0.5 * (ky / kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.25) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-140) tmp = Float64(sin(th) / Float64(Float64(sin(kx) / ky) + Float64(Float64(0.25 * Float64(kx * ky)) + Float64(0.5 * Float64(ky / kx))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.25) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-140) tmp = sin(th) / ((sin(kx) / ky) + ((0.25 * (kx * ky)) + (0.5 * (ky / kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.25], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-140], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision] + N[(N[(0.25 * N[(kx * ky), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(ky / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.25:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-140}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky} + \left(0.25 \cdot \left(kx \cdot ky\right) + 0.5 \cdot \frac{ky}{kx}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.25Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.5%
sqrt-unprod28.8%
pow228.8%
Applied egg-rr28.8%
unpow228.8%
rem-sqrt-square34.4%
Simplified34.4%
if -0.25 < (sin.f64 ky) < 2e-140Initial program 86.4%
remove-double-neg86.4%
sin-neg86.4%
neg-mul-186.4%
*-commutative86.4%
associate-*l*86.4%
associate-*l/81.9%
associate-/r/81.9%
associate-*l/86.4%
associate-/r/86.3%
sin-neg86.3%
neg-mul-186.3%
associate-/r*86.3%
associate-/r/86.4%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.7%
hypot-udef86.4%
unpow286.4%
unpow286.4%
+-commutative86.4%
unpow286.4%
unpow286.4%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 43.5%
Taylor expanded in kx around 0 40.2%
if 2e-140 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/98.7%
associate-/r/98.7%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 58.5%
Final simplification45.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.25)
(fabs (sin th))
(if (<= (sin ky) 2e-140)
(/ (sin th) (+ (/ (* ky 0.5) kx) (/ (sin kx) ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.25) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-140) {
tmp = sin(th) / (((ky * 0.5) / kx) + (sin(kx) / ky));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.25d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-140) then
tmp = sin(th) / (((ky * 0.5d0) / kx) + (sin(kx) / ky))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.25) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-140) {
tmp = Math.sin(th) / (((ky * 0.5) / kx) + (Math.sin(kx) / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.25: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-140: tmp = math.sin(th) / (((ky * 0.5) / kx) + (math.sin(kx) / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.25) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-140) tmp = Float64(sin(th) / Float64(Float64(Float64(ky * 0.5) / kx) + Float64(sin(kx) / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.25) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-140) tmp = sin(th) / (((ky * 0.5) / kx) + (sin(kx) / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.25], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-140], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[(ky * 0.5), $MachinePrecision] / kx), $MachinePrecision] + N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.25:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-140}:\\
\;\;\;\;\frac{\sin th}{\frac{ky \cdot 0.5}{kx} + \frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.25Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.5%
sqrt-unprod28.8%
pow228.8%
Applied egg-rr28.8%
unpow228.8%
rem-sqrt-square34.4%
Simplified34.4%
if -0.25 < (sin.f64 ky) < 2e-140Initial program 86.4%
remove-double-neg86.4%
sin-neg86.4%
neg-mul-186.4%
*-commutative86.4%
associate-*l*86.4%
associate-*l/81.9%
associate-/r/81.9%
associate-*l/86.4%
associate-/r/86.3%
sin-neg86.3%
neg-mul-186.3%
associate-/r*86.3%
associate-/r/86.4%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.7%
hypot-udef86.4%
unpow286.4%
unpow286.4%
+-commutative86.4%
unpow286.4%
unpow286.4%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 43.5%
Taylor expanded in kx around 0 43.5%
associate-*r/43.5%
Simplified43.5%
if 2e-140 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/98.7%
associate-/r/98.7%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 58.5%
Final simplification47.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(fabs (* (sin th) (/ ky (sin kx))))
(if (<= (sin kx) 2e-38)
(sin th)
(/ (sin th) (+ (/ (* ky 0.5) kx) (/ (sin kx) ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else if (sin(kx) <= 2e-38) {
tmp = sin(th);
} else {
tmp = sin(th) / (((ky * 0.5) / kx) + (sin(kx) / 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.02d0)) then
tmp = abs((sin(th) * (ky / sin(kx))))
else if (sin(kx) <= 2d-38) then
tmp = sin(th)
else
tmp = sin(th) / (((ky * 0.5d0) / kx) + (sin(kx) / ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-38) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (((ky * 0.5) / kx) + (Math.sin(kx) / ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) elif math.sin(kx) <= 2e-38: tmp = math.sin(th) else: tmp = math.sin(th) / (((ky * 0.5) / kx) + (math.sin(kx) / ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); elseif (sin(kx) <= 2e-38) tmp = sin(th); else tmp = Float64(sin(th) / Float64(Float64(Float64(ky * 0.5) / kx) + Float64(sin(kx) / ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = abs((sin(th) * (ky / sin(kx)))); elseif (sin(kx) <= 2e-38) tmp = sin(th); else tmp = sin(th) / (((ky * 0.5) / kx) + (sin(kx) / ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-38], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[(ky * 0.5), $MachinePrecision] / kx), $MachinePrecision] + N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-38}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{ky \cdot 0.5}{kx} + \frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
remove-double-neg99.3%
sin-neg99.3%
neg-mul-199.3%
*-commutative99.3%
associate-*l*99.3%
associate-*l/99.4%
associate-/r/99.4%
associate-*l/99.3%
associate-/r/99.3%
sin-neg99.3%
neg-mul-199.3%
associate-/r*99.3%
associate-/r/99.3%
Simplified99.4%
Taylor expanded in ky around 0 17.8%
add-sqr-sqrt16.4%
sqrt-unprod27.6%
pow227.6%
*-commutative27.6%
*-un-lft-identity27.6%
times-frac27.5%
/-rgt-identity27.5%
Applied egg-rr27.5%
*-commutative27.5%
associate-*l/27.6%
unpow227.6%
rem-sqrt-square33.6%
associate-*l/33.5%
*-commutative33.5%
Simplified33.5%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999999e-38Initial program 88.8%
remove-double-neg88.8%
sin-neg88.8%
neg-mul-188.8%
*-commutative88.8%
associate-*l*88.8%
associate-*l/84.3%
associate-/r/84.3%
associate-*l/88.8%
associate-/r/88.6%
sin-neg88.6%
neg-mul-188.6%
associate-/r*88.6%
associate-/r/88.8%
Simplified99.9%
Taylor expanded in kx around 0 41.6%
if 1.9999999999999999e-38 < (sin.f64 kx) Initial program 99.5%
remove-double-neg99.5%
sin-neg99.5%
neg-mul-199.5%
*-commutative99.5%
associate-*l*99.5%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.5%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.5%
Simplified99.5%
*-commutative99.5%
clear-num99.4%
un-div-inv99.6%
hypot-udef99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 48.8%
Taylor expanded in kx around 0 48.9%
associate-*r/48.9%
Simplified48.9%
Final simplification41.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.024)
(* th (/ (sin ky) (hypot (sin ky) (sin kx))))
(if (or (<= th 5.5e+92) (not (<= th 1.05e+99)))
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.024) {
tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
} else if ((th <= 5.5e+92) || !(th <= 1.05e+99)) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.024) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if ((th <= 5.5e+92) || !(th <= 1.05e+99)) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.024: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) elif (th <= 5.5e+92) or not (th <= 1.05e+99): tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.024) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx)))); elseif ((th <= 5.5e+92) || !(th <= 1.05e+99)) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.024) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); elseif ((th <= 5.5e+92) || ~((th <= 1.05e+99))) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.024], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 5.5e+92], N[Not[LessEqual[th, 1.05e+99]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.024:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 5.5 \cdot 10^{+92} \lor \neg \left(th \leq 1.05 \cdot 10^{+99}\right):\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 0.024Initial program 94.1%
remove-double-neg94.1%
sin-neg94.1%
neg-mul-194.1%
*-commutative94.1%
associate-*l*94.1%
associate-*l/91.0%
associate-/r/91.0%
associate-*l/94.1%
associate-/r/94.0%
sin-neg94.0%
neg-mul-194.0%
associate-/r*94.0%
associate-/r/94.1%
Simplified99.7%
Taylor expanded in th around 0 75.6%
if 0.024 < th < 5.50000000000000053e92 or 1.05000000000000005e99 < th Initial program 93.9%
Taylor expanded in ky around 0 26.7%
add-sqr-sqrt13.0%
sqrt-unprod14.5%
pow214.5%
Applied egg-rr14.5%
unpow214.5%
rem-sqrt-square19.9%
Simplified19.9%
if 5.50000000000000053e92 < th < 1.05000000000000005e99Initial program 100.0%
remove-double-neg100.0%
sin-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-*l*100.0%
associate-*l/99.2%
associate-/r/99.2%
associate-*l/100.0%
associate-/r/99.2%
sin-neg99.2%
neg-mul-199.2%
associate-/r*99.2%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in kx around 0 26.2%
Final simplification59.8%
(FPCore (kx ky th)
:precision binary64
(if (<= th 0.023)
(/ th (/ (hypot (sin kx) (sin ky)) (sin ky)))
(if (or (<= th 7.3e+93) (not (<= th 1.1e+99)))
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.023) {
tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky));
} else if ((th <= 7.3e+93) || !(th <= 1.1e+99)) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.023) {
tmp = th / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
} else if ((th <= 7.3e+93) || !(th <= 1.1e+99)) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.023: tmp = th / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky)) elif (th <= 7.3e+93) or not (th <= 1.1e+99): tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.023) tmp = Float64(th / Float64(hypot(sin(kx), sin(ky)) / sin(ky))); elseif ((th <= 7.3e+93) || !(th <= 1.1e+99)) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.023) tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky)); elseif ((th <= 7.3e+93) || ~((th <= 1.1e+99))) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.023], N[(th / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[th, 7.3e+93], N[Not[LessEqual[th, 1.1e+99]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.023:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}\\
\mathbf{elif}\;th \leq 7.3 \cdot 10^{+93} \lor \neg \left(th \leq 1.1 \cdot 10^{+99}\right):\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 0.023Initial program 94.1%
remove-double-neg94.1%
sin-neg94.1%
neg-mul-194.1%
*-commutative94.1%
associate-*l*94.1%
associate-*l/91.0%
associate-/r/91.0%
associate-*l/94.1%
associate-/r/94.0%
sin-neg94.0%
neg-mul-194.0%
associate-/r*94.0%
associate-/r/94.1%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef94.1%
unpow294.1%
unpow294.1%
+-commutative94.1%
unpow294.1%
unpow294.1%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 75.6%
if 0.023 < th < 7.30000000000000026e93 or 1.09999999999999989e99 < th Initial program 93.9%
Taylor expanded in ky around 0 26.7%
add-sqr-sqrt13.0%
sqrt-unprod14.5%
pow214.5%
Applied egg-rr14.5%
unpow214.5%
rem-sqrt-square19.9%
Simplified19.9%
if 7.30000000000000026e93 < th < 1.09999999999999989e99Initial program 100.0%
remove-double-neg100.0%
sin-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-*l*100.0%
associate-*l/99.2%
associate-/r/99.2%
associate-*l/100.0%
associate-/r/99.2%
sin-neg99.2%
neg-mul-199.2%
associate-/r*99.2%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in kx around 0 26.2%
Final simplification59.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.25) (fabs (sin th)) (if (<= (sin ky) 1e-161) (* (sin ky) (/ (sin th) kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.25) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-161) {
tmp = sin(ky) * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.25d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-161) then
tmp = sin(ky) * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.25) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-161) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.25: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-161: tmp = math.sin(ky) * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.25) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-161) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.25) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-161) tmp = sin(ky) * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.25], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-161], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.25:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-161}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.25Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.5%
sqrt-unprod28.8%
pow228.8%
Applied egg-rr28.8%
unpow228.8%
rem-sqrt-square34.4%
Simplified34.4%
if -0.25 < (sin.f64 ky) < 1.00000000000000003e-161Initial program 85.6%
Taylor expanded in ky around 0 45.7%
Taylor expanded in kx around 0 28.6%
expm1-log1p-u28.2%
expm1-udef18.2%
associate-/l*18.2%
Applied egg-rr18.2%
expm1-def29.0%
expm1-log1p29.3%
associate-/r/29.3%
*-commutative29.3%
associate-*r/28.6%
*-commutative28.6%
associate-*r/29.3%
Simplified29.3%
if 1.00000000000000003e-161 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/98.1%
associate-/r/98.1%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.8%
Taylor expanded in kx around 0 57.2%
Final simplification41.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (fabs (sin th)) (if (<= (sin ky) 2e-140) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-140) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.05d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-140) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-140) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-140: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-140) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.05) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-140) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-140], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-140}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.5%
sqrt-unprod30.1%
pow230.1%
Applied egg-rr30.1%
unpow230.1%
rem-sqrt-square35.2%
Simplified35.2%
if -0.050000000000000003 < (sin.f64 ky) < 2e-140Initial program 85.7%
Taylor expanded in ky around 0 45.3%
if 2e-140 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/98.7%
associate-/r/98.7%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in kx around 0 58.5%
Final simplification47.9%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (hypot (sin kx) (sin ky)))) (if (<= th 3.8e-5) (/ th (/ t_1 (sin ky))) (/ (* (sin th) ky) t_1))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(kx), sin(ky));
double tmp;
if (th <= 3.8e-5) {
tmp = th / (t_1 / sin(ky));
} else {
tmp = (sin(th) * ky) / t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(kx), Math.sin(ky));
double tmp;
if (th <= 3.8e-5) {
tmp = th / (t_1 / Math.sin(ky));
} else {
tmp = (Math.sin(th) * ky) / t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(kx), math.sin(ky)) tmp = 0 if th <= 3.8e-5: tmp = th / (t_1 / math.sin(ky)) else: tmp = (math.sin(th) * ky) / t_1 return tmp
function code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)) tmp = 0.0 if (th <= 3.8e-5) tmp = Float64(th / Float64(t_1 / sin(ky))); else tmp = Float64(Float64(sin(th) * ky) / t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)); tmp = 0.0; if (th <= 3.8e-5) tmp = th / (t_1 / sin(ky)); else tmp = (sin(th) * ky) / t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[th, 3.8e-5], N[(th / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;th \leq 3.8 \cdot 10^{-5}:\\
\;\;\;\;\frac{th}{\frac{t\_1}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{t\_1}\\
\end{array}
\end{array}
if th < 3.8000000000000002e-5Initial program 94.1%
remove-double-neg94.1%
sin-neg94.1%
neg-mul-194.1%
*-commutative94.1%
associate-*l*94.1%
associate-*l/91.0%
associate-/r/91.0%
associate-*l/94.1%
associate-/r/94.0%
sin-neg94.0%
neg-mul-194.0%
associate-/r*94.0%
associate-/r/94.1%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef94.1%
unpow294.1%
unpow294.1%
+-commutative94.1%
unpow294.1%
unpow294.1%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 75.6%
if 3.8000000000000002e-5 < th Initial program 94.3%
remove-double-neg94.3%
sin-neg94.3%
neg-mul-194.3%
*-commutative94.3%
associate-*l*94.3%
associate-*l/94.2%
associate-/r/94.2%
associate-*l/94.3%
associate-/r/94.2%
sin-neg94.2%
neg-mul-194.2%
associate-/r*94.2%
associate-/r/94.3%
Simplified99.5%
associate-*l/99.5%
hypot-udef94.2%
unpow294.2%
unpow294.2%
+-commutative94.2%
unpow294.2%
unpow294.2%
hypot-def99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 53.4%
Final simplification69.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.075) (fabs (sin th)) (if (<= (sin ky) 1e-161) (* (sin th) (/ ky kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.075) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-161) {
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 (sin(ky) <= (-0.075d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-161) 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 (Math.sin(ky) <= -0.075) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-161) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.075: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-161: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.075) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-161) 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 (sin(ky) <= -0.075) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-161) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.075], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-161], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.075:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-161}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0749999999999999972Initial program 99.6%
remove-double-neg99.6%
sin-neg99.6%
neg-mul-199.6%
*-commutative99.6%
associate-*l*99.6%
associate-*l/99.6%
associate-/r/99.6%
associate-*l/99.6%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.7%
add-sqr-sqrt1.5%
sqrt-unprod30.4%
pow230.4%
Applied egg-rr30.4%
unpow230.4%
rem-sqrt-square35.6%
Simplified35.6%
if -0.0749999999999999972 < (sin.f64 ky) < 1.00000000000000003e-161Initial program 85.0%
Taylor expanded in ky around 0 47.5%
Taylor expanded in kx around 0 29.7%
Taylor expanded in ky around 0 29.6%
associate-/l*30.3%
Simplified30.3%
associate-/r/30.3%
Applied egg-rr30.3%
if 1.00000000000000003e-161 < (sin.f64 ky) Initial program 99.7%
remove-double-neg99.7%
sin-neg99.7%
neg-mul-199.7%
*-commutative99.7%
associate-*l*99.7%
associate-*l/98.1%
associate-/r/98.1%
associate-*l/99.7%
associate-/r/99.6%
sin-neg99.6%
neg-mul-199.6%
associate-/r*99.6%
associate-/r/99.7%
Simplified99.8%
Taylor expanded in kx around 0 57.2%
Final simplification42.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.2e-160) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.2e-160) {
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 <= 1.2d-160) 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 <= 1.2e-160) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.2e-160: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.2e-160) 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 <= 1.2e-160) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.2e-160], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.2 \cdot 10^{-160}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.19999999999999995e-160Initial program 91.3%
Taylor expanded in ky around 0 29.8%
Taylor expanded in kx around 0 18.6%
Taylor expanded in ky around 0 18.1%
associate-/l*18.6%
Simplified18.6%
associate-/r/18.5%
Applied egg-rr18.5%
if 1.19999999999999995e-160 < ky Initial program 99.8%
remove-double-neg99.8%
sin-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l/97.8%
associate-/r/97.8%
associate-*l/99.8%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in kx around 0 34.8%
Final simplification24.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8.6e-161) (/ ky (+ (* 0.16666666666666666 (* th kx)) (/ kx th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.6e-161) {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 8.6d-161) then
tmp = ky / ((0.16666666666666666d0 * (th * kx)) + (kx / th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.6e-161) {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8.6e-161: tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8.6e-161) tmp = Float64(ky / Float64(Float64(0.16666666666666666 * Float64(th * kx)) + Float64(kx / th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8.6e-161) tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8.6e-161], N[(ky / N[(N[(0.16666666666666666 * N[(th * kx), $MachinePrecision]), $MachinePrecision] + N[(kx / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8.6 \cdot 10^{-161}:\\
\;\;\;\;\frac{ky}{0.16666666666666666 \cdot \left(th \cdot kx\right) + \frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.59999999999999933e-161Initial program 91.3%
Taylor expanded in ky around 0 29.8%
Taylor expanded in kx around 0 18.6%
Taylor expanded in ky around 0 18.1%
associate-/l*18.6%
Simplified18.6%
Taylor expanded in th around 0 14.9%
if 8.59999999999999933e-161 < ky Initial program 99.8%
remove-double-neg99.8%
sin-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l/97.8%
associate-/r/97.8%
associate-*l/99.8%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in kx around 0 34.8%
Final simplification21.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.6e-76) (/ ky (+ (* 0.16666666666666666 (* th kx)) (/ kx th))) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.6e-76) {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
} 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 <= 2.6d-76) then
tmp = ky / ((0.16666666666666666d0 * (th * kx)) + (kx / th))
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.6e-76) {
tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th));
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.6e-76: tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.6e-76) tmp = Float64(ky / Float64(Float64(0.16666666666666666 * Float64(th * kx)) + Float64(kx / th))); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.6e-76) tmp = ky / ((0.16666666666666666 * (th * kx)) + (kx / th)); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.6e-76], N[(ky / N[(N[(0.16666666666666666 * N[(th * kx), $MachinePrecision]), $MachinePrecision] + N[(kx / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.6 \cdot 10^{-76}:\\
\;\;\;\;\frac{ky}{0.16666666666666666 \cdot \left(th \cdot kx\right) + \frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 2.6e-76Initial program 92.1%
Taylor expanded in ky around 0 30.5%
Taylor expanded in kx around 0 18.9%
Taylor expanded in ky around 0 18.4%
associate-/l*18.9%
Simplified18.9%
Taylor expanded in th around 0 14.5%
if 2.6e-76 < ky Initial program 99.8%
remove-double-neg99.8%
sin-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l/98.2%
associate-/r/98.2%
associate-*l/99.8%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in kx around 0 34.0%
Taylor expanded in th around 0 25.2%
Final simplification17.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.6e-76) (/ ky (/ kx th)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.6e-76) {
tmp = ky / (kx / th);
} 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 <= 2.6d-76) then
tmp = ky / (kx / th)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.6e-76) {
tmp = ky / (kx / th);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.6e-76: tmp = ky / (kx / th) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.6e-76) tmp = Float64(ky / Float64(kx / th)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.6e-76) tmp = ky / (kx / th); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.6e-76], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.6 \cdot 10^{-76}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 2.6e-76Initial program 92.1%
Taylor expanded in ky around 0 30.5%
Taylor expanded in kx around 0 18.9%
Taylor expanded in ky around 0 18.4%
associate-/l*18.9%
Simplified18.9%
Taylor expanded in th around 0 13.5%
associate-/l*14.0%
Simplified14.0%
if 2.6e-76 < ky Initial program 99.8%
remove-double-neg99.8%
sin-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l/98.2%
associate-/r/98.2%
associate-*l/99.8%
associate-/r/99.5%
sin-neg99.5%
neg-mul-199.5%
associate-/r*99.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in kx around 0 34.0%
Taylor expanded in th around 0 25.2%
Final simplification17.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 94.1%
remove-double-neg94.1%
sin-neg94.1%
neg-mul-194.1%
*-commutative94.1%
associate-*l*94.1%
associate-*l/91.9%
associate-/r/91.9%
associate-*l/94.1%
associate-/r/94.0%
sin-neg94.0%
neg-mul-194.0%
associate-/r*94.0%
associate-/r/94.1%
Simplified99.7%
Taylor expanded in kx around 0 25.8%
Taylor expanded in th around 0 17.5%
Final simplification17.5%
herbie shell --seed 2024026
(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)))