
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin kx) (sin ky)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(kx), sin(ky)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(kx), sin(ky)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(kx), sin(ky))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}
\end{array}
Initial program 94.3%
associate-/r/94.3%
+-commutative94.3%
unpow294.3%
sqr-neg94.3%
sin-neg94.3%
sin-neg94.3%
unpow294.3%
+-commutative94.3%
Simplified99.6%
clear-num99.3%
associate-/r/99.5%
clear-num99.7%
hypot-udef94.4%
unpow294.4%
unpow294.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(* (sin ky) (/ th (hypot (sin kx) (sin ky))))
(if (<= (sin ky) 1e-23)
(/ (* (sin th) ky) (hypot (sin ky) (sin kx)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = sin(ky) * (th / hypot(sin(kx), sin(ky)));
} else if (sin(ky) <= 1e-23) {
tmp = (sin(th) * ky) / hypot(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.sin(ky) * (th / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-23) {
tmp = (Math.sin(th) * ky) / Math.hypot(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.sin(ky) * (th / math.hypot(math.sin(kx), math.sin(ky))) elif math.sin(ky) <= 1e-23: tmp = (math.sin(th) * ky) / math.hypot(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(sin(ky) * Float64(th / hypot(sin(kx), sin(ky)))); elseif (sin(ky) <= 1e-23) tmp = Float64(Float64(sin(th) * ky) / hypot(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 = sin(ky) * (th / hypot(sin(kx), sin(ky))); elseif (sin(ky) <= 1e-23) tmp = (sin(th) * ky) / hypot(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[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-23], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{elif}\;\sin ky \leq 10^{-23}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
+-commutative99.5%
Simplified99.6%
Taylor expanded in th around 0 46.4%
associate-*l/46.4%
unpow246.4%
unpow246.4%
hypot-def46.4%
*-lft-identity46.4%
hypot-def46.4%
unpow246.4%
unpow246.4%
+-commutative46.4%
unpow246.4%
unpow246.4%
hypot-def46.4%
Simplified46.4%
clear-num46.4%
associate-/r/46.4%
clear-num46.6%
hypot-udef46.7%
+-commutative46.7%
hypot-udef46.6%
Applied egg-rr46.6%
if -0.050000000000000003 < (sin.f64 ky) < 9.9999999999999996e-24Initial program 89.3%
associate-*l/86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def95.6%
Simplified95.6%
Taylor expanded in ky around 0 95.6%
if 9.9999999999999996e-24 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 64.7%
Final simplification76.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.05)
(/ (sin ky) (* t_1 (+ (* th 0.16666666666666666) (/ 1.0 th))))
(if (<= (sin ky) 1e-23) (/ (* (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.05) {
tmp = sin(ky) / (t_1 * ((th * 0.16666666666666666) + (1.0 / th)));
} else if (sin(ky) <= 1e-23) {
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.05) {
tmp = Math.sin(ky) / (t_1 * ((th * 0.16666666666666666) + (1.0 / th)));
} else if (Math.sin(ky) <= 1e-23) {
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.05: tmp = math.sin(ky) / (t_1 * ((th * 0.16666666666666666) + (1.0 / th))) elif math.sin(ky) <= 1e-23: 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.05) tmp = Float64(sin(ky) / Float64(t_1 * Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th)))); elseif (sin(ky) <= 1e-23) tmp = Float64(Float64(sin(th) * 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.05) tmp = sin(ky) / (t_1 * ((th * 0.16666666666666666) + (1.0 / th))); elseif (sin(ky) <= 1e-23) 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.05], N[(N[Sin[ky], $MachinePrecision] / N[(t$95$1 * N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-23], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / t$95$1), $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 \left(th \cdot 0.16666666666666666 + \frac{1}{th}\right)}\\
\mathbf{elif}\;\sin ky \leq 10^{-23}:\\
\;\;\;\;\frac{\sin th \cdot ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial program 99.6%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
+-commutative99.5%
Simplified99.6%
Taylor expanded in th around 0 47.1%
+-commutative47.1%
unpow247.1%
unpow247.1%
hypot-def47.1%
associate-*r*47.1%
unpow247.1%
unpow247.1%
hypot-def47.1%
distribute-rgt-out47.1%
Simplified47.1%
if -0.050000000000000003 < (sin.f64 ky) < 9.9999999999999996e-24Initial program 89.3%
associate-*l/86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def95.6%
Simplified95.6%
Taylor expanded in ky around 0 95.6%
if 9.9999999999999996e-24 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 64.7%
Final simplification76.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.05)
(/
(/ (sin ky) (hypot (sin kx) (sin ky)))
(+ (* th 0.16666666666666666) (/ 1.0 th)))
(if (<= (sin ky) 1e-23)
(/ (* (sin th) ky) (hypot (sin ky) (sin kx)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = (sin(ky) / hypot(sin(kx), sin(ky))) / ((th * 0.16666666666666666) + (1.0 / th));
} else if (sin(ky) <= 1e-23) {
tmp = (sin(th) * ky) / hypot(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.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky))) / ((th * 0.16666666666666666) + (1.0 / th));
} else if (Math.sin(ky) <= 1e-23) {
tmp = (Math.sin(th) * ky) / Math.hypot(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.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) / ((th * 0.16666666666666666) + (1.0 / th)) elif math.sin(ky) <= 1e-23: tmp = (math.sin(th) * ky) / math.hypot(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(Float64(sin(ky) / hypot(sin(kx), sin(ky))) / Float64(Float64(th * 0.16666666666666666) + Float64(1.0 / th))); elseif (sin(ky) <= 1e-23) tmp = Float64(Float64(sin(th) * ky) / hypot(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 = (sin(ky) / hypot(sin(kx), sin(ky))) / ((th * 0.16666666666666666) + (1.0 / th)); elseif (sin(ky) <= 1e-23) tmp = (sin(th) * ky) / hypot(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[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(N[(th * 0.16666666666666666), $MachinePrecision] + N[(1.0 / th), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-23], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.05:\\
\;\;\;\;\frac{\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}}{th \cdot 0.16666666666666666 + \frac{1}{th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-23}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\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.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-udef99.6%
associate-/l*99.6%
div-inv99.4%
associate-/r*99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 47.1%
if -0.050000000000000003 < (sin.f64 ky) < 9.9999999999999996e-24Initial program 89.3%
associate-*l/86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def95.6%
Simplified95.6%
Taylor expanded in ky around 0 95.6%
if 9.9999999999999996e-24 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 64.7%
Final simplification76.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-302) (* ky (/ (sin th) (sin kx))) (if (<= (sin ky) 4e-49) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-302) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 4e-49) {
tmp = sin(th) * fabs((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-302) then
tmp = ky * (sin(th) / sin(kx))
else if (sin(ky) <= 4d-49) then
tmp = sin(th) * abs((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-302) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 4e-49) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-302: tmp = ky * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 4e-49: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-302) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 4e-49) tmp = Float64(sin(th) * abs(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-302) tmp = ky * (sin(th) / sin(kx)); elseif (sin(ky) <= 4e-49) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-302], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-49], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-302}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-49}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.9999999999999999e-302Initial program 94.9%
*-commutative94.9%
clear-num94.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-udef99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 28.2%
associate-*r/28.4%
Simplified28.4%
if 1.9999999999999999e-302 < (sin.f64 ky) < 3.99999999999999975e-49Initial program 87.3%
Taylor expanded in ky around 0 44.7%
add-sqr-sqrt38.3%
sqrt-unprod63.9%
pow263.9%
Applied egg-rr63.9%
unpow263.9%
rem-sqrt-square86.6%
Simplified86.6%
Taylor expanded in ky around 0 86.6%
if 3.99999999999999975e-49 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 65.9%
Final simplification52.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-290) (* (sin th) (/ (sin ky) (sin kx))) (if (<= (sin ky) 4e-49) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-290) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 4e-49) {
tmp = sin(th) * fabs((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-290)) then
tmp = sin(th) * (sin(ky) / sin(kx))
else if (sin(ky) <= 4d-49) then
tmp = sin(th) * abs((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-290) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(ky) <= 4e-49) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-290: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(ky) <= 4e-49: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-290) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 4e-49) tmp = Float64(sin(th) * abs(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-290) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(ky) <= 4e-49) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-290], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-49], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-290}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-49}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.0000000000000001e-290Initial program 95.5%
Taylor expanded in ky around 0 28.5%
if -2.0000000000000001e-290 < (sin.f64 ky) < 3.99999999999999975e-49Initial program 86.4%
Taylor expanded in ky around 0 47.2%
add-sqr-sqrt39.6%
sqrt-unprod65.6%
pow265.6%
Applied egg-rr65.6%
unpow265.6%
rem-sqrt-square87.1%
Simplified87.1%
Taylor expanded in ky around 0 87.1%
if 3.99999999999999975e-49 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 65.9%
Final simplification53.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-302) (* (sin ky) (/ (sin th) (sin kx))) (if (<= (sin ky) 4e-49) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-302) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 4e-49) {
tmp = sin(th) * fabs((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-302) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(ky) <= 4d-49) then
tmp = sin(th) * abs((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-302) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 4e-49) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-302: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 4e-49: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-302) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 4e-49) tmp = Float64(sin(th) * abs(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-302) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 4e-49) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-302], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-49], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-302}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-49}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.9999999999999999e-302Initial program 94.9%
associate-/r/94.9%
+-commutative94.9%
unpow294.9%
sqr-neg94.9%
sin-neg94.9%
sin-neg94.9%
unpow294.9%
+-commutative94.9%
Simplified99.6%
clear-num99.3%
associate-/r/99.5%
clear-num99.7%
hypot-udef95.1%
unpow295.1%
unpow295.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 30.3%
if 1.9999999999999999e-302 < (sin.f64 ky) < 3.99999999999999975e-49Initial program 87.3%
Taylor expanded in ky around 0 44.7%
add-sqr-sqrt38.3%
sqrt-unprod63.9%
pow263.9%
Applied egg-rr63.9%
unpow263.9%
rem-sqrt-square86.6%
Simplified86.6%
Taylor expanded in ky around 0 86.6%
if 3.99999999999999975e-49 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 65.9%
Final simplification53.6%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= th -0.014)
(/ (/ (sin ky) (sin kx)) (/ 1.0 (sin th)))
(if (<= th 1350000000000.0)
(* (sin ky) (/ th (hypot (sin kx) (sin ky))))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= -0.014) {
tmp = (sin(ky) / sin(kx)) / (1.0 / sin(th));
} else if (th <= 1350000000000.0) {
tmp = sin(ky) * (th / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= -0.014) {
tmp = (Math.sin(ky) / Math.sin(kx)) / (1.0 / Math.sin(th));
} else if (th <= 1350000000000.0) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= -0.014: tmp = (math.sin(ky) / math.sin(kx)) / (1.0 / math.sin(th)) elif th <= 1350000000000.0: tmp = math.sin(ky) * (th / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= -0.014) tmp = Float64(Float64(sin(ky) / sin(kx)) / Float64(1.0 / sin(th))); elseif (th <= 1350000000000.0) tmp = Float64(sin(ky) * Float64(th / hypot(sin(kx), sin(ky)))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= -0.014) tmp = (sin(ky) / sin(kx)) / (1.0 / sin(th)); elseif (th <= 1350000000000.0) tmp = sin(ky) * (th / hypot(sin(kx), sin(ky))); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, -0.014], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 1350000000000.0], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq -0.014:\\
\;\;\;\;\frac{\frac{\sin ky}{\sin kx}}{\frac{1}{\sin th}}\\
\mathbf{elif}\;th \leq 1350000000000:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if th < -0.0140000000000000003Initial program 91.5%
associate-*l/91.4%
+-commutative91.4%
unpow291.4%
unpow291.4%
hypot-udef99.6%
associate-/l*99.7%
div-inv99.5%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 25.3%
if -0.0140000000000000003 < th < 1.35e12Initial program 96.8%
associate-/r/96.7%
+-commutative96.7%
unpow296.7%
sqr-neg96.7%
sin-neg96.7%
sin-neg96.7%
unpow296.7%
+-commutative96.7%
Simplified99.6%
Taylor expanded in th around 0 93.7%
associate-*l/93.8%
unpow293.8%
unpow293.8%
hypot-def96.7%
*-lft-identity96.7%
hypot-def93.8%
unpow293.8%
unpow293.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def96.7%
Simplified96.7%
clear-num96.3%
associate-/r/96.6%
clear-num96.9%
hypot-udef94.0%
+-commutative94.0%
hypot-udef96.9%
Applied egg-rr96.9%
if 1.35e12 < th Initial program 91.3%
associate-/r/91.5%
+-commutative91.5%
unpow291.5%
sqr-neg91.5%
sin-neg91.5%
sin-neg91.5%
unpow291.5%
+-commutative91.5%
Simplified99.5%
clear-num99.2%
associate-/r/99.4%
clear-num99.6%
hypot-udef91.5%
unpow291.5%
unpow291.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 24.7%
Final simplification63.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 4e-99) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 4e-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) <= 4d-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) <= 4e-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) <= 4e-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) <= 4e-99) tmp = Float64(ky * Float64(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) <= 4e-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], 4e-99], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4 \cdot 10^{-99}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.0000000000000001e-99Initial program 91.9%
*-commutative91.9%
clear-num91.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-udef99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 34.6%
associate-*r/34.7%
Simplified34.7%
if 4.0000000000000001e-99 < (sin.f64 ky) Initial program 99.7%
Taylor expanded in kx around 0 63.7%
Final simplification43.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky -600000000000.0) (sin th) (if (<= ky 2.4e-105) (* ky (/ th (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -600000000000.0) {
tmp = sin(th);
} else if (ky <= 2.4e-105) {
tmp = ky * (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 (ky <= (-600000000000.0d0)) then
tmp = sin(th)
else if (ky <= 2.4d-105) then
tmp = ky * (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 (ky <= -600000000000.0) {
tmp = Math.sin(th);
} else if (ky <= 2.4e-105) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -600000000000.0: tmp = math.sin(th) elif ky <= 2.4e-105: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -600000000000.0) tmp = sin(th); elseif (ky <= 2.4e-105) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -600000000000.0) tmp = sin(th); elseif (ky <= 2.4e-105) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -600000000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 2.4e-105], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -600000000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.4 \cdot 10^{-105}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6e11 or 2.40000000000000015e-105 < ky Initial program 99.7%
Taylor expanded in kx around 0 37.3%
if -6e11 < ky < 2.40000000000000015e-105Initial program 87.9%
associate-/r/88.0%
+-commutative88.0%
unpow288.0%
sqr-neg88.0%
sin-neg88.0%
sin-neg88.0%
unpow288.0%
+-commutative88.0%
Simplified99.5%
Taylor expanded in th around 0 52.3%
associate-*l/52.3%
unpow252.3%
unpow252.3%
hypot-def55.7%
*-lft-identity55.7%
hypot-def52.3%
unpow252.3%
unpow252.3%
+-commutative52.3%
unpow252.3%
unpow252.3%
hypot-def55.7%
Simplified55.7%
Taylor expanded in ky around 0 28.9%
associate-/l*29.0%
Simplified29.0%
div-inv29.0%
clear-num29.0%
Applied egg-rr29.0%
Final simplification33.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky -600000000000.0) (sin th) (if (<= ky 7e-105) (* th (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -600000000000.0) {
tmp = sin(th);
} else if (ky <= 7e-105) {
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 <= (-600000000000.0d0)) then
tmp = sin(th)
else if (ky <= 7d-105) 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 <= -600000000000.0) {
tmp = Math.sin(th);
} else if (ky <= 7e-105) {
tmp = th * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -600000000000.0: tmp = math.sin(th) elif ky <= 7e-105: tmp = th * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -600000000000.0) tmp = sin(th); elseif (ky <= 7e-105) 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 <= -600000000000.0) tmp = sin(th); elseif (ky <= 7e-105) tmp = th * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -600000000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 7e-105], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -600000000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 7 \cdot 10^{-105}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6e11 or 7e-105 < ky Initial program 99.7%
Taylor expanded in kx around 0 37.3%
if -6e11 < ky < 7e-105Initial program 87.9%
associate-/r/88.0%
+-commutative88.0%
unpow288.0%
sqr-neg88.0%
sin-neg88.0%
sin-neg88.0%
unpow288.0%
+-commutative88.0%
Simplified99.5%
Taylor expanded in th around 0 52.3%
associate-*l/52.3%
unpow252.3%
unpow252.3%
hypot-def55.7%
*-lft-identity55.7%
hypot-def52.3%
unpow252.3%
unpow252.3%
+-commutative52.3%
unpow252.3%
unpow252.3%
hypot-def55.7%
Simplified55.7%
Taylor expanded in ky around 0 28.9%
associate-/l*29.0%
Simplified29.0%
associate-/r/29.1%
Applied egg-rr29.1%
Final simplification33.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -600000000000.0) (sin th) (if (<= ky 1.15e-126) (/ ky (/ kx (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -600000000000.0) {
tmp = sin(th);
} else if (ky <= 1.15e-126) {
tmp = ky / (kx / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-600000000000.0d0)) then
tmp = sin(th)
else if (ky <= 1.15d-126) then
tmp = ky / (kx / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -600000000000.0) {
tmp = Math.sin(th);
} else if (ky <= 1.15e-126) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -600000000000.0: tmp = math.sin(th) elif ky <= 1.15e-126: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -600000000000.0) tmp = sin(th); elseif (ky <= 1.15e-126) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -600000000000.0) tmp = sin(th); elseif (ky <= 1.15e-126) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -600000000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.15e-126], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -600000000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.15 \cdot 10^{-126}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6e11 or 1.15000000000000005e-126 < ky Initial program 99.7%
Taylor expanded in kx around 0 36.4%
if -6e11 < ky < 1.15000000000000005e-126Initial program 87.5%
Taylor expanded in ky around 0 50.8%
Taylor expanded in kx around 0 35.2%
associate-/l*35.4%
Simplified35.4%
Final simplification36.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -600000000000.0) (sin th) (if (<= ky 9.4e-129) (* th (/ ky kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -600000000000.0) {
tmp = sin(th);
} else if (ky <= 9.4e-129) {
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 <= (-600000000000.0d0)) then
tmp = sin(th)
else if (ky <= 9.4d-129) 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 <= -600000000000.0) {
tmp = Math.sin(th);
} else if (ky <= 9.4e-129) {
tmp = th * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -600000000000.0: tmp = math.sin(th) elif ky <= 9.4e-129: tmp = th * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -600000000000.0) tmp = sin(th); elseif (ky <= 9.4e-129) 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 <= -600000000000.0) tmp = sin(th); elseif (ky <= 9.4e-129) tmp = th * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -600000000000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 9.4e-129], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -600000000000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 9.4 \cdot 10^{-129}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6e11 or 9.4000000000000003e-129 < ky Initial program 99.7%
Taylor expanded in kx around 0 36.4%
if -6e11 < ky < 9.4000000000000003e-129Initial program 87.5%
associate-/r/87.6%
+-commutative87.6%
unpow287.6%
sqr-neg87.6%
sin-neg87.6%
sin-neg87.6%
unpow287.6%
+-commutative87.6%
Simplified99.6%
Taylor expanded in th around 0 53.1%
associate-*l/53.2%
unpow253.2%
unpow253.2%
hypot-def56.7%
*-lft-identity56.7%
hypot-def53.2%
unpow253.2%
unpow253.2%
+-commutative53.2%
unpow253.2%
unpow253.2%
hypot-def56.7%
Simplified56.7%
Taylor expanded in ky around 0 29.8%
associate-/l*30.0%
Simplified30.0%
Taylor expanded in kx around 0 26.8%
associate-/l*26.9%
Simplified26.9%
associate-/r/27.0%
Applied egg-rr27.0%
Final simplification32.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky -330000000000.0) th (if (<= ky 2.7e-77) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -330000000000.0) {
tmp = th;
} else if (ky <= 2.7e-77) {
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 <= (-330000000000.0d0)) then
tmp = th
else if (ky <= 2.7d-77) 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 <= -330000000000.0) {
tmp = th;
} else if (ky <= 2.7e-77) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -330000000000.0: tmp = th elif ky <= 2.7e-77: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -330000000000.0) tmp = th; elseif (ky <= 2.7e-77) 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 <= -330000000000.0) tmp = th; elseif (ky <= 2.7e-77) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -330000000000.0], th, If[LessEqual[ky, 2.7e-77], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -330000000000:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 2.7 \cdot 10^{-77}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -3.3e11 or 2.7e-77 < ky Initial program 99.7%
associate-/r/99.6%
+-commutative99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in th around 0 50.7%
associate-*l/50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
*-lft-identity50.8%
hypot-def50.8%
unpow250.8%
unpow250.8%
+-commutative50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
Simplified50.8%
Taylor expanded in kx around 0 20.7%
if -3.3e11 < ky < 2.7e-77Initial program 88.6%
associate-/r/88.6%
+-commutative88.6%
unpow288.6%
sqr-neg88.6%
sin-neg88.6%
sin-neg88.6%
unpow288.6%
+-commutative88.6%
Simplified99.5%
Taylor expanded in th around 0 51.8%
associate-*l/51.8%
unpow251.8%
unpow251.8%
hypot-def55.0%
*-lft-identity55.0%
hypot-def51.8%
unpow251.8%
unpow251.8%
+-commutative51.8%
unpow251.8%
unpow251.8%
hypot-def55.0%
Simplified55.0%
Taylor expanded in ky around 0 28.2%
associate-/l*28.3%
Simplified28.3%
Taylor expanded in kx around 0 25.5%
associate-/l*25.6%
Simplified25.6%
associate-/r/25.7%
Applied egg-rr25.7%
Final simplification23.1%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.3%
associate-/r/94.3%
+-commutative94.3%
unpow294.3%
sqr-neg94.3%
sin-neg94.3%
sin-neg94.3%
unpow294.3%
+-commutative94.3%
Simplified99.6%
Taylor expanded in th around 0 51.2%
associate-*l/51.3%
unpow251.3%
unpow251.3%
hypot-def52.8%
*-lft-identity52.8%
hypot-def51.3%
unpow251.3%
unpow251.3%
+-commutative51.3%
unpow251.3%
unpow251.3%
hypot-def52.8%
Simplified52.8%
Taylor expanded in kx around 0 13.2%
Final simplification13.2%
herbie shell --seed 2023293
(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)))