
(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 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 93.4%
+-commutative93.4%
unpow293.4%
unpow293.4%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))) (t_2 (/ t_1 (/ (sin kx) ky))))
(if (<= (sin ky) -1e-37)
t_1
(if (<= (sin ky) 2e-288)
t_2
(if (<= (sin ky) 1e-104)
(/ (* ky (sin th)) (sin kx))
(if (<= (sin ky) 1e-98) t_2 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double t_2 = t_1 / (sin(kx) / ky);
double tmp;
if (sin(ky) <= -1e-37) {
tmp = t_1;
} else if (sin(ky) <= 2e-288) {
tmp = t_2;
} else if (sin(ky) <= 1e-104) {
tmp = (ky * sin(th)) / sin(kx);
} else if (sin(ky) <= 1e-98) {
tmp = t_2;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = abs(sin(th))
t_2 = t_1 / (sin(kx) / ky)
if (sin(ky) <= (-1d-37)) then
tmp = t_1
else if (sin(ky) <= 2d-288) then
tmp = t_2
else if (sin(ky) <= 1d-104) then
tmp = (ky * sin(th)) / sin(kx)
else if (sin(ky) <= 1d-98) then
tmp = t_2
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(th));
double t_2 = t_1 / (Math.sin(kx) / ky);
double tmp;
if (Math.sin(ky) <= -1e-37) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-288) {
tmp = t_2;
} else if (Math.sin(ky) <= 1e-104) {
tmp = (ky * Math.sin(th)) / Math.sin(kx);
} else if (Math.sin(ky) <= 1e-98) {
tmp = t_2;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) t_2 = t_1 / (math.sin(kx) / ky) tmp = 0 if math.sin(ky) <= -1e-37: tmp = t_1 elif math.sin(ky) <= 2e-288: tmp = t_2 elif math.sin(ky) <= 1e-104: tmp = (ky * math.sin(th)) / math.sin(kx) elif math.sin(ky) <= 1e-98: tmp = t_2 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) t_2 = Float64(t_1 / Float64(sin(kx) / ky)) tmp = 0.0 if (sin(ky) <= -1e-37) tmp = t_1; elseif (sin(ky) <= 2e-288) tmp = t_2; elseif (sin(ky) <= 1e-104) tmp = Float64(Float64(ky * sin(th)) / sin(kx)); elseif (sin(ky) <= 1e-98) tmp = t_2; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); t_2 = t_1 / (sin(kx) / ky); tmp = 0.0; if (sin(ky) <= -1e-37) tmp = t_1; elseif (sin(ky) <= 2e-288) tmp = t_2; elseif (sin(ky) <= 1e-104) tmp = (ky * sin(th)) / sin(kx); elseif (sin(ky) <= 1e-98) tmp = t_2; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-37], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-288], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-104], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-98], t$95$2, N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
t_2 := \frac{t_1}{\frac{\sin kx}{ky}}\\
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-288}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq 10^{-104}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-98}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000007e-37Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.4%
sqrt-unprod26.6%
pow226.6%
Applied egg-rr26.6%
unpow226.6%
rem-sqrt-square35.7%
Simplified35.7%
if -1.00000000000000007e-37 < (sin.f64 ky) < 2.00000000000000012e-288 or 9.99999999999999927e-105 < (sin.f64 ky) < 9.99999999999999939e-99Initial program 79.1%
+-commutative79.1%
unpow279.1%
unpow279.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 42.0%
associate-/l*41.7%
Simplified41.7%
add-sqr-sqrt1.7%
sqrt-unprod29.4%
pow229.4%
Applied egg-rr53.2%
unpow229.4%
rem-sqrt-square16.4%
Simplified57.3%
if 2.00000000000000012e-288 < (sin.f64 ky) < 9.99999999999999927e-105Initial program 92.8%
+-commutative92.8%
unpow292.8%
unpow292.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 64.7%
if 9.99999999999999939e-99 < (sin.f64 ky) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 53.0%
Final simplification50.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.78)
(fabs (* (sin th) (/ (sin ky) (sin kx))))
(if (<= (sin th) -0.02)
(fabs (sin th))
(if (<= (sin th) 1e-16)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(/ (sin ky) (fabs (/ (sin kx) (sin th))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.78) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else if (sin(th) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(th) <= 1e-16) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(ky) / fabs((sin(kx) / sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.78) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(th) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= 1e-16) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(ky) / Math.abs((Math.sin(kx) / Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.78: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) elif math.sin(th) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= 1e-16: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(ky) / math.fabs((math.sin(kx) / math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.78) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); elseif (sin(th) <= -0.02) tmp = abs(sin(th)); elseif (sin(th) <= 1e-16) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(ky) / abs(Float64(sin(kx) / sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.78) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); elseif (sin(th) <= -0.02) tmp = abs(sin(th)); elseif (sin(th) <= 1e-16) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(ky) / abs((sin(kx) / sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.78], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 1e-16], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.78:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin th \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq 10^{-16}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.78000000000000003Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 19.9%
add-sqr-sqrt14.0%
sqrt-unprod21.0%
pow221.0%
*-commutative21.0%
Applied egg-rr21.0%
unpow221.0%
rem-sqrt-square31.3%
Simplified31.3%
if -0.78000000000000003 < (sin.f64 th) < -0.0200000000000000004Initial program 86.3%
+-commutative86.3%
unpow286.3%
unpow286.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 19.5%
add-sqr-sqrt0.0%
sqrt-unprod32.0%
pow232.0%
Applied egg-rr32.0%
unpow232.0%
rem-sqrt-square32.0%
Simplified32.0%
if -0.0200000000000000004 < (sin.f64 th) < 9.9999999999999998e-17Initial program 94.4%
associate-*l/90.2%
associate-*r/94.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 99.7%
if 9.9999999999999998e-17 < (sin.f64 th) Initial program 94.4%
associate-/r/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.4%
Simplified99.4%
div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 27.5%
add-sqr-sqrt26.5%
sqrt-unprod44.9%
pow244.9%
un-div-inv44.9%
Applied egg-rr44.9%
unpow244.9%
rem-sqrt-square47.1%
Simplified47.1%
Final simplification69.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.78)
(fabs (* (sin th) (/ (sin ky) (sin kx))))
(if (<= (sin th) -0.02)
(fabs (sin th))
(if (<= (sin th) 1e-16)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(/ (sin ky) (fabs (/ (sin kx) (sin th))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.78) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else if (sin(th) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(th) <= 1e-16) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = sin(ky) / fabs((sin(kx) / sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.78) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(th) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= 1e-16) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.sin(ky) / Math.abs((Math.sin(kx) / Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.78: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) elif math.sin(th) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= 1e-16: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.sin(ky) / math.fabs((math.sin(kx) / math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.78) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); elseif (sin(th) <= -0.02) tmp = abs(sin(th)); elseif (sin(th) <= 1e-16) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(sin(ky) / abs(Float64(sin(kx) / sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.78) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); elseif (sin(th) <= -0.02) tmp = abs(sin(th)); elseif (sin(th) <= 1e-16) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = sin(ky) / abs((sin(kx) / sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.78], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 1e-16], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.78:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin th \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq 10^{-16}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.78000000000000003Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 19.9%
add-sqr-sqrt14.0%
sqrt-unprod21.0%
pow221.0%
*-commutative21.0%
Applied egg-rr21.0%
unpow221.0%
rem-sqrt-square31.3%
Simplified31.3%
if -0.78000000000000003 < (sin.f64 th) < -0.0200000000000000004Initial program 86.3%
+-commutative86.3%
unpow286.3%
unpow286.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 19.5%
add-sqr-sqrt0.0%
sqrt-unprod32.0%
pow232.0%
Applied egg-rr32.0%
unpow232.0%
rem-sqrt-square32.0%
Simplified32.0%
if -0.0200000000000000004 < (sin.f64 th) < 9.9999999999999998e-17Initial program 94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 99.8%
if 9.9999999999999998e-17 < (sin.f64 th) Initial program 94.4%
associate-/r/94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.4%
Simplified99.4%
div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 27.5%
add-sqr-sqrt26.5%
sqrt-unprod44.9%
pow244.9%
un-div-inv44.9%
Applied egg-rr44.9%
unpow244.9%
rem-sqrt-square47.1%
Simplified47.1%
Final simplification69.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))) (t_2 (/ (sin kx) ky)))
(if (<= (sin ky) -1e-37)
t_1
(if (<= (sin ky) -5e-301)
(/ t_1 t_2)
(if (<= (sin ky) 2e-16) (/ (sin th) (fabs t_2)) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double t_2 = sin(kx) / ky;
double tmp;
if (sin(ky) <= -1e-37) {
tmp = t_1;
} else if (sin(ky) <= -5e-301) {
tmp = t_1 / t_2;
} else if (sin(ky) <= 2e-16) {
tmp = sin(th) / fabs(t_2);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = abs(sin(th))
t_2 = sin(kx) / ky
if (sin(ky) <= (-1d-37)) then
tmp = t_1
else if (sin(ky) <= (-5d-301)) then
tmp = t_1 / t_2
else if (sin(ky) <= 2d-16) then
tmp = sin(th) / abs(t_2)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(th));
double t_2 = Math.sin(kx) / ky;
double tmp;
if (Math.sin(ky) <= -1e-37) {
tmp = t_1;
} else if (Math.sin(ky) <= -5e-301) {
tmp = t_1 / t_2;
} else if (Math.sin(ky) <= 2e-16) {
tmp = Math.sin(th) / Math.abs(t_2);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) t_2 = math.sin(kx) / ky tmp = 0 if math.sin(ky) <= -1e-37: tmp = t_1 elif math.sin(ky) <= -5e-301: tmp = t_1 / t_2 elif math.sin(ky) <= 2e-16: tmp = math.sin(th) / math.fabs(t_2) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) t_2 = Float64(sin(kx) / ky) tmp = 0.0 if (sin(ky) <= -1e-37) tmp = t_1; elseif (sin(ky) <= -5e-301) tmp = Float64(t_1 / t_2); elseif (sin(ky) <= 2e-16) tmp = Float64(sin(th) / abs(t_2)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); t_2 = sin(kx) / ky; tmp = 0.0; if (sin(ky) <= -1e-37) tmp = t_1; elseif (sin(ky) <= -5e-301) tmp = t_1 / t_2; elseif (sin(ky) <= 2e-16) tmp = sin(th) / abs(t_2); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-37], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-301], N[(t$95$1 / t$95$2), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-16], N[(N[Sin[th], $MachinePrecision] / N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
t_2 := \frac{\sin kx}{ky}\\
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-301}:\\
\;\;\;\;\frac{t_1}{t_2}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\sin th}{\left|t_2\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000007e-37Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.4%
sqrt-unprod26.6%
pow226.6%
Applied egg-rr26.6%
unpow226.6%
rem-sqrt-square35.7%
Simplified35.7%
if -1.00000000000000007e-37 < (sin.f64 ky) < -5.00000000000000013e-301Initial program 79.2%
+-commutative79.2%
unpow279.2%
unpow279.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 40.2%
associate-/l*39.9%
Simplified39.9%
add-sqr-sqrt1.6%
sqrt-unprod31.7%
pow231.7%
Applied egg-rr48.6%
unpow231.7%
rem-sqrt-square18.3%
Simplified53.4%
if -5.00000000000000013e-301 < (sin.f64 ky) < 2e-16Initial program 92.3%
+-commutative92.3%
unpow292.3%
unpow292.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 51.5%
associate-/l*51.2%
Simplified51.2%
add-sqr-sqrt40.3%
sqrt-unprod59.9%
pow259.9%
Applied egg-rr59.9%
unpow259.9%
rem-sqrt-square80.2%
Simplified80.2%
if 2e-16 < (sin.f64 ky) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 56.3%
Final simplification55.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= (sin ky) -1e-37)
t_1
(if (<= (sin ky) 5e-304)
(* (/ (sin ky) (sin kx)) t_1)
(if (<= (sin ky) 2e-16)
(/ (sin th) (fabs (/ (sin kx) ky)))
(sin th))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (sin(ky) <= -1e-37) {
tmp = t_1;
} else if (sin(ky) <= 5e-304) {
tmp = (sin(ky) / sin(kx)) * t_1;
} else if (sin(ky) <= 2e-16) {
tmp = sin(th) / fabs((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) :: t_1
real(8) :: tmp
t_1 = abs(sin(th))
if (sin(ky) <= (-1d-37)) then
tmp = t_1
else if (sin(ky) <= 5d-304) then
tmp = (sin(ky) / sin(kx)) * t_1
else if (sin(ky) <= 2d-16) then
tmp = sin(th) / abs((sin(kx) / ky))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(Math.sin(th));
double tmp;
if (Math.sin(ky) <= -1e-37) {
tmp = t_1;
} else if (Math.sin(ky) <= 5e-304) {
tmp = (Math.sin(ky) / Math.sin(kx)) * t_1;
} else if (Math.sin(ky) <= 2e-16) {
tmp = Math.sin(th) / Math.abs((Math.sin(kx) / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if math.sin(ky) <= -1e-37: tmp = t_1 elif math.sin(ky) <= 5e-304: tmp = (math.sin(ky) / math.sin(kx)) * t_1 elif math.sin(ky) <= 2e-16: tmp = math.sin(th) / math.fabs((math.sin(kx) / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (sin(ky) <= -1e-37) tmp = t_1; elseif (sin(ky) <= 5e-304) tmp = Float64(Float64(sin(ky) / sin(kx)) * t_1); elseif (sin(ky) <= 2e-16) tmp = Float64(sin(th) / abs(Float64(sin(kx) / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (sin(ky) <= -1e-37) tmp = t_1; elseif (sin(ky) <= 5e-304) tmp = (sin(ky) / sin(kx)) * t_1; elseif (sin(ky) <= 2e-16) tmp = sin(th) / abs((sin(kx) / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-37], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-304], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-16], N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-304}:\\
\;\;\;\;\frac{\sin ky}{\sin kx} \cdot t_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\sin th}{\left|\frac{\sin kx}{ky}\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000007e-37Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.4%
sqrt-unprod26.6%
pow226.6%
Applied egg-rr26.6%
unpow226.6%
rem-sqrt-square35.7%
Simplified35.7%
if -1.00000000000000007e-37 < (sin.f64 ky) < 4.99999999999999965e-304Initial program 79.6%
+-commutative79.6%
unpow279.6%
unpow279.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 39.3%
add-sqr-sqrt1.5%
sqrt-unprod31.2%
pow231.2%
Applied egg-rr49.5%
unpow231.2%
rem-sqrt-square18.0%
Simplified54.2%
if 4.99999999999999965e-304 < (sin.f64 ky) < 2e-16Initial program 92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 52.2%
associate-/l*51.9%
Simplified51.9%
add-sqr-sqrt41.0%
sqrt-unprod60.8%
pow260.8%
Applied egg-rr60.8%
unpow260.8%
rem-sqrt-square79.9%
Simplified79.9%
if 2e-16 < (sin.f64 ky) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 56.3%
Final simplification55.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-42)
(fabs (sin th))
(if (<= (sin ky) -2e-281)
(fabs (* (sin th) (/ ky (sin kx))))
(if (<= (sin ky) 5e-99) (/ (* ky (sin th)) (sin kx)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-42) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -2e-281) {
tmp = fabs((sin(th) * (ky / sin(kx))));
} else if (sin(ky) <= 5e-99) {
tmp = (ky * sin(th)) / sin(kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-42)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-2d-281)) then
tmp = abs((sin(th) * (ky / sin(kx))))
else if (sin(ky) <= 5d-99) then
tmp = (ky * sin(th)) / sin(kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-42) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -2e-281) {
tmp = Math.abs((Math.sin(th) * (ky / Math.sin(kx))));
} else if (Math.sin(ky) <= 5e-99) {
tmp = (ky * Math.sin(th)) / Math.sin(kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-42: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -2e-281: tmp = math.fabs((math.sin(th) * (ky / math.sin(kx)))) elif math.sin(ky) <= 5e-99: tmp = (ky * math.sin(th)) / math.sin(kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-42) tmp = abs(sin(th)); elseif (sin(ky) <= -2e-281) tmp = abs(Float64(sin(th) * Float64(ky / sin(kx)))); elseif (sin(ky) <= 5e-99) tmp = Float64(Float64(ky * sin(th)) / sin(kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-42) tmp = abs(sin(th)); elseif (sin(ky) <= -2e-281) tmp = abs((sin(th) * (ky / sin(kx)))); elseif (sin(ky) <= 5e-99) tmp = (ky * sin(th)) / sin(kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-42], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-281], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-99], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-42}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-281}:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-99}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000004e-42Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.4%
sqrt-unprod26.3%
pow226.3%
Applied egg-rr26.3%
unpow226.3%
rem-sqrt-square35.2%
Simplified35.2%
if -1.00000000000000004e-42 < (sin.f64 ky) < -2e-281Initial program 78.5%
+-commutative78.5%
unpow278.5%
unpow278.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 39.7%
associate-/l*39.5%
Simplified39.5%
add-sqr-sqrt28.9%
sqrt-unprod40.1%
pow240.1%
associate-/r/40.1%
*-commutative40.1%
Applied egg-rr40.1%
unpow240.1%
rem-sqrt-square53.7%
*-commutative53.7%
associate-*l/50.5%
associate-*r/53.8%
Simplified53.8%
if -2e-281 < (sin.f64 ky) < 4.99999999999999969e-99Initial program 89.8%
+-commutative89.8%
unpow289.8%
unpow289.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 64.5%
if 4.99999999999999969e-99 < (sin.f64 ky) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 52.4%
Final simplification49.6%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 93.4%
associate-*l/91.2%
associate-*r/93.3%
+-commutative93.3%
unpow293.3%
unpow293.3%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (or (<= th -2.55) (not (<= th 9.5)))
(/ (* ky (sin th)) t_1)
(* (/ (sin ky) t_1) th))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if ((th <= -2.55) || !(th <= 9.5)) {
tmp = (ky * sin(th)) / t_1;
} else {
tmp = (sin(ky) / t_1) * th;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if ((th <= -2.55) || !(th <= 9.5)) {
tmp = (ky * Math.sin(th)) / t_1;
} else {
tmp = (Math.sin(ky) / t_1) * th;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if (th <= -2.55) or not (th <= 9.5): tmp = (ky * math.sin(th)) / t_1 else: tmp = (math.sin(ky) / t_1) * th return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if ((th <= -2.55) || !(th <= 9.5)) tmp = Float64(Float64(ky * sin(th)) / t_1); else tmp = Float64(Float64(sin(ky) / t_1) * th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if ((th <= -2.55) || ~((th <= 9.5))) tmp = (ky * sin(th)) / t_1; else tmp = (sin(ky) / t_1) * th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[Or[LessEqual[th, -2.55], N[Not[LessEqual[th, 9.5]], $MachinePrecision]], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;th \leq -2.55 \lor \neg \left(th \leq 9.5\right):\\
\;\;\;\;\frac{ky \cdot \sin th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\end{array}
\end{array}
if th < -2.5499999999999998 or 9.5 < th Initial program 92.2%
associate-*l/92.3%
+-commutative92.3%
unpow292.3%
unpow292.3%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 53.1%
if -2.5499999999999998 < th < 9.5Initial program 94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 98.5%
Final simplification76.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-71) (fabs (sin th)) (if (<= (sin ky) 5e-99) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-71) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-99) {
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) <= (-1d-71)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-99) 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) <= -1e-71) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-99) {
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) <= -1e-71: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-99: 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) <= -1e-71) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-99) 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) <= -1e-71) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-99) 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], -1e-71], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-99], 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 -1 \cdot 10^{-71}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-99}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.9999999999999992e-72Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt1.3%
sqrt-unprod25.2%
pow225.2%
Applied egg-rr25.2%
unpow225.2%
rem-sqrt-square34.7%
Simplified34.7%
if -9.9999999999999992e-72 < (sin.f64 ky) < 4.99999999999999969e-99Initial program 82.8%
+-commutative82.8%
unpow282.8%
unpow282.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 52.2%
if 4.99999999999999969e-99 < (sin.f64 ky) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 52.4%
Final simplification46.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-71) (fabs (sin th)) (if (<= (sin ky) 5e-99) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-71) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-99) {
tmp = sin(th) / (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) <= (-1d-71)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-99) then
tmp = sin(th) / (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) <= -1e-71) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-99) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-71: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-99: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-71) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-99) tmp = Float64(sin(th) / 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) <= -1e-71) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-99) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-71], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-99], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-71}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-99}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.9999999999999992e-72Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt1.3%
sqrt-unprod25.2%
pow225.2%
Applied egg-rr25.2%
unpow225.2%
rem-sqrt-square34.7%
Simplified34.7%
if -9.9999999999999992e-72 < (sin.f64 ky) < 4.99999999999999969e-99Initial program 82.8%
+-commutative82.8%
unpow282.8%
unpow282.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 52.5%
associate-/l*52.3%
Simplified52.3%
if 4.99999999999999969e-99 < (sin.f64 ky) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 52.4%
Final simplification46.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-57) (fabs (sin th)) (if (<= (sin ky) 5e-99) (/ (* ky (sin th)) (sin kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-57) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-99) {
tmp = (ky * sin(th)) / sin(kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-57)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-99) then
tmp = (ky * sin(th)) / sin(kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-57) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-99) {
tmp = (ky * Math.sin(th)) / Math.sin(kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-57: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-99: tmp = (ky * math.sin(th)) / math.sin(kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-57) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-99) tmp = Float64(Float64(ky * sin(th)) / sin(kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-57) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-99) tmp = (ky * sin(th)) / sin(kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-57], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-99], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-57}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-99}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.99999999999999955e-58Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.4%
sqrt-unprod25.6%
pow225.6%
Applied egg-rr25.6%
unpow225.6%
rem-sqrt-square34.2%
Simplified34.2%
if -9.99999999999999955e-58 < (sin.f64 ky) < 4.99999999999999969e-99Initial program 83.1%
+-commutative83.1%
unpow283.1%
unpow283.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 52.5%
if 4.99999999999999969e-99 < (sin.f64 ky) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 52.4%
Final simplification46.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= ky -1.6e-103)
t_1
(if (<= ky -6.9e-152)
(/ ky (* (sin kx) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= ky -1e-228)
t_1
(if (<= ky 5e-97)
(* th (fabs (/ ky (sin kx))))
(if (<= ky 940000000000.0) (sin th) t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (ky <= -1.6e-103) {
tmp = t_1;
} else if (ky <= -6.9e-152) {
tmp = ky / (sin(kx) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (ky <= -1e-228) {
tmp = t_1;
} else if (ky <= 5e-97) {
tmp = th * fabs((ky / sin(kx)));
} else if (ky <= 940000000000.0) {
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 = abs(sin(th))
if (ky <= (-1.6d-103)) then
tmp = t_1
else if (ky <= (-6.9d-152)) then
tmp = ky / (sin(kx) * ((1.0d0 / th) + (th * 0.16666666666666666d0)))
else if (ky <= (-1d-228)) then
tmp = t_1
else if (ky <= 5d-97) then
tmp = th * abs((ky / sin(kx)))
else if (ky <= 940000000000.0d0) 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.abs(Math.sin(th));
double tmp;
if (ky <= -1.6e-103) {
tmp = t_1;
} else if (ky <= -6.9e-152) {
tmp = ky / (Math.sin(kx) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (ky <= -1e-228) {
tmp = t_1;
} else if (ky <= 5e-97) {
tmp = th * Math.abs((ky / Math.sin(kx)));
} else if (ky <= 940000000000.0) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if ky <= -1.6e-103: tmp = t_1 elif ky <= -6.9e-152: tmp = ky / (math.sin(kx) * ((1.0 / th) + (th * 0.16666666666666666))) elif ky <= -1e-228: tmp = t_1 elif ky <= 5e-97: tmp = th * math.fabs((ky / math.sin(kx))) elif ky <= 940000000000.0: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (ky <= -1.6e-103) tmp = t_1; elseif (ky <= -6.9e-152) tmp = Float64(ky / Float64(sin(kx) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (ky <= -1e-228) tmp = t_1; elseif (ky <= 5e-97) tmp = Float64(th * abs(Float64(ky / sin(kx)))); elseif (ky <= 940000000000.0) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (ky <= -1.6e-103) tmp = t_1; elseif (ky <= -6.9e-152) tmp = ky / (sin(kx) * ((1.0 / th) + (th * 0.16666666666666666))); elseif (ky <= -1e-228) tmp = t_1; elseif (ky <= 5e-97) tmp = th * abs((ky / sin(kx))); elseif (ky <= 940000000000.0) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ky, -1.6e-103], t$95$1, If[LessEqual[ky, -6.9e-152], N[(ky / N[(N[Sin[kx], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, -1e-228], t$95$1, If[LessEqual[ky, 5e-97], N[(th * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 940000000000.0], N[Sin[th], $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;ky \leq -1.6 \cdot 10^{-103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -6.9 \cdot 10^{-152}:\\
\;\;\;\;\frac{ky}{\sin kx \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;ky \leq -1 \cdot 10^{-228}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 5 \cdot 10^{-97}:\\
\;\;\;\;th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;ky \leq 940000000000:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if ky < -1.59999999999999988e-103 or -6.90000000000000039e-152 < ky < -1.00000000000000003e-228 or 9.4e11 < ky Initial program 94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 20.4%
add-sqr-sqrt10.6%
sqrt-unprod26.7%
pow226.7%
Applied egg-rr26.7%
unpow226.7%
rem-sqrt-square32.2%
Simplified32.2%
if -1.59999999999999988e-103 < ky < -6.90000000000000039e-152Initial program 100.0%
associate-/r/100.0%
+-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-def100.0%
Simplified100.0%
div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in th around 0 57.0%
*-commutative57.0%
Simplified57.0%
Taylor expanded in ky around 0 57.7%
if -1.00000000000000003e-228 < ky < 4.9999999999999995e-97Initial program 87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 57.6%
Taylor expanded in ky around 0 37.5%
add-sqr-sqrt20.0%
sqrt-unprod41.3%
pow241.3%
Applied egg-rr41.3%
unpow241.3%
rem-sqrt-square45.9%
Simplified45.9%
if 4.9999999999999995e-97 < ky < 9.4e11Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in kx around 0 50.5%
Final simplification37.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (fabs (sin th))))
(if (<= ky -4.5e-104)
t_1
(if (<= ky -1.05e-150)
(/ ky (* (sin kx) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= ky -3e-205)
t_1
(if (<= ky 3.6e-166)
(/ (* ky (sin th)) kx)
(if (<= ky 940000000000.0) (sin th) t_1)))))))
double code(double kx, double ky, double th) {
double t_1 = fabs(sin(th));
double tmp;
if (ky <= -4.5e-104) {
tmp = t_1;
} else if (ky <= -1.05e-150) {
tmp = ky / (sin(kx) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (ky <= -3e-205) {
tmp = t_1;
} else if (ky <= 3.6e-166) {
tmp = (ky * sin(th)) / kx;
} else if (ky <= 940000000000.0) {
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 = abs(sin(th))
if (ky <= (-4.5d-104)) then
tmp = t_1
else if (ky <= (-1.05d-150)) then
tmp = ky / (sin(kx) * ((1.0d0 / th) + (th * 0.16666666666666666d0)))
else if (ky <= (-3d-205)) then
tmp = t_1
else if (ky <= 3.6d-166) then
tmp = (ky * sin(th)) / kx
else if (ky <= 940000000000.0d0) 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.abs(Math.sin(th));
double tmp;
if (ky <= -4.5e-104) {
tmp = t_1;
} else if (ky <= -1.05e-150) {
tmp = ky / (Math.sin(kx) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (ky <= -3e-205) {
tmp = t_1;
} else if (ky <= 3.6e-166) {
tmp = (ky * Math.sin(th)) / kx;
} else if (ky <= 940000000000.0) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.fabs(math.sin(th)) tmp = 0 if ky <= -4.5e-104: tmp = t_1 elif ky <= -1.05e-150: tmp = ky / (math.sin(kx) * ((1.0 / th) + (th * 0.16666666666666666))) elif ky <= -3e-205: tmp = t_1 elif ky <= 3.6e-166: tmp = (ky * math.sin(th)) / kx elif ky <= 940000000000.0: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = abs(sin(th)) tmp = 0.0 if (ky <= -4.5e-104) tmp = t_1; elseif (ky <= -1.05e-150) tmp = Float64(ky / Float64(sin(kx) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (ky <= -3e-205) tmp = t_1; elseif (ky <= 3.6e-166) tmp = Float64(Float64(ky * sin(th)) / kx); elseif (ky <= 940000000000.0) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = abs(sin(th)); tmp = 0.0; if (ky <= -4.5e-104) tmp = t_1; elseif (ky <= -1.05e-150) tmp = ky / (sin(kx) * ((1.0 / th) + (th * 0.16666666666666666))); elseif (ky <= -3e-205) tmp = t_1; elseif (ky <= 3.6e-166) tmp = (ky * sin(th)) / kx; elseif (ky <= 940000000000.0) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[ky, -4.5e-104], t$95$1, If[LessEqual[ky, -1.05e-150], N[(ky / N[(N[Sin[kx], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, -3e-205], t$95$1, If[LessEqual[ky, 3.6e-166], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision], If[LessEqual[ky, 940000000000.0], N[Sin[th], $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left|\sin th\right|\\
\mathbf{if}\;ky \leq -4.5 \cdot 10^{-104}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -1.05 \cdot 10^{-150}:\\
\;\;\;\;\frac{ky}{\sin kx \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;ky \leq -3 \cdot 10^{-205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 3.6 \cdot 10^{-166}:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\mathbf{elif}\;ky \leq 940000000000:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if ky < -4.4999999999999997e-104 or -1.0500000000000001e-150 < ky < -3e-205 or 9.4e11 < ky Initial program 95.7%
+-commutative95.7%
unpow295.7%
unpow295.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 21.1%
add-sqr-sqrt11.1%
sqrt-unprod27.1%
pow227.1%
Applied egg-rr27.1%
unpow227.1%
rem-sqrt-square32.8%
Simplified32.8%
if -4.4999999999999997e-104 < ky < -1.0500000000000001e-150Initial program 100.0%
associate-/r/100.0%
+-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-def100.0%
Simplified100.0%
div-inv99.3%
Applied egg-rr99.3%
Taylor expanded in th around 0 57.0%
*-commutative57.0%
Simplified57.0%
Taylor expanded in ky around 0 57.7%
if -3e-205 < ky < 3.6000000000000001e-166Initial program 82.3%
+-commutative82.3%
unpow282.3%
unpow282.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 61.9%
associate-/l*61.7%
Simplified61.7%
Taylor expanded in kx around 0 46.3%
if 3.6000000000000001e-166 < ky < 9.4e11Initial program 95.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 43.2%
Final simplification37.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky -10500000000.0) (sin th) (if (<= ky 4.2e-174) (fabs (* th (/ ky kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -10500000000.0) {
tmp = sin(th);
} else if (ky <= 4.2e-174) {
tmp = fabs((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 <= (-10500000000.0d0)) then
tmp = sin(th)
else if (ky <= 4.2d-174) then
tmp = abs((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 <= -10500000000.0) {
tmp = Math.sin(th);
} else if (ky <= 4.2e-174) {
tmp = Math.abs((th * (ky / kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -10500000000.0: tmp = math.sin(th) elif ky <= 4.2e-174: tmp = math.fabs((th * (ky / kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -10500000000.0) tmp = sin(th); elseif (ky <= 4.2e-174) tmp = abs(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 <= -10500000000.0) tmp = sin(th); elseif (ky <= 4.2e-174) tmp = abs((th * (ky / kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -10500000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 4.2e-174], N[Abs[N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -10500000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 4.2 \cdot 10^{-174}:\\
\;\;\;\;\left|th \cdot \frac{ky}{kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.05e10 or 4.20000000000000021e-174 < ky Initial program 98.7%
+-commutative98.7%
unpow298.7%
unpow298.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 29.3%
if -1.05e10 < ky < 4.20000000000000021e-174Initial program 82.4%
+-commutative82.4%
unpow282.4%
unpow282.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 48.9%
Taylor expanded in ky around 0 29.6%
Taylor expanded in kx around 0 27.9%
add-sqr-sqrt25.9%
sqrt-unprod27.2%
pow227.2%
*-commutative27.2%
Applied egg-rr27.2%
unpow227.2%
rem-sqrt-square29.5%
Simplified29.5%
Final simplification29.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky -6200000000.0) (sin th) (if (<= ky 1.9e-173) (* th (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -6200000000.0) {
tmp = sin(th);
} else if (ky <= 1.9e-173) {
tmp = 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 <= (-6200000000.0d0)) then
tmp = sin(th)
else if (ky <= 1.9d-173) then
tmp = 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 <= -6200000000.0) {
tmp = Math.sin(th);
} else if (ky <= 1.9e-173) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -6200000000.0: tmp = math.sin(th) elif ky <= 1.9e-173: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -6200000000.0) tmp = sin(th); elseif (ky <= 1.9e-173) tmp = Float64(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 <= -6200000000.0) tmp = sin(th); elseif (ky <= 1.9e-173) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -6200000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.9e-173], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -6200000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.9 \cdot 10^{-173}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.2e9 or 1.90000000000000015e-173 < ky Initial program 98.7%
+-commutative98.7%
unpow298.7%
unpow298.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 29.5%
if -6.2e9 < ky < 1.90000000000000015e-173Initial program 82.6%
+-commutative82.6%
unpow282.6%
unpow282.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 49.5%
Taylor expanded in ky around 0 30.4%
Final simplification29.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky -10500000000.0) (sin th) (if (<= ky 3.2e-166) (/ (sin th) (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -10500000000.0) {
tmp = sin(th);
} else if (ky <= 3.2e-166) {
tmp = sin(th) / (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 (ky <= (-10500000000.0d0)) then
tmp = sin(th)
else if (ky <= 3.2d-166) then
tmp = sin(th) / (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 (ky <= -10500000000.0) {
tmp = Math.sin(th);
} else if (ky <= 3.2e-166) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -10500000000.0: tmp = math.sin(th) elif ky <= 3.2e-166: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -10500000000.0) tmp = sin(th); elseif (ky <= 3.2e-166) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -10500000000.0) tmp = sin(th); elseif (ky <= 3.2e-166) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -10500000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.2e-166], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -10500000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.2 \cdot 10^{-166}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.05e10 or 3.20000000000000001e-166 < ky Initial program 98.7%
+-commutative98.7%
unpow298.7%
unpow298.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 29.6%
if -1.05e10 < ky < 3.20000000000000001e-166Initial program 82.8%
+-commutative82.8%
unpow282.8%
unpow282.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 48.9%
associate-/l*48.7%
Simplified48.7%
Taylor expanded in kx around 0 33.8%
associate-/l*33.6%
Simplified33.6%
Final simplification30.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky -10500000000.0) (sin th) (if (<= ky 3.8e-166) (/ (* ky (sin th)) kx) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -10500000000.0) {
tmp = sin(th);
} else if (ky <= 3.8e-166) {
tmp = (ky * sin(th)) / kx;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-10500000000.0d0)) then
tmp = sin(th)
else if (ky <= 3.8d-166) then
tmp = (ky * sin(th)) / kx
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -10500000000.0) {
tmp = Math.sin(th);
} else if (ky <= 3.8e-166) {
tmp = (ky * Math.sin(th)) / kx;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -10500000000.0: tmp = math.sin(th) elif ky <= 3.8e-166: tmp = (ky * math.sin(th)) / kx else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -10500000000.0) tmp = sin(th); elseif (ky <= 3.8e-166) tmp = Float64(Float64(ky * sin(th)) / kx); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -10500000000.0) tmp = sin(th); elseif (ky <= 3.8e-166) tmp = (ky * sin(th)) / kx; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -10500000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.8e-166], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -10500000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.8 \cdot 10^{-166}:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.05e10 or 3.79999999999999982e-166 < ky Initial program 98.7%
+-commutative98.7%
unpow298.7%
unpow298.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 29.6%
if -1.05e10 < ky < 3.79999999999999982e-166Initial program 82.8%
+-commutative82.8%
unpow282.8%
unpow282.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 48.9%
associate-/l*48.7%
Simplified48.7%
Taylor expanded in kx around 0 33.8%
Final simplification31.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -10500000000.0) (sin th) (if (<= ky 2.8e-166) (/ (* ky th) kx) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -10500000000.0) {
tmp = sin(th);
} else if (ky <= 2.8e-166) {
tmp = (ky * th) / kx;
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-10500000000.0d0)) then
tmp = sin(th)
else if (ky <= 2.8d-166) then
tmp = (ky * th) / kx
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -10500000000.0) {
tmp = Math.sin(th);
} else if (ky <= 2.8e-166) {
tmp = (ky * th) / kx;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -10500000000.0: tmp = math.sin(th) elif ky <= 2.8e-166: tmp = (ky * th) / kx else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -10500000000.0) tmp = sin(th); elseif (ky <= 2.8e-166) tmp = Float64(Float64(ky * th) / kx); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -10500000000.0) tmp = sin(th); elseif (ky <= 2.8e-166) tmp = (ky * th) / kx; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -10500000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 2.8e-166], N[(N[(ky * th), $MachinePrecision] / kx), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -10500000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.8 \cdot 10^{-166}:\\
\;\;\;\;\frac{ky \cdot th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.05e10 or 2.7999999999999999e-166 < ky Initial program 98.7%
+-commutative98.7%
unpow298.7%
unpow298.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 29.6%
if -1.05e10 < ky < 2.7999999999999999e-166Initial program 82.8%
+-commutative82.8%
unpow282.8%
unpow282.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 48.9%
Taylor expanded in ky around 0 30.1%
Taylor expanded in kx around 0 28.6%
Final simplification29.3%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -1.3e-8) (not (<= ky 1.8e-160))) (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666))) (/ (* ky th) kx)))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1.3e-8) || !(ky <= 1.8e-160)) {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
} else {
tmp = (ky * th) / 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 ((ky <= (-1.3d-8)) .or. (.not. (ky <= 1.8d-160))) then
tmp = 1.0d0 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
else
tmp = (ky * th) / kx
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1.3e-8) || !(ky <= 1.8e-160)) {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
} else {
tmp = (ky * th) / kx;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -1.3e-8) or not (ky <= 1.8e-160): tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)) else: tmp = (ky * th) / kx return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -1.3e-8) || !(ky <= 1.8e-160)) tmp = Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); else tmp = Float64(Float64(ky * th) / kx); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -1.3e-8) || ~((ky <= 1.8e-160))) tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); else tmp = (ky * th) / kx; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -1.3e-8], N[Not[LessEqual[ky, 1.8e-160]], $MachinePrecision]], N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(ky * th), $MachinePrecision] / kx), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.3 \cdot 10^{-8} \lor \neg \left(ky \leq 1.8 \cdot 10^{-160}\right):\\
\;\;\;\;\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot th}{kx}\\
\end{array}
\end{array}
if ky < -1.3000000000000001e-8 or 1.7999999999999999e-160 < ky Initial program 99.3%
associate-/r/99.2%
+-commutative99.2%
unpow299.2%
unpow299.2%
hypot-def99.5%
Simplified99.5%
div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in kx around 0 18.5%
if -1.3000000000000001e-8 < ky < 1.7999999999999999e-160Initial program 81.9%
+-commutative81.9%
unpow281.9%
unpow281.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 49.6%
Taylor expanded in ky around 0 30.9%
Taylor expanded in kx around 0 29.4%
Final simplification22.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1.1e-6) th (if (<= ky 1.7e-160) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1.1e-6) {
tmp = th;
} else if (ky <= 1.7e-160) {
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 <= (-1.1d-6)) then
tmp = th
else if (ky <= 1.7d-160) 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 <= -1.1e-6) {
tmp = th;
} else if (ky <= 1.7e-160) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1.1e-6: tmp = th elif ky <= 1.7e-160: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1.1e-6) tmp = th; elseif (ky <= 1.7e-160) 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 <= -1.1e-6) tmp = th; elseif (ky <= 1.7e-160) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1.1e-6], th, If[LessEqual[ky, 1.7e-160], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.1 \cdot 10^{-6}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 1.7 \cdot 10^{-160}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -1.1000000000000001e-6 or 1.70000000000000011e-160 < ky Initial program 99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 55.1%
Taylor expanded in kx around 0 18.2%
if -1.1000000000000001e-6 < ky < 1.70000000000000011e-160Initial program 81.9%
+-commutative81.9%
unpow281.9%
unpow281.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 49.6%
Taylor expanded in ky around 0 30.9%
Taylor expanded in kx around 0 29.4%
Final simplification21.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5.5e-7) th (if (<= ky 1.8e-160) (/ (* ky th) kx) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.5e-7) {
tmp = th;
} else if (ky <= 1.8e-160) {
tmp = (ky * th) / 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 <= (-5.5d-7)) then
tmp = th
else if (ky <= 1.8d-160) then
tmp = (ky * th) / kx
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.5e-7) {
tmp = th;
} else if (ky <= 1.8e-160) {
tmp = (ky * th) / kx;
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5.5e-7: tmp = th elif ky <= 1.8e-160: tmp = (ky * th) / kx else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5.5e-7) tmp = th; elseif (ky <= 1.8e-160) tmp = Float64(Float64(ky * th) / kx); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -5.5e-7) tmp = th; elseif (ky <= 1.8e-160) tmp = (ky * th) / kx; else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5.5e-7], th, If[LessEqual[ky, 1.8e-160], N[(N[(ky * th), $MachinePrecision] / kx), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5.5 \cdot 10^{-7}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 1.8 \cdot 10^{-160}:\\
\;\;\;\;\frac{ky \cdot th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -5.5000000000000003e-7 or 1.7999999999999999e-160 < ky Initial program 99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 55.1%
Taylor expanded in kx around 0 18.2%
if -5.5000000000000003e-7 < ky < 1.7999999999999999e-160Initial program 81.9%
+-commutative81.9%
unpow281.9%
unpow281.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 49.6%
Taylor expanded in ky around 0 30.9%
Taylor expanded in kx around 0 29.4%
Final simplification22.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 93.4%
+-commutative93.4%
unpow293.4%
unpow293.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 53.3%
Taylor expanded in kx around 0 13.4%
Final simplification13.4%
herbie shell --seed 2023178
(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)))