
(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 th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/90.8%
associate-/l*93.5%
unpow293.5%
Simplified99.6%
associate-*r/95.0%
hypot-undefine90.8%
unpow290.8%
unpow290.8%
+-commutative90.8%
associate-*l/93.6%
*-commutative93.6%
clear-num93.5%
un-div-inv93.6%
+-commutative93.6%
unpow293.6%
unpow293.6%
hypot-undefine99.6%
Applied egg-rr99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 2e-7) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-7) {
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) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-7) 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) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-7) {
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) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-7: 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) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-7) 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) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-7) 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], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-7], 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 -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial 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.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.2%
sqrt-unprod27.3%
pow227.3%
associate-*r/27.3%
*-commutative27.3%
associate-/l*27.3%
Applied egg-rr27.3%
unpow227.3%
rem-sqrt-square31.5%
*-inverses31.5%
*-rgt-identity31.5%
Simplified31.5%
if -0.0200000000000000004 < (sin.f64 ky) < 1.9999999999999999e-7Initial program 86.6%
clear-num86.6%
inv-pow86.6%
+-commutative86.6%
unpow286.6%
unpow286.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 52.4%
add-sqr-sqrt23.5%
sqrt-unprod35.9%
pow235.9%
unpow-135.9%
clear-num35.9%
Applied egg-rr35.9%
unpow235.9%
rem-sqrt-square41.8%
Simplified41.8%
if 1.9999999999999999e-7 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 62.0%
Final simplification43.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (* (sin ky) (/ (sin th) (fabs (sin ky)))) (/ (* (sin th) ky) (hypot ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = (sin(th) * ky) / hypot(ky, sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = (Math.sin(th) * ky) / Math.hypot(ky, Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = (math.sin(th) * ky) / math.hypot(ky, math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(Float64(sin(th) * ky) / hypot(ky, sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = (sin(th) * ky) / hypot(ky, sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial 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.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt0.0%
sqrt-prod56.3%
rem-sqrt-square56.3%
Applied egg-rr56.3%
if -0.0200000000000000004 < (sin.f64 ky) Initial program 91.0%
unpow291.0%
sqr-neg91.0%
sin-neg91.0%
sin-neg91.0%
unpow291.0%
associate-*l/87.2%
associate-/l*90.9%
unpow290.9%
Simplified99.5%
associate-*r/93.1%
Applied egg-rr93.1%
Taylor expanded in ky around 0 62.0%
Taylor expanded in ky around 0 71.7%
Final simplification67.1%
(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 93.6%
+-commutative93.6%
unpow293.6%
unpow293.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/90.8%
associate-/l*93.5%
unpow293.5%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.038) (fabs (sin th)) (if (<= (sin ky) 4e-162) (* (sin th) (* ky (/ 1.0 (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.038) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-162) {
tmp = sin(th) * (ky * (1.0 / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.038d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 4d-162) then
tmp = sin(th) * (ky * (1.0d0 / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.038) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-162) {
tmp = Math.sin(th) * (ky * (1.0 / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.038: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-162: tmp = math.sin(th) * (ky * (1.0 / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.038) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-162) tmp = Float64(sin(th) * Float64(ky * Float64(1.0 / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.038) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-162) tmp = sin(th) * (ky * (1.0 / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.038], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-162], N[(N[Sin[th], $MachinePrecision] * N[(ky * N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.038:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-162}:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \frac{1}{\sin kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0379999999999999991Initial 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.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.2%
sqrt-unprod27.9%
pow227.9%
associate-*r/27.9%
*-commutative27.9%
associate-/l*27.9%
Applied egg-rr27.9%
unpow227.9%
rem-sqrt-square32.1%
*-inverses32.1%
*-rgt-identity32.1%
Simplified32.1%
if -0.0379999999999999991 < (sin.f64 ky) < 3.99999999999999982e-162Initial program 83.0%
clear-num83.0%
inv-pow83.0%
+-commutative83.0%
unpow283.0%
unpow283.0%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 55.4%
unpow-155.4%
associate-/r/55.5%
Applied egg-rr55.5%
if 3.99999999999999982e-162 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.4%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 56.3%
Final simplification49.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 5e-64) (sin th) (* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 5e-64) {
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.02d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 5d-64) 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.02) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 5e-64) {
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.02: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 5e-64: 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.02) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-64) 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.02) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 5e-64) 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.02], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-64], 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.02:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-64}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.4%
clear-num99.4%
inv-pow99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 20.1%
add-sqr-sqrt18.9%
sqrt-unprod32.6%
pow232.6%
*-commutative32.6%
unpow-132.6%
clear-num32.6%
Applied egg-rr32.6%
unpow232.6%
rem-sqrt-square35.1%
associate-*r/35.1%
*-commutative35.1%
associate-/l*35.1%
Simplified35.1%
if -0.0200000000000000004 < (sin.f64 kx) < 5.00000000000000033e-64Initial program 86.0%
unpow286.0%
sqr-neg86.0%
sin-neg86.0%
sin-neg86.0%
unpow286.0%
associate-*l/79.8%
associate-/l*85.9%
unpow285.9%
Simplified99.7%
Taylor expanded in kx around 0 43.1%
if 5.00000000000000033e-64 < (sin.f64 kx) Initial program 99.5%
Taylor expanded in ky around 0 48.3%
Final simplification42.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.038) (fabs (sin th)) (if (<= (sin ky) 4e-162) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.038) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-162) {
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) <= (-0.038d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 4d-162) 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) <= -0.038) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-162) {
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) <= -0.038: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-162: 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) <= -0.038) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-162) 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) <= -0.038) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-162) 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], -0.038], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-162], 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 -0.038:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-162}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0379999999999999991Initial 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.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.2%
sqrt-unprod27.9%
pow227.9%
associate-*r/27.9%
*-commutative27.9%
associate-/l*27.9%
Applied egg-rr27.9%
unpow227.9%
rem-sqrt-square32.1%
*-inverses32.1%
*-rgt-identity32.1%
Simplified32.1%
if -0.0379999999999999991 < (sin.f64 ky) < 3.99999999999999982e-162Initial program 83.0%
unpow283.0%
sqr-neg83.0%
sin-neg83.0%
sin-neg83.0%
unpow283.0%
associate-*l/77.9%
associate-/l*83.1%
unpow283.1%
Simplified99.6%
Taylor expanded in ky around 0 53.3%
associate-/l*55.5%
Simplified55.5%
if 3.99999999999999982e-162 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.4%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 56.3%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.0028) (/ th (/ (hypot (sin ky) (sin kx)) (sin ky))) (/ (* (sin th) ky) (hypot ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0028) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else {
tmp = (sin(th) * ky) / hypot(ky, sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0028) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else {
tmp = (Math.sin(th) * ky) / Math.hypot(ky, Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0028: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) else: tmp = (math.sin(th) * ky) / math.hypot(ky, math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0028) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); else tmp = Float64(Float64(sin(th) * ky) / hypot(ky, sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0028) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); else tmp = (sin(th) * ky) / hypot(ky, sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0028], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0028:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 0.00279999999999999997Initial program 93.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/89.7%
associate-/l*93.1%
unpow293.1%
Simplified99.6%
associate-*r/93.7%
hypot-undefine89.7%
unpow289.7%
unpow289.7%
+-commutative89.7%
associate-*l/93.2%
*-commutative93.2%
clear-num93.2%
un-div-inv93.2%
+-commutative93.2%
unpow293.2%
unpow293.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 71.0%
if 0.00279999999999999997 < th Initial program 94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
associate-*l/94.7%
associate-/l*94.5%
unpow294.5%
Simplified99.4%
associate-*r/99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 49.1%
Taylor expanded in ky around 0 60.0%
Final simplification68.4%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.0027) (* th (/ (sin ky) (hypot (sin ky) (sin kx)))) (/ (* (sin th) ky) (hypot ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0027) {
tmp = th * (sin(ky) / hypot(sin(ky), sin(kx)));
} else {
tmp = (sin(th) * ky) / hypot(ky, sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0027) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = (Math.sin(th) * ky) / Math.hypot(ky, Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0027: tmp = th * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = (math.sin(th) * ky) / math.hypot(ky, math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0027) tmp = Float64(th * Float64(sin(ky) / hypot(sin(ky), sin(kx)))); else tmp = Float64(Float64(sin(th) * ky) / hypot(ky, sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0027) tmp = th * (sin(ky) / hypot(sin(ky), sin(kx))); else tmp = (sin(th) * ky) / hypot(ky, sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0027], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0027:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 0.0027000000000000001Initial program 93.2%
+-commutative93.2%
unpow293.2%
unpow293.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 71.0%
if 0.0027000000000000001 < th Initial program 94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
associate-*l/94.7%
associate-/l*94.5%
unpow294.5%
Simplified99.4%
associate-*r/99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 49.1%
Taylor expanded in ky around 0 60.0%
Final simplification68.4%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.0027) (* (sin ky) (/ th (hypot (sin ky) (sin kx)))) (/ (* (sin th) ky) (hypot ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0027) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = (sin(th) * ky) / hypot(ky, sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0027) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = (Math.sin(th) * ky) / Math.hypot(ky, Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0027: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = (math.sin(th) * ky) / math.hypot(ky, math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0027) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(Float64(sin(th) * ky) / hypot(ky, sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0027) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = (sin(th) * ky) / hypot(ky, sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0027], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0027:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 0.0027000000000000001Initial program 93.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/89.7%
associate-/l*93.1%
unpow293.1%
Simplified99.6%
Taylor expanded in th around 0 70.9%
if 0.0027000000000000001 < th Initial program 94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
associate-*l/94.7%
associate-/l*94.5%
unpow294.5%
Simplified99.4%
associate-*r/99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 49.1%
Taylor expanded in ky around 0 60.0%
Final simplification68.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.038) (fabs (sin th)) (/ (* (sin th) ky) (hypot ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.038) {
tmp = fabs(sin(th));
} else {
tmp = (sin(th) * ky) / hypot(ky, sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.038) {
tmp = Math.abs(Math.sin(th));
} else {
tmp = (Math.sin(th) * ky) / Math.hypot(ky, Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.038: tmp = math.fabs(math.sin(th)) else: tmp = (math.sin(th) * ky) / math.hypot(ky, math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.038) tmp = abs(sin(th)); else tmp = Float64(Float64(sin(th) * ky) / hypot(ky, sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.038) tmp = abs(sin(th)); else tmp = (sin(th) * ky) / hypot(ky, sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.038], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.038:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0379999999999999991Initial 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.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.2%
sqrt-unprod27.9%
pow227.9%
associate-*r/27.9%
*-commutative27.9%
associate-/l*27.9%
Applied egg-rr27.9%
unpow227.9%
rem-sqrt-square32.1%
*-inverses32.1%
*-rgt-identity32.1%
Simplified32.1%
if -0.0379999999999999991 < (sin.f64 ky) Initial program 91.1%
unpow291.1%
sqr-neg91.1%
sin-neg91.1%
sin-neg91.1%
unpow291.1%
associate-*l/87.3%
associate-/l*91.0%
unpow291.0%
Simplified99.5%
associate-*r/93.2%
Applied egg-rr93.2%
Taylor expanded in ky around 0 61.5%
Taylor expanded in ky around 0 71.5%
Final simplification60.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.2e-152) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.2e-152) {
tmp = ky * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 1.2d-152) then
tmp = ky * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.2e-152) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.2e-152: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.2e-152) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.2e-152) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.2e-152], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.2 \cdot 10^{-152}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.2e-152Initial program 89.6%
clear-num89.5%
inv-pow89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 35.5%
Taylor expanded in kx around 0 22.0%
associate-/l*23.3%
Simplified23.3%
if 1.2e-152 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.7%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 33.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.2e-162) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.2e-162) {
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 <= 1.2d-162) 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 <= 1.2e-162) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.2e-162: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.2e-162) 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 <= 1.2e-162) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.2e-162], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.2 \cdot 10^{-162}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.2000000000000001e-162Initial program 89.5%
clear-num89.5%
inv-pow89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 35.1%
Taylor expanded in th around 0 19.6%
associate-/l*20.9%
Simplified20.9%
if 1.2000000000000001e-162 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.7%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 33.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.65e-162) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.65e-162) {
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 <= 1.65d-162) 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 <= 1.65e-162) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.65e-162: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.65e-162) 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 <= 1.65e-162) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.65e-162], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.65 \cdot 10^{-162}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.65000000000000007e-162Initial program 89.5%
clear-num89.5%
inv-pow89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 35.1%
Taylor expanded in th around 0 19.6%
associate-/l*20.9%
Simplified20.9%
Taylor expanded in kx around 0 18.3%
if 1.65000000000000007e-162 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.7%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 33.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.12e-152) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.12e-152) {
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.12d-152) 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.12e-152) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.12e-152: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.12e-152) 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.12e-152) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.12e-152], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.12 \cdot 10^{-152}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 1.12e-152Initial program 89.6%
clear-num89.5%
inv-pow89.5%
+-commutative89.5%
unpow289.5%
unpow289.5%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 35.5%
Taylor expanded in th around 0 20.1%
associate-/l*21.4%
Simplified21.4%
Taylor expanded in kx around 0 18.2%
if 1.12e-152 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.7%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 33.4%
Taylor expanded in th around 0 19.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 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/90.8%
associate-/l*93.5%
unpow293.5%
Simplified99.6%
Taylor expanded in kx around 0 23.8%
Taylor expanded in th around 0 13.2%
herbie shell --seed 2024137
(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)))