
(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 17 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.3%
+-commutative93.3%
unpow293.3%
unpow293.3%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(/ (fabs (* (sin ky) (sin th))) (sin ky))
(if (<= (sin ky) -5e-55)
(fabs (/ (sin ky) (/ (sin kx) (sin th))))
(if (<= (sin ky) -2e-63)
(/ (* ky th) (hypot (sin ky) (sin kx)))
(if (<= (sin ky) -1e-303)
(* (sin th) (* (sin ky) (/ 1.0 (sin kx))))
(if (<= (sin ky) 2e-51)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs((sin(ky) * sin(th))) / sin(ky);
} else if (sin(ky) <= -5e-55) {
tmp = fabs((sin(ky) / (sin(kx) / sin(th))));
} else if (sin(ky) <= -2e-63) {
tmp = (ky * th) / hypot(sin(ky), sin(kx));
} else if (sin(ky) <= -1e-303) {
tmp = sin(th) * (sin(ky) * (1.0 / sin(kx)));
} else if (sin(ky) <= 2e-51) {
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 (Math.sin(ky) <= -0.05) {
tmp = Math.abs((Math.sin(ky) * Math.sin(th))) / Math.sin(ky);
} else if (Math.sin(ky) <= -5e-55) {
tmp = Math.abs((Math.sin(ky) / (Math.sin(kx) / Math.sin(th))));
} else if (Math.sin(ky) <= -2e-63) {
tmp = (ky * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else if (Math.sin(ky) <= -1e-303) {
tmp = Math.sin(th) * (Math.sin(ky) * (1.0 / Math.sin(kx)));
} else if (Math.sin(ky) <= 2e-51) {
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.05: tmp = math.fabs((math.sin(ky) * math.sin(th))) / math.sin(ky) elif math.sin(ky) <= -5e-55: tmp = math.fabs((math.sin(ky) / (math.sin(kx) / math.sin(th)))) elif math.sin(ky) <= -2e-63: tmp = (ky * th) / math.hypot(math.sin(ky), math.sin(kx)) elif math.sin(ky) <= -1e-303: tmp = math.sin(th) * (math.sin(ky) * (1.0 / math.sin(kx))) elif math.sin(ky) <= 2e-51: 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.05) tmp = Float64(abs(Float64(sin(ky) * sin(th))) / sin(ky)); elseif (sin(ky) <= -5e-55) tmp = abs(Float64(sin(ky) / Float64(sin(kx) / sin(th)))); elseif (sin(ky) <= -2e-63) tmp = Float64(Float64(ky * th) / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= -1e-303) tmp = Float64(sin(th) * Float64(sin(ky) * Float64(1.0 / sin(kx)))); elseif (sin(ky) <= 2e-51) 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.05) tmp = abs((sin(ky) * sin(th))) / sin(ky); elseif (sin(ky) <= -5e-55) tmp = abs((sin(ky) / (sin(kx) / sin(th)))); elseif (sin(ky) <= -2e-63) tmp = (ky * th) / hypot(sin(ky), sin(kx)); elseif (sin(ky) <= -1e-303) tmp = sin(th) * (sin(ky) * (1.0 / sin(kx))); elseif (sin(ky) <= 2e-51) 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.05], N[(N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-55], N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-63], N[(N[(ky * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-303], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-51], 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.05:\\
\;\;\;\;\frac{\left|\sin ky \cdot \sin th\right|}{\sin ky}\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-55}:\\
\;\;\;\;\left|\frac{\sin ky}{\frac{\sin kx}{\sin th}}\right|\\
\mathbf{elif}\;\sin ky \leq -2 \cdot 10^{-63}:\\
\;\;\;\;\frac{ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-303}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \frac{1}{\sin kx}\right)\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt0.9%
sqrt-unprod31.7%
pow231.7%
Applied egg-rr31.7%
unpow231.7%
rem-sqrt-square34.1%
Simplified34.1%
if -0.050000000000000003 < (sin.f64 ky) < -5.0000000000000002e-55Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 34.0%
add-sqr-sqrt22.2%
sqrt-unprod47.3%
pow247.3%
*-commutative47.3%
Applied egg-rr47.3%
unpow247.3%
rem-sqrt-square55.8%
*-commutative55.8%
associate-/r/55.7%
Simplified55.7%
if -5.0000000000000002e-55 < (sin.f64 ky) < -2.00000000000000013e-63Initial program 99.5%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 70.3%
Taylor expanded in ky around 0 70.3%
if -2.00000000000000013e-63 < (sin.f64 ky) < -9.99999999999999931e-304Initial program 79.6%
+-commutative79.6%
unpow279.6%
unpow279.6%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 58.1%
clear-num58.1%
associate-/r/58.1%
Applied egg-rr58.1%
if -9.99999999999999931e-304 < (sin.f64 ky) < 2e-51Initial program 90.5%
+-commutative90.5%
unpow290.5%
unpow290.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 44.6%
add-sqr-sqrt38.7%
sqrt-unprod63.8%
pow263.8%
Applied egg-rr63.8%
unpow263.8%
rem-sqrt-square88.3%
Simplified88.3%
if 2e-51 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 62.3%
Final simplification61.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.6)
(sin th)
(if (<= (sin th) -0.18)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(if (<= (sin th) -0.0065)
(fabs (/ (sin ky) (/ (sin kx) (sin th))))
(if (<= (sin th) 1e-16)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(/ (fabs (* (sin ky) (sin th))) (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.6) {
tmp = sin(th);
} else if (sin(th) <= -0.18) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else if (sin(th) <= -0.0065) {
tmp = fabs((sin(ky) / (sin(kx) / sin(th))));
} else if (sin(th) <= 1e-16) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = fabs((sin(ky) * sin(th))) / sin(ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.6) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= -0.18) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else if (Math.sin(th) <= -0.0065) {
tmp = Math.abs((Math.sin(ky) / (Math.sin(kx) / 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.abs((Math.sin(ky) * Math.sin(th))) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.6: tmp = math.sin(th) elif math.sin(th) <= -0.18: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) elif math.sin(th) <= -0.0065: tmp = math.fabs((math.sin(ky) / (math.sin(kx) / 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.fabs((math.sin(ky) * math.sin(th))) / math.sin(ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.6) tmp = sin(th); elseif (sin(th) <= -0.18) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); elseif (sin(th) <= -0.0065) tmp = abs(Float64(sin(ky) / Float64(sin(kx) / sin(th)))); elseif (sin(th) <= 1e-16) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(abs(Float64(sin(ky) * sin(th))) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.6) tmp = sin(th); elseif (sin(th) <= -0.18) tmp = sin(th) * abs((sin(ky) / sin(kx))); elseif (sin(th) <= -0.0065) tmp = abs((sin(ky) / (sin(kx) / sin(th)))); elseif (sin(th) <= 1e-16) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = abs((sin(ky) * sin(th))) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.6], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.18], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.0065], N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $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[Abs[N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.6:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq -0.18:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin th \leq -0.0065:\\
\;\;\;\;\left|\frac{\sin ky}{\frac{\sin kx}{\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{\left|\sin ky \cdot \sin th\right|}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.599999999999999978Initial program 92.8%
+-commutative92.8%
unpow292.8%
unpow292.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 36.3%
if -0.599999999999999978 < (sin.f64 th) < -0.17999999999999999Initial program 87.8%
+-commutative87.8%
unpow287.8%
unpow287.8%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 18.0%
add-sqr-sqrt10.1%
sqrt-unprod24.1%
pow224.1%
Applied egg-rr24.1%
unpow224.1%
rem-sqrt-square39.0%
Simplified39.0%
if -0.17999999999999999 < (sin.f64 th) < -0.0064999999999999997Initial program 92.5%
+-commutative92.5%
unpow292.5%
unpow292.5%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 24.6%
add-sqr-sqrt23.3%
sqrt-unprod30.1%
pow230.1%
*-commutative30.1%
Applied egg-rr30.1%
unpow230.1%
rem-sqrt-square36.3%
*-commutative36.3%
associate-/r/36.3%
Simplified36.3%
if -0.0064999999999999997 < (sin.f64 th) < 9.9999999999999998e-17Initial program 93.7%
associate-*l/90.4%
+-commutative90.4%
unpow290.4%
unpow290.4%
hypot-def91.1%
Simplified91.1%
Taylor expanded in th around 0 88.5%
expm1-log1p-u88.4%
expm1-udef23.0%
Applied egg-rr23.0%
expm1-def97.1%
expm1-log1p97.1%
*-commutative97.1%
associate-*l/88.5%
associate-*r/97.0%
Simplified97.0%
if 9.9999999999999998e-17 < (sin.f64 th) Initial program 95.2%
associate-*l/95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 23.9%
add-sqr-sqrt22.9%
sqrt-unprod40.4%
pow240.4%
Applied egg-rr40.4%
unpow240.4%
rem-sqrt-square41.5%
Simplified41.5%
Final simplification63.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-41)
(fabs (sin th))
(if (<= (sin ky) -1e-303)
(* (sin th) (* (sin ky) (/ 1.0 (sin kx))))
(if (<= (sin ky) 2e-51)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-41) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -1e-303) {
tmp = sin(th) * (sin(ky) * (1.0 / sin(kx)));
} else if (sin(ky) <= 2e-51) {
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) <= (-1d-41)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-1d-303)) then
tmp = sin(th) * (sin(ky) * (1.0d0 / sin(kx)))
else if (sin(ky) <= 2d-51) 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) <= -1e-41) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -1e-303) {
tmp = Math.sin(th) * (Math.sin(ky) * (1.0 / Math.sin(kx)));
} else if (Math.sin(ky) <= 2e-51) {
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) <= -1e-41: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -1e-303: tmp = math.sin(th) * (math.sin(ky) * (1.0 / math.sin(kx))) elif math.sin(ky) <= 2e-51: 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) <= -1e-41) tmp = abs(sin(th)); elseif (sin(ky) <= -1e-303) tmp = Float64(sin(th) * Float64(sin(ky) * Float64(1.0 / sin(kx)))); elseif (sin(ky) <= 2e-51) 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) <= -1e-41) tmp = abs(sin(th)); elseif (sin(ky) <= -1e-303) tmp = sin(th) * (sin(ky) * (1.0 / sin(kx))); elseif (sin(ky) <= 2e-51) 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], -1e-41], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-303], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-51], 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 -1 \cdot 10^{-41}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-303}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \frac{1}{\sin kx}\right)\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000001e-41Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.2%
sqrt-unprod22.5%
pow222.5%
associate-/l*22.5%
associate-/r/22.6%
Applied egg-rr22.6%
unpow222.6%
rem-sqrt-square24.5%
*-inverses24.5%
*-lft-identity24.5%
Simplified24.5%
if -1.00000000000000001e-41 < (sin.f64 ky) < -9.99999999999999931e-304Initial program 81.5%
+-commutative81.5%
unpow281.5%
unpow281.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 57.4%
clear-num57.4%
associate-/r/57.5%
Applied egg-rr57.5%
if -9.99999999999999931e-304 < (sin.f64 ky) < 2e-51Initial program 90.5%
+-commutative90.5%
unpow290.5%
unpow290.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 44.6%
add-sqr-sqrt38.7%
sqrt-unprod63.8%
pow263.8%
Applied egg-rr63.8%
unpow263.8%
rem-sqrt-square88.3%
Simplified88.3%
if 2e-51 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 62.3%
Final simplification58.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.05)
(* (/ (sin ky) t_1) th)
(if (<= (sin ky) 1e-6)
(/ (sin th) (* t_1 (+ (* ky 0.16666666666666666) (/ 1.0 ky))))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.05) {
tmp = (sin(ky) / t_1) * th;
} else if (sin(ky) <= 1e-6) {
tmp = sin(th) / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky)));
} else {
tmp = sin(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 (Math.sin(ky) <= -0.05) {
tmp = (Math.sin(ky) / t_1) * th;
} else if (Math.sin(ky) <= 1e-6) {
tmp = Math.sin(th) / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.05: tmp = (math.sin(ky) / t_1) * th elif math.sin(ky) <= 1e-6: tmp = math.sin(th) / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.05) tmp = Float64(Float64(sin(ky) / t_1) * th); elseif (sin(ky) <= 1e-6) tmp = Float64(sin(th) / Float64(t_1 * Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.05) tmp = (sin(ky) / t_1) * th; elseif (sin(ky) <= 1e-6) tmp = sin(th) / (t_1 * ((ky * 0.16666666666666666) + (1.0 / ky))); else tmp = sin(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[LessEqual[N[Sin[ky], $MachinePrecision], -0.05], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 * N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;\sin ky \leq 10^{-6}:\\
\;\;\;\;\frac{\sin th}{t_1 \cdot \left(ky \cdot 0.16666666666666666 + \frac{1}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 46.9%
associate-/l*46.9%
associate-/r/47.0%
Applied egg-rr47.0%
if -0.050000000000000003 < (sin.f64 ky) < 9.99999999999999955e-7Initial program 87.6%
+-commutative87.6%
unpow287.6%
unpow287.6%
hypot-def99.7%
Simplified99.7%
associate-*l/92.7%
associate-*r/99.6%
expm1-log1p-u99.6%
expm1-udef33.3%
Applied egg-rr33.3%
expm1-def99.6%
expm1-log1p99.6%
*-commutative99.6%
associate-/r/99.7%
Simplified99.7%
div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 98.7%
if 9.99999999999999955e-7 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 60.8%
Final simplification78.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.01)
(* (sin ky) (/ th t_1))
(if (<= (sin ky) 1e-6) (* (sin th) (/ ky t_1)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.01) {
tmp = sin(ky) * (th / t_1);
} else if (sin(ky) <= 1e-6) {
tmp = sin(th) * (ky / t_1);
} else {
tmp = sin(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 (Math.sin(ky) <= -0.01) {
tmp = Math.sin(ky) * (th / t_1);
} else if (Math.sin(ky) <= 1e-6) {
tmp = Math.sin(th) * (ky / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sin(ky) * (th / t_1) elif math.sin(ky) <= 1e-6: tmp = math.sin(th) * (ky / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(sin(ky) * Float64(th / t_1)); elseif (sin(ky) <= 1e-6) tmp = Float64(sin(th) * Float64(ky / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.01) tmp = sin(ky) * (th / t_1); elseif (sin(ky) <= 1e-6) tmp = sin(th) * (ky / t_1); else tmp = sin(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[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 46.0%
expm1-log1p-u45.2%
expm1-udef5.2%
Applied egg-rr5.2%
expm1-def45.2%
expm1-log1p46.1%
*-commutative46.1%
associate-*l/46.0%
associate-*r/45.9%
Simplified45.9%
if -0.0100000000000000002 < (sin.f64 ky) < 9.99999999999999955e-7Initial program 87.5%
associate-*l/84.8%
+-commutative84.8%
unpow284.8%
unpow284.8%
hypot-def92.6%
Simplified92.6%
Taylor expanded in ky around 0 92.2%
expm1-log1p-u92.1%
expm1-udef32.6%
*-commutative32.6%
associate-/l*32.6%
Applied egg-rr32.6%
expm1-def99.1%
expm1-log1p99.1%
associate-/r/99.3%
*-commutative99.3%
Simplified99.3%
if 9.99999999999999955e-7 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 60.8%
Final simplification78.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.01)
(* (/ (sin ky) t_1) th)
(if (<= (sin ky) 1e-6) (* (sin th) (/ ky t_1)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.01) {
tmp = (sin(ky) / t_1) * th;
} else if (sin(ky) <= 1e-6) {
tmp = sin(th) * (ky / t_1);
} else {
tmp = sin(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 (Math.sin(ky) <= -0.01) {
tmp = (Math.sin(ky) / t_1) * th;
} else if (Math.sin(ky) <= 1e-6) {
tmp = Math.sin(th) * (ky / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.01: tmp = (math.sin(ky) / t_1) * th elif math.sin(ky) <= 1e-6: tmp = math.sin(th) * (ky / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(Float64(sin(ky) / t_1) * th); elseif (sin(ky) <= 1e-6) tmp = Float64(sin(th) * Float64(ky / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.01) tmp = (sin(ky) / t_1) * th; elseif (sin(ky) <= 1e-6) tmp = sin(th) * (ky / t_1); else tmp = sin(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[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;\sin ky \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 46.0%
associate-/l*46.0%
associate-/r/46.1%
Applied egg-rr46.1%
if -0.0100000000000000002 < (sin.f64 ky) < 9.99999999999999955e-7Initial program 87.5%
associate-*l/84.8%
+-commutative84.8%
unpow284.8%
unpow284.8%
hypot-def92.6%
Simplified92.6%
Taylor expanded in ky around 0 92.2%
expm1-log1p-u92.1%
expm1-udef32.6%
*-commutative32.6%
associate-/l*32.6%
Applied egg-rr32.6%
expm1-def99.1%
expm1-log1p99.1%
associate-/r/99.3%
*-commutative99.3%
Simplified99.3%
if 9.99999999999999955e-7 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 60.8%
Final simplification78.0%
(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.3%
associate-*l/91.9%
associate-*r/93.2%
+-commutative93.2%
unpow293.2%
unpow293.2%
hypot-def99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -5e-171)
(fabs (sin th))
(if (<= (sin ky) 5e-163)
(/ (sin th) (/ kx ky))
(if (<= (sin ky) 2e-57) (/ th (/ (sin kx) ky)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-171) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-163) {
tmp = sin(th) / (kx / ky);
} else if (sin(ky) <= 2e-57) {
tmp = 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) <= (-5d-171)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-163) then
tmp = sin(th) / (kx / ky)
else if (sin(ky) <= 2d-57) then
tmp = 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) <= -5e-171) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-163) {
tmp = Math.sin(th) / (kx / ky);
} else if (Math.sin(ky) <= 2e-57) {
tmp = th / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-171: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-163: tmp = math.sin(th) / (kx / ky) elif math.sin(ky) <= 2e-57: tmp = th / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-171) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-163) tmp = Float64(sin(th) / Float64(kx / ky)); elseif (sin(ky) <= 2e-57) tmp = Float64(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) <= -5e-171) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-163) tmp = sin(th) / (kx / ky); elseif (sin(ky) <= 2e-57) tmp = th / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-171], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-163], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-57], N[(th / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-171}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-163}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-57}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -4.99999999999999992e-171Initial program 95.9%
associate-*l/95.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def97.4%
Simplified97.4%
Taylor expanded in kx around 0 3.5%
add-sqr-sqrt2.5%
sqrt-unprod24.7%
pow224.7%
associate-/l*24.7%
associate-/r/24.8%
Applied egg-rr24.8%
unpow224.8%
rem-sqrt-square26.1%
*-inverses26.1%
*-lft-identity26.1%
Simplified26.1%
if -4.99999999999999992e-171 < (sin.f64 ky) < 4.99999999999999977e-163Initial program 80.2%
+-commutative80.2%
unpow280.2%
unpow280.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 54.3%
Taylor expanded in kx around 0 38.3%
Taylor expanded in ky around 0 38.3%
associate-/l*43.7%
Simplified43.7%
if 4.99999999999999977e-163 < (sin.f64 ky) < 1.99999999999999991e-57Initial program 99.8%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 61.8%
Taylor expanded in ky around 0 49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
if 1.99999999999999991e-57 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 61.7%
Final simplification43.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -5e-171)
(fabs (sin th))
(if (<= (sin ky) 5e-163)
(* (sin ky) (/ (sin th) kx))
(if (<= (sin ky) 2e-57) (/ th (/ (sin kx) ky)) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-171) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-163) {
tmp = sin(ky) * (sin(th) / kx);
} else if (sin(ky) <= 2e-57) {
tmp = 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) <= (-5d-171)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-163) then
tmp = sin(ky) * (sin(th) / kx)
else if (sin(ky) <= 2d-57) then
tmp = 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) <= -5e-171) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-163) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else if (Math.sin(ky) <= 2e-57) {
tmp = th / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-171: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-163: tmp = math.sin(ky) * (math.sin(th) / kx) elif math.sin(ky) <= 2e-57: tmp = th / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-171) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-163) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); elseif (sin(ky) <= 2e-57) tmp = Float64(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) <= -5e-171) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-163) tmp = sin(ky) * (sin(th) / kx); elseif (sin(ky) <= 2e-57) tmp = th / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-171], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-163], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-57], N[(th / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-171}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-163}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-57}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -4.99999999999999992e-171Initial program 95.9%
associate-*l/95.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def97.4%
Simplified97.4%
Taylor expanded in kx around 0 3.5%
add-sqr-sqrt2.5%
sqrt-unprod24.7%
pow224.7%
associate-/l*24.7%
associate-/r/24.8%
Applied egg-rr24.8%
unpow224.8%
rem-sqrt-square26.1%
*-inverses26.1%
*-lft-identity26.1%
Simplified26.1%
if -4.99999999999999992e-171 < (sin.f64 ky) < 4.99999999999999977e-163Initial program 80.2%
+-commutative80.2%
unpow280.2%
unpow280.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 54.3%
Taylor expanded in kx around 0 30.1%
Taylor expanded in kx around 0 38.3%
*-commutative38.3%
associate-*r/43.7%
Simplified43.7%
if 4.99999999999999977e-163 < (sin.f64 ky) < 1.99999999999999991e-57Initial program 99.8%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 61.8%
Taylor expanded in ky around 0 49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
if 1.99999999999999991e-57 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 61.7%
Final simplification43.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-41) (fabs (sin th)) (if (<= (sin ky) 2e-57) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-41) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-57) {
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-41)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-57) 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-41) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-57) {
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-41: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-57: 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-41) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-57) 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-41) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-57) 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-41], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-57], 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^{-41}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-57}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000001e-41Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.2%
sqrt-unprod22.5%
pow222.5%
associate-/l*22.5%
associate-/r/22.6%
Applied egg-rr22.6%
unpow222.6%
rem-sqrt-square24.5%
*-inverses24.5%
*-lft-identity24.5%
Simplified24.5%
if -1.00000000000000001e-41 < (sin.f64 ky) < 1.99999999999999991e-57Initial program 85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 51.6%
if 1.99999999999999991e-57 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 61.7%
Final simplification48.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-41) (fabs (sin th)) (if (<= (sin ky) 2e-57) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-41) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-57) {
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-41)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-57) 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-41) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-57) {
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-41: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-57: 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-41) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-57) 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-41) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-57) 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-41], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-57], 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^{-41}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-57}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000001e-41Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 2.3%
add-sqr-sqrt1.2%
sqrt-unprod22.5%
pow222.5%
associate-/l*22.5%
associate-/r/22.6%
Applied egg-rr22.6%
unpow222.6%
rem-sqrt-square24.5%
*-inverses24.5%
*-lft-identity24.5%
Simplified24.5%
if -1.00000000000000001e-41 < (sin.f64 ky) < 1.99999999999999991e-57Initial program 85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 48.5%
associate-/l*51.6%
Simplified51.6%
if 1.99999999999999991e-57 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 61.7%
Final simplification48.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 5e-163) (/ (sin th) (/ kx ky)) (if (<= (sin ky) 2e-57) (/ th (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-163) {
tmp = sin(th) / (kx / ky);
} else if (sin(ky) <= 2e-57) {
tmp = 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) <= 5d-163) then
tmp = sin(th) / (kx / ky)
else if (sin(ky) <= 2d-57) then
tmp = 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) <= 5e-163) {
tmp = Math.sin(th) / (kx / ky);
} else if (Math.sin(ky) <= 2e-57) {
tmp = th / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-163: tmp = math.sin(th) / (kx / ky) elif math.sin(ky) <= 2e-57: tmp = th / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-163) tmp = Float64(sin(th) / Float64(kx / ky)); elseif (sin(ky) <= 2e-57) tmp = Float64(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) <= 5e-163) tmp = sin(th) / (kx / ky); elseif (sin(ky) <= 2e-57) tmp = th / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-163], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-57], N[(th / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-163}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-57}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.99999999999999977e-163Initial program 89.1%
+-commutative89.1%
unpow289.1%
unpow289.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 34.0%
Taylor expanded in kx around 0 22.8%
Taylor expanded in ky around 0 22.7%
associate-/l*25.1%
Simplified25.1%
if 4.99999999999999977e-163 < (sin.f64 ky) < 1.99999999999999991e-57Initial program 99.8%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 61.8%
Taylor expanded in ky around 0 49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
if 1.99999999999999991e-57 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 61.7%
Final simplification38.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-57) (* th (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-57) {
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 (sin(ky) <= 2d-57) 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 (Math.sin(ky) <= 2e-57) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-57: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-57) 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 (sin(ky) <= 2e-57) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-57], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-57}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.99999999999999991e-57Initial program 90.3%
associate-*l/88.2%
+-commutative88.2%
unpow288.2%
unpow288.2%
hypot-def94.2%
Simplified94.2%
Taylor expanded in th around 0 39.6%
Taylor expanded in ky around 0 20.1%
associate-/l*22.2%
Simplified22.2%
associate-/r/22.2%
Applied egg-rr22.2%
if 1.99999999999999991e-57 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 61.7%
Final simplification34.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky -46.0) (sin th) (if (<= ky 9e-163) (* th (/ ky kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -46.0) {
tmp = sin(th);
} else if (ky <= 9e-163) {
tmp = th * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-46.0d0)) then
tmp = sin(th)
else if (ky <= 9d-163) then
tmp = th * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -46.0) {
tmp = Math.sin(th);
} else if (ky <= 9e-163) {
tmp = th * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -46.0: tmp = math.sin(th) elif ky <= 9e-163: tmp = th * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -46.0) tmp = sin(th); elseif (ky <= 9e-163) tmp = Float64(th * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -46.0) tmp = sin(th); elseif (ky <= 9e-163) tmp = th * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -46.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 9e-163], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -46:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 9 \cdot 10^{-163}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -46 or 8.9999999999999995e-163 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 36.5%
if -46 < ky < 8.9999999999999995e-163Initial program 84.3%
associate-*l/80.9%
+-commutative80.9%
unpow280.9%
unpow280.9%
hypot-def90.7%
Simplified90.7%
Taylor expanded in th around 0 33.6%
Taylor expanded in ky around 0 24.1%
associate-/l*27.4%
Simplified27.4%
Taylor expanded in kx around 0 23.6%
*-commutative23.6%
associate-/l*26.9%
Simplified26.9%
associate-/r/27.2%
Applied egg-rr27.2%
Final simplification32.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5e-16) th (if (<= ky 1.15e-57) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5e-16) {
tmp = th;
} else if (ky <= 1.15e-57) {
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 <= (-5d-16)) then
tmp = th
else if (ky <= 1.15d-57) 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 <= -5e-16) {
tmp = th;
} else if (ky <= 1.15e-57) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5e-16: tmp = th elif ky <= 1.15e-57: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5e-16) tmp = th; elseif (ky <= 1.15e-57) 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 <= -5e-16) tmp = th; elseif (ky <= 1.15e-57) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5e-16], th, If[LessEqual[ky, 1.15e-57], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5 \cdot 10^{-16}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 1.15 \cdot 10^{-57}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -5.0000000000000004e-16 or 1.15e-57 < ky Initial program 99.7%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 41.9%
Taylor expanded in kx around 0 16.4%
if -5.0000000000000004e-16 < ky < 1.15e-57Initial program 86.1%
associate-*l/83.1%
+-commutative83.1%
unpow283.1%
unpow283.1%
hypot-def91.8%
Simplified91.8%
Taylor expanded in th around 0 37.8%
Taylor expanded in ky around 0 28.0%
associate-/l*31.0%
Simplified31.0%
Taylor expanded in kx around 0 23.0%
*-commutative23.0%
associate-/l*26.0%
Simplified26.0%
associate-/r/26.2%
Applied egg-rr26.2%
Final simplification21.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.3%
associate-*l/91.9%
+-commutative91.9%
unpow291.9%
unpow291.9%
hypot-def95.9%
Simplified95.9%
Taylor expanded in th around 0 40.0%
Taylor expanded in kx around 0 10.7%
Final simplification10.7%
herbie shell --seed 2023195
(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)))