
(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 18 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 96.5%
+-commutative96.5%
unpow296.5%
unpow296.5%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.02)
(sin th)
(if (<= (sin th) 0.0001)
(/ th (/ (hypot (sin ky) (sin kx)) (sin ky)))
(* (sin ky) (fabs (/ (sin th) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.02) {
tmp = sin(th);
} else if (sin(th) <= 0.0001) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.02) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= 0.0001) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.02: tmp = math.sin(th) elif math.sin(th) <= 0.0001: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) else: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.02) tmp = sin(th); elseif (sin(th) <= 0.0001) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); else tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.02) tmp = sin(th); elseif (sin(th) <= 0.0001) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); else tmp = sin(ky) * abs((sin(th) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.02], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.0001], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.02:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq 0.0001:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0200000000000000004Initial program 94.4%
unpow294.4%
sqr-neg94.4%
sin-neg94.4%
sin-neg94.4%
unpow294.4%
associate-*l/94.3%
associate-/l*94.2%
unpow294.2%
Simplified99.5%
Taylor expanded in kx around 0 24.2%
if -0.0200000000000000004 < (sin.f64 th) < 1.00000000000000005e-4Initial program 95.9%
unpow295.9%
sqr-neg95.9%
sin-neg95.9%
sin-neg95.9%
unpow295.9%
associate-*l/93.0%
associate-/l*95.8%
unpow295.8%
Simplified99.6%
Taylor expanded in th around 0 90.1%
associate-*l*92.4%
sqrt-div93.9%
metadata-eval93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-undefine97.7%
div-inv97.8%
clear-num97.7%
un-div-inv97.8%
Applied egg-rr97.8%
if 1.00000000000000005e-4 < (sin.f64 th) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in ky around 0 32.2%
add-sqr-sqrt31.3%
sqrt-unprod50.2%
pow250.2%
Applied egg-rr50.2%
unpow250.2%
rem-sqrt-square50.4%
Simplified50.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.02)
(sin th)
(if (<= (sin th) 0.0001)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(* (sin ky) (fabs (/ (sin th) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.02) {
tmp = sin(th);
} else if (sin(th) <= 0.0001) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.02) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= 0.0001) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.02: tmp = math.sin(th) elif math.sin(th) <= 0.0001: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.02) tmp = sin(th); elseif (sin(th) <= 0.0001) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.02) tmp = sin(th); elseif (sin(th) <= 0.0001) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(ky) * abs((sin(th) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.02], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.0001], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.02:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq 0.0001:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0200000000000000004Initial program 94.4%
unpow294.4%
sqr-neg94.4%
sin-neg94.4%
sin-neg94.4%
unpow294.4%
associate-*l/94.3%
associate-/l*94.2%
unpow294.2%
Simplified99.5%
Taylor expanded in kx around 0 24.2%
if -0.0200000000000000004 < (sin.f64 th) < 1.00000000000000005e-4Initial program 95.9%
unpow295.9%
sqr-neg95.9%
sin-neg95.9%
sin-neg95.9%
unpow295.9%
associate-*l/93.0%
associate-/l*95.8%
unpow295.8%
Simplified99.6%
Taylor expanded in th around 0 90.1%
associate-*l*92.4%
sqrt-div93.9%
metadata-eval93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-undefine97.7%
div-inv97.8%
clear-num97.7%
un-div-inv97.8%
Applied egg-rr97.8%
associate-/r/97.7%
Simplified97.7%
if 1.00000000000000005e-4 < (sin.f64 th) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in ky around 0 32.2%
add-sqr-sqrt31.3%
sqrt-unprod50.2%
pow250.2%
Applied egg-rr50.2%
unpow250.2%
rem-sqrt-square50.4%
Simplified50.4%
Final simplification68.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.01)
(* (sin ky) (fabs (/ (sin th) (sin kx))))
(if (<= (sin kx) 5e-110)
(sin th)
(* (sin th) (* (sin ky) (/ 1.0 (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 5e-110) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) * (1.0 / sin(kx)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.01d0)) then
tmp = sin(ky) * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 5d-110) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) * (1.0d0 / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.01) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 5e-110) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) * (1.0 / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 5e-110: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) * (1.0 / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-110) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) * Float64(1.0 / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.01) tmp = sin(ky) * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 5e-110) tmp = sin(th); else tmp = sin(th) * (sin(ky) * (1.0 / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-110], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.01:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-110}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \frac{1}{\sin kx}\right)\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 10.1%
add-sqr-sqrt5.1%
sqrt-unprod34.3%
pow234.3%
Applied egg-rr34.3%
unpow234.3%
rem-sqrt-square39.3%
Simplified39.3%
if -0.0100000000000000002 < (sin.f64 kx) < 5e-110Initial program 91.8%
unpow291.8%
sqr-neg91.8%
sin-neg91.8%
sin-neg91.8%
unpow291.8%
associate-*l/88.0%
associate-/l*91.7%
unpow291.7%
Simplified99.8%
Taylor expanded in kx around 0 46.4%
if 5e-110 < (sin.f64 kx) Initial program 99.4%
clear-num99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.4%
associate-/r/99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 66.6%
Final simplification51.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.01)
(fabs (* (sin ky) (/ (sin th) (sin kx))))
(if (<= (sin kx) 5e-110)
(sin th)
(* (sin th) (* (sin ky) (/ 1.0 (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(kx) <= 5e-110) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) * (1.0 / sin(kx)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.01d0)) then
tmp = abs((sin(ky) * (sin(th) / sin(kx))))
else if (sin(kx) <= 5d-110) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) * (1.0d0 / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.01) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-110) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) * (1.0 / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 5e-110: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) * (1.0 / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-110) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) * Float64(1.0 / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.01) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-110) tmp = sin(th); else tmp = sin(th) * (sin(ky) * (1.0 / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-110], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.01:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-110}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \frac{1}{\sin kx}\right)\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 10.1%
add-sqr-sqrt7.8%
sqrt-unprod23.0%
pow223.0%
Applied egg-rr23.0%
unpow223.0%
rem-sqrt-square38.4%
Simplified38.4%
if -0.0100000000000000002 < (sin.f64 kx) < 5e-110Initial program 91.8%
unpow291.8%
sqr-neg91.8%
sin-neg91.8%
sin-neg91.8%
unpow291.8%
associate-*l/88.0%
associate-/l*91.7%
unpow291.7%
Simplified99.8%
Taylor expanded in kx around 0 46.4%
if 5e-110 < (sin.f64 kx) Initial program 99.4%
clear-num99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.4%
associate-/r/99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 66.6%
Final simplification51.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.2)
(fabs (* th (/ (sin ky) (sin kx))))
(if (<= (sin kx) 5e-110)
(sin th)
(* (sin th) (* (sin ky) (/ 1.0 (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.2) {
tmp = fabs((th * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 5e-110) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) * (1.0 / sin(kx)));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.2d0)) then
tmp = abs((th * (sin(ky) / sin(kx))))
else if (sin(kx) <= 5d-110) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) * (1.0d0 / sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.2) {
tmp = Math.abs((th * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-110) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) * (1.0 / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.2: tmp = math.fabs((th * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 5e-110: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) * (1.0 / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.2) tmp = abs(Float64(th * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 5e-110) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) * Float64(1.0 / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.2) tmp = abs((th * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 5e-110) tmp = sin(th); else tmp = sin(th) * (sin(ky) * (1.0 / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.2], N[Abs[N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-110], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.2:\\
\;\;\;\;\left|th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-110}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \frac{1}{\sin kx}\right)\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.20000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 10.9%
Taylor expanded in th around 0 11.1%
div-inv11.1%
*-commutative11.1%
associate-*l*11.1%
Applied egg-rr11.1%
add-sqr-sqrt8.4%
sqrt-unprod18.2%
pow218.2%
div-inv18.2%
Applied egg-rr18.2%
unpow218.2%
rem-sqrt-square27.4%
associate-*r/27.5%
*-commutative27.5%
associate-/l*27.5%
Simplified27.5%
if -0.20000000000000001 < (sin.f64 kx) < 5e-110Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/88.7%
associate-/l*92.1%
unpow292.1%
Simplified99.8%
Taylor expanded in kx around 0 44.2%
if 5e-110 < (sin.f64 kx) Initial program 99.4%
clear-num99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.4%
associate-/r/99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 66.6%
Final simplification48.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.2) (fabs (* th (/ (sin ky) (sin kx)))) (if (<= (sin kx) 5e-110) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.2) {
tmp = fabs((th * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 5e-110) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.2d0)) then
tmp = abs((th * (sin(ky) / sin(kx))))
else if (sin(kx) <= 5d-110) then
tmp = sin(th)
else
tmp = sin(ky) * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.2) {
tmp = Math.abs((th * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-110) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.2: tmp = math.fabs((th * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 5e-110: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.2) tmp = abs(Float64(th * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 5e-110) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.2) tmp = abs((th * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 5e-110) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.2], N[Abs[N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-110], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.2:\\
\;\;\;\;\left|th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-110}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.20000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 10.9%
Taylor expanded in th around 0 11.1%
div-inv11.1%
*-commutative11.1%
associate-*l*11.1%
Applied egg-rr11.1%
add-sqr-sqrt8.4%
sqrt-unprod18.2%
pow218.2%
div-inv18.2%
Applied egg-rr18.2%
unpow218.2%
rem-sqrt-square27.4%
associate-*r/27.5%
*-commutative27.5%
associate-/l*27.5%
Simplified27.5%
if -0.20000000000000001 < (sin.f64 kx) < 5e-110Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/88.7%
associate-/l*92.1%
unpow292.1%
Simplified99.8%
Taylor expanded in kx around 0 44.2%
if 5e-110 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in ky around 0 66.6%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 96.5%
unpow296.5%
sqr-neg96.5%
sin-neg96.5%
sin-neg96.5%
unpow296.5%
associate-*l/95.0%
associate-/l*96.4%
unpow296.4%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.2) (fabs (* th (/ (sin ky) (sin kx)))) (if (<= (sin kx) 1e-105) (sin th) (* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.2) {
tmp = fabs((th * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 1e-105) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.2d0)) then
tmp = abs((th * (sin(ky) / sin(kx))))
else if (sin(kx) <= 1d-105) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.2) {
tmp = Math.abs((th * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-105) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.2: tmp = math.fabs((th * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 1e-105: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.2) tmp = abs(Float64(th * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 1e-105) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.2) tmp = abs((th * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 1e-105) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.2], N[Abs[N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-105], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.2:\\
\;\;\;\;\left|th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-105}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.20000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 10.9%
Taylor expanded in th around 0 11.1%
div-inv11.1%
*-commutative11.1%
associate-*l*11.1%
Applied egg-rr11.1%
add-sqr-sqrt8.4%
sqrt-unprod18.2%
pow218.2%
div-inv18.2%
Applied egg-rr18.2%
unpow218.2%
rem-sqrt-square27.4%
associate-*r/27.5%
*-commutative27.5%
associate-/l*27.5%
Simplified27.5%
if -0.20000000000000001 < (sin.f64 kx) < 9.99999999999999965e-106Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/88.7%
associate-/l*92.1%
unpow292.1%
Simplified99.8%
Taylor expanded in kx around 0 44.2%
if 9.99999999999999965e-106 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 61.9%
Final simplification46.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ ky (sin kx))))
(if (<= (sin kx) -0.2)
(fabs (* th t_1))
(if (<= (sin kx) 1e-105) (sin th) (* (sin th) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = ky / sin(kx);
double tmp;
if (sin(kx) <= -0.2) {
tmp = fabs((th * t_1));
} else if (sin(kx) <= 1e-105) {
tmp = sin(th);
} else {
tmp = sin(th) * t_1;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = ky / sin(kx)
if (sin(kx) <= (-0.2d0)) then
tmp = abs((th * t_1))
else if (sin(kx) <= 1d-105) then
tmp = sin(th)
else
tmp = sin(th) * t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = ky / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.2) {
tmp = Math.abs((th * t_1));
} else if (Math.sin(kx) <= 1e-105) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = ky / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.2: tmp = math.fabs((th * t_1)) elif math.sin(kx) <= 1e-105: tmp = math.sin(th) else: tmp = math.sin(th) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(ky / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.2) tmp = abs(Float64(th * t_1)); elseif (sin(kx) <= 1e-105) tmp = sin(th); else tmp = Float64(sin(th) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = ky / sin(kx); tmp = 0.0; if (sin(kx) <= -0.2) tmp = abs((th * t_1)); elseif (sin(kx) <= 1e-105) tmp = sin(th); else tmp = sin(th) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.2], N[Abs[N[(th * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-105], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{ky}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.2:\\
\;\;\;\;\left|th \cdot t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-105}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.20000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in th around 0 57.1%
Taylor expanded in ky around 0 10.7%
associate-/l*10.7%
Simplified10.7%
add-sqr-sqrt8.7%
sqrt-unprod16.2%
pow216.2%
Applied egg-rr16.2%
unpow216.2%
rem-sqrt-square24.6%
associate-*r/24.6%
*-rgt-identity24.6%
times-frac24.6%
/-rgt-identity24.6%
Simplified24.6%
if -0.20000000000000001 < (sin.f64 kx) < 9.99999999999999965e-106Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/88.7%
associate-/l*92.1%
unpow292.1%
Simplified99.8%
Taylor expanded in kx around 0 44.2%
if 9.99999999999999965e-106 < (sin.f64 kx) Initial program 99.4%
Taylor expanded in ky around 0 61.9%
Final simplification46.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.2) (fabs (* th (/ ky (sin kx)))) (if (<= (sin kx) 1e-105) (sin th) (* ky (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.2) {
tmp = fabs((th * (ky / sin(kx))));
} else if (sin(kx) <= 1e-105) {
tmp = sin(th);
} else {
tmp = ky * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.2d0)) then
tmp = abs((th * (ky / sin(kx))))
else if (sin(kx) <= 1d-105) then
tmp = sin(th)
else
tmp = ky * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.2) {
tmp = Math.abs((th * (ky / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-105) {
tmp = Math.sin(th);
} else {
tmp = ky * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.2: tmp = math.fabs((th * (ky / math.sin(kx)))) elif math.sin(kx) <= 1e-105: tmp = math.sin(th) else: tmp = ky * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.2) tmp = abs(Float64(th * Float64(ky / sin(kx)))); elseif (sin(kx) <= 1e-105) tmp = sin(th); else tmp = Float64(ky * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.2) tmp = abs((th * (ky / sin(kx)))); elseif (sin(kx) <= 1e-105) tmp = sin(th); else tmp = ky * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.2], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-105], N[Sin[th], $MachinePrecision], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.2:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-105}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.20000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in th around 0 57.1%
Taylor expanded in ky around 0 10.7%
associate-/l*10.7%
Simplified10.7%
add-sqr-sqrt8.7%
sqrt-unprod16.2%
pow216.2%
Applied egg-rr16.2%
unpow216.2%
rem-sqrt-square24.6%
associate-*r/24.6%
*-rgt-identity24.6%
times-frac24.6%
/-rgt-identity24.6%
Simplified24.6%
if -0.20000000000000001 < (sin.f64 kx) < 9.99999999999999965e-106Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/88.7%
associate-/l*92.1%
unpow292.1%
Simplified99.8%
Taylor expanded in kx around 0 44.2%
if 9.99999999999999965e-106 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in ky around 0 61.9%
associate-/l*62.0%
Simplified62.0%
Final simplification46.0%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (hypot (sin ky) (sin kx)))) (if (<= th 0.00013) (/ th (/ t_1 (sin ky))) (/ (* ky (sin th)) t_1))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (th <= 0.00013) {
tmp = th / (t_1 / sin(ky));
} else {
tmp = (ky * sin(th)) / t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (th <= 0.00013) {
tmp = th / (t_1 / Math.sin(ky));
} else {
tmp = (ky * Math.sin(th)) / t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if th <= 0.00013: tmp = th / (t_1 / math.sin(ky)) else: tmp = (ky * math.sin(th)) / t_1 return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (th <= 0.00013) tmp = Float64(th / Float64(t_1 / sin(ky))); else tmp = Float64(Float64(ky * sin(th)) / t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (th <= 0.00013) tmp = th / (t_1 / sin(ky)); else tmp = (ky * sin(th)) / t_1; 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[th, 0.00013], N[(th / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;th \leq 0.00013:\\
\;\;\;\;\frac{th}{\frac{t\_1}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{t\_1}\\
\end{array}
\end{array}
if th < 1.29999999999999989e-4Initial program 96.9%
unpow296.9%
sqr-neg96.9%
sin-neg96.9%
sin-neg96.9%
unpow296.9%
associate-*l/94.9%
associate-/l*96.8%
unpow296.8%
Simplified99.6%
Taylor expanded in th around 0 64.0%
associate-*l*65.6%
sqrt-div66.6%
metadata-eval66.6%
+-commutative66.6%
unpow266.6%
unpow266.6%
hypot-undefine69.3%
div-inv69.4%
clear-num69.3%
un-div-inv69.4%
Applied egg-rr69.4%
if 1.29999999999999989e-4 < th Initial program 95.4%
unpow295.4%
sqr-neg95.4%
sin-neg95.4%
sin-neg95.4%
unpow295.4%
associate-*l/95.4%
associate-/l*95.4%
unpow295.4%
Simplified99.6%
*-commutative99.6%
associate-*l/99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 58.9%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.00035) (sin th) (fabs (* th (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.00035) {
tmp = sin(th);
} else {
tmp = fabs((th * (ky / sin(kx))));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 0.00035d0) then
tmp = sin(th)
else
tmp = abs((th * (ky / sin(kx))))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.00035) {
tmp = Math.sin(th);
} else {
tmp = Math.abs((th * (ky / Math.sin(kx))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.00035: tmp = math.sin(th) else: tmp = math.fabs((th * (ky / math.sin(kx)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.00035) tmp = sin(th); else tmp = abs(Float64(th * Float64(ky / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.00035) tmp = sin(th); else tmp = abs((th * (ky / sin(kx)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.00035], N[Sin[th], $MachinePrecision], N[Abs[N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.00035:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|th \cdot \frac{ky}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 3.49999999999999996e-4Initial program 95.4%
unpow295.4%
sqr-neg95.4%
sin-neg95.4%
sin-neg95.4%
unpow295.4%
associate-*l/93.4%
associate-/l*95.3%
unpow295.3%
Simplified99.7%
Taylor expanded in kx around 0 32.7%
if 3.49999999999999996e-4 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.3%
unpow299.3%
Simplified99.5%
Taylor expanded in th around 0 52.9%
Taylor expanded in ky around 0 25.3%
associate-/l*25.4%
Simplified25.4%
add-sqr-sqrt15.4%
sqrt-unprod15.7%
pow215.7%
Applied egg-rr15.7%
unpow215.7%
rem-sqrt-square22.6%
associate-*r/22.5%
*-rgt-identity22.5%
times-frac22.6%
/-rgt-identity22.6%
Simplified22.6%
Final simplification29.9%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.00035) (sin th) (* th (/ ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.00035) {
tmp = sin(th);
} else {
tmp = th * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 0.00035d0) then
tmp = sin(th)
else
tmp = th * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.00035) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.00035: tmp = math.sin(th) else: tmp = th * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.00035) tmp = sin(th); else tmp = Float64(th * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.00035) tmp = sin(th); else tmp = th * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.00035], N[Sin[th], $MachinePrecision], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.00035:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if kx < 3.49999999999999996e-4Initial program 95.4%
unpow295.4%
sqr-neg95.4%
sin-neg95.4%
sin-neg95.4%
unpow295.4%
associate-*l/93.4%
associate-/l*95.3%
unpow295.3%
Simplified99.7%
Taylor expanded in kx around 0 32.7%
if 3.49999999999999996e-4 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.3%
unpow299.3%
Simplified99.5%
Taylor expanded in th around 0 52.9%
Taylor expanded in ky around 0 25.3%
associate-/l*25.4%
Simplified25.4%
Taylor expanded in ky around 0 25.3%
*-rgt-identity25.3%
times-frac25.4%
/-rgt-identity25.4%
Simplified25.4%
Final simplification30.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.00033) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.00033) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 0.00033d0) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.00033) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.00033: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.00033) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.00033) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.00033], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.00033:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 3.3e-4Initial program 95.4%
unpow295.4%
sqr-neg95.4%
sin-neg95.4%
sin-neg95.4%
unpow295.4%
associate-*l/93.4%
associate-/l*95.3%
unpow295.3%
Simplified99.7%
Taylor expanded in kx around 0 32.7%
if 3.3e-4 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.3%
unpow299.3%
Simplified99.5%
Taylor expanded in th around 0 52.9%
Taylor expanded in ky around 0 25.3%
associate-/l*25.4%
Simplified25.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8.8e-175) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.8e-175) {
tmp = ky * (th / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 8.8d-175) then
tmp = ky * (th / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.8e-175) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8.8e-175: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8.8e-175) tmp = Float64(ky * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 8.8e-175) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8.8e-175], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8.8 \cdot 10^{-175}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.8e-175Initial program 95.0%
unpow295.0%
sqr-neg95.0%
sin-neg95.0%
sin-neg95.0%
unpow295.0%
associate-*l/94.3%
associate-/l*95.0%
unpow295.0%
Simplified99.6%
Taylor expanded in th around 0 47.1%
Taylor expanded in ky around 0 21.9%
associate-/l*23.4%
Simplified23.4%
Taylor expanded in kx around 0 18.5%
associate-/l*20.0%
Simplified20.0%
if 8.8e-175 < ky Initial program 98.7%
unpow298.7%
sqr-neg98.7%
sin-neg98.7%
sin-neg98.7%
unpow298.7%
associate-*l/96.0%
associate-/l*98.6%
unpow298.6%
Simplified99.6%
Taylor expanded in kx around 0 36.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.25e-105) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.25e-105) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 1.25d-105) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.25e-105) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.25e-105: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.25e-105) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.25e-105) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.25e-105], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.25 \cdot 10^{-105}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 1.24999999999999991e-105Initial program 94.9%
unpow294.9%
sqr-neg94.9%
sin-neg94.9%
sin-neg94.9%
unpow294.9%
associate-*l/93.1%
associate-/l*94.8%
unpow294.8%
Simplified99.6%
Taylor expanded in th around 0 46.4%
Taylor expanded in ky around 0 21.4%
associate-/l*22.7%
Simplified22.7%
Taylor expanded in kx around 0 18.3%
associate-/l*19.6%
Simplified19.6%
if 1.24999999999999991e-105 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/98.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in th around 0 49.5%
Taylor expanded in kx around 0 19.4%
(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 96.5%
unpow296.5%
sqr-neg96.5%
sin-neg96.5%
sin-neg96.5%
unpow296.5%
associate-*l/95.0%
associate-/l*96.4%
unpow296.4%
Simplified99.6%
Taylor expanded in th around 0 47.4%
Taylor expanded in kx around 0 13.7%
herbie shell --seed 2024109
(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)))