
(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 19 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 kx) -0.01)
(* (* (sin th) ky) (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))))
(if (<= (sin kx) 0.05)
(* (sin ky) (/ (sin th) (fabs (sin ky))))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(kx) <= 0.05) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) * (sin(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.01d0)) then
tmp = (sin(th) * ky) * sqrt((1.0d0 / (0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
else if (sin(kx) <= 0.05d0) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
else
tmp = sin(th) * (sin(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.01) {
tmp = (Math.sin(th) * ky) * Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(kx) <= 0.05) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = (math.sin(th) * ky) * math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(kx) <= 0.05: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = Float64(Float64(sin(th) * ky) * sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(kx) <= 0.05) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.01) tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(kx) <= 0.05) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.05], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.01:\\
\;\;\;\;\left(\sin th \cdot ky\right) \cdot \sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin kx \leq 0.05:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
unpow299.4%
sin-mult97.7%
Applied egg-rr97.7%
div-sub97.7%
+-inverses97.7%
+-inverses97.7%
+-inverses97.7%
cos-097.7%
metadata-eval97.7%
count-297.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in ky around 0 58.6%
Taylor expanded in ky around 0 50.4%
if -0.0100000000000000002 < (sin.f64 kx) < 0.050000000000000003Initial program 87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
associate-*l/81.3%
associate-/l*86.9%
unpow286.9%
Simplified99.7%
Taylor expanded in kx around 0 41.8%
add-sqr-sqrt40.0%
sqrt-prod71.9%
rem-sqrt-square79.1%
Applied egg-rr79.1%
if 0.050000000000000003 < (sin.f64 kx) Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 55.4%
Final simplification65.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.01) (* (* (sin th) ky) (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0))))))) (if (<= (sin kx) 5e-64) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(kx) <= 5e-64) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(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.01d0)) then
tmp = (sin(th) * ky) * sqrt((1.0d0 / (0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
else if (sin(kx) <= 5d-64) then
tmp = sin(th)
else
tmp = sin(th) * (sin(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.01) {
tmp = (Math.sin(th) * ky) * Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(kx) <= 5e-64) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = (math.sin(th) * ky) * math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(kx) <= 5e-64: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = Float64(Float64(sin(th) * ky) * sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(kx) <= 5e-64) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.01) tmp = (sin(th) * ky) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(kx) <= 5e-64) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-64], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.01:\\
\;\;\;\;\left(\sin th \cdot ky\right) \cdot \sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-64}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
unpow299.4%
sin-mult97.7%
Applied egg-rr97.7%
div-sub97.7%
+-inverses97.7%
+-inverses97.7%
+-inverses97.7%
cos-097.7%
metadata-eval97.7%
count-297.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in ky around 0 58.6%
Taylor expanded in ky around 0 50.4%
if -0.0100000000000000002 < (sin.f64 kx) < 5.00000000000000033e-64Initial program 85.9%
unpow285.9%
sqr-neg85.9%
sin-neg85.9%
sin-neg85.9%
unpow285.9%
associate-*l/79.6%
associate-/l*85.7%
unpow285.7%
Simplified99.7%
Taylor expanded in kx around 0 43.5%
if 5.00000000000000033e-64 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 56.4%
Final simplification49.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.01) (* (sin th) (/ ky (sqrt (- 0.5 (* 0.5 (cos (* kx 2.0))))))) (if (<= (sin kx) 5e-64) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = sin(th) * (ky / sqrt((0.5 - (0.5 * cos((kx * 2.0))))));
} else if (sin(kx) <= 5e-64) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(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.01d0)) then
tmp = sin(th) * (ky / sqrt((0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
else if (sin(kx) <= 5d-64) then
tmp = sin(th)
else
tmp = sin(th) * (sin(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.01) {
tmp = Math.sin(th) * (ky / Math.sqrt((0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else if (Math.sin(kx) <= 5e-64) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = math.sin(th) * (ky / math.sqrt((0.5 - (0.5 * math.cos((kx * 2.0)))))) elif math.sin(kx) <= 5e-64: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = Float64(sin(th) * Float64(ky / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); elseif (sin(kx) <= 5e-64) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.01) tmp = sin(th) * (ky / sqrt((0.5 - (0.5 * cos((kx * 2.0)))))); elseif (sin(kx) <= 5e-64) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[(0.5 - N[(0.5 * N[Cos[N[(kx * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-64], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.01:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sqrt{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-64}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
unpow299.4%
sin-mult97.7%
Applied egg-rr97.7%
div-sub97.7%
+-inverses97.7%
+-inverses97.7%
+-inverses97.7%
cos-097.7%
metadata-eval97.7%
count-297.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in ky around 0 58.6%
Taylor expanded in ky around 0 50.4%
if -0.0100000000000000002 < (sin.f64 kx) < 5.00000000000000033e-64Initial program 85.9%
unpow285.9%
sqr-neg85.9%
sin-neg85.9%
sin-neg85.9%
unpow285.9%
associate-*l/79.6%
associate-/l*85.7%
unpow285.7%
Simplified99.7%
Taylor expanded in kx around 0 43.5%
if 5.00000000000000033e-64 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 56.4%
Final simplification49.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.05) (fabs (sin th)) (if (<= (sin ky) 4e-162) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 4e-162) {
tmp = sin(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.05d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 4d-162) then
tmp = sin(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.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 4e-162) {
tmp = Math.sin(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.05: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 4e-162: tmp = math.sin(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.05) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-162) tmp = Float64(sin(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.05) tmp = abs(sin(th)); elseif (sin(ky) <= 4e-162) tmp = sin(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.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-162], N[(N[Sin[ky], $MachinePrecision] * 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.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-162}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.050000000000000003Initial 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.7%
add-sqr-sqrt1.2%
sqrt-unprod28.8%
pow228.8%
Applied egg-rr28.8%
unpow228.8%
rem-sqrt-square33.1%
associate-*r/33.1%
associate-*l/33.2%
*-inverses33.2%
*-lft-identity33.2%
Simplified33.2%
if -0.050000000000000003 < (sin.f64 ky) < 3.99999999999999982e-162Initial program 83.5%
unpow283.5%
sqr-neg83.5%
sin-neg83.5%
sin-neg83.5%
unpow283.5%
associate-*l/78.5%
associate-/l*83.6%
unpow283.6%
Simplified99.6%
Taylor expanded in ky around 0 54.2%
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 (* (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 (<= th 0.027)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= th 2.5e+146)
(* (sin th) (/ (sin ky) (fabs (sin kx))))
(* (sin ky) (/ (sin th) (fabs (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.027) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (th <= 2.5e+146) {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.027) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (th <= 2.5e+146) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.027: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif th <= 2.5e+146: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.027) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (th <= 2.5e+146) tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.027) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (th <= 2.5e+146) tmp = sin(th) * (sin(ky) / abs(sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.027], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 2.5e+146], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.027:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 2.5 \cdot 10^{+146}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if th < 0.0269999999999999997Initial 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.0269999999999999997 < th < 2.4999999999999999e146Initial program 88.7%
unpow288.7%
sin-mult78.1%
Applied egg-rr78.1%
div-sub78.1%
+-inverses78.1%
+-inverses78.1%
+-inverses78.1%
cos-078.1%
metadata-eval78.1%
count-278.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in ky around 0 36.1%
add-sqr-sqrt36.1%
rem-sqrt-square36.1%
sqr-sin-a47.1%
sqrt-unprod28.1%
add-sqr-sqrt51.1%
Applied egg-rr51.1%
if 2.4999999999999999e146 < th Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in kx around 0 26.2%
add-sqr-sqrt25.2%
sqrt-prod42.2%
rem-sqrt-square42.4%
Applied egg-rr42.4%
Final simplification65.2%
(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%
Applied egg-rr27.9%
unpow227.9%
rem-sqrt-square32.0%
associate-*r/32.0%
associate-*l/32.1%
*-inverses32.1%
*-lft-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 (<= ky 0.0195) (/ (sin th) (/ (hypot ky (sin kx)) (sin ky))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0195) {
tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.0195) {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / Math.sin(ky));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.0195: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / math.sin(ky)) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.0195) tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / sin(ky))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.0195) tmp = sin(th) / (hypot(ky, sin(kx)) / sin(ky)); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.0195], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.0195:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 0.0195Initial 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.6%
associate-*r/93.2%
hypot-undefine87.3%
unpow287.3%
unpow287.3%
+-commutative87.3%
associate-*l/91.1%
*-commutative91.1%
clear-num91.0%
un-div-inv91.1%
+-commutative91.1%
unpow291.1%
unpow291.1%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 68.0%
if 0.0195 < 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.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 29.0%
add-sqr-sqrt27.4%
sqrt-prod57.0%
rem-sqrt-square57.0%
Applied egg-rr57.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 0.014) (* (sin th) (/ (sin ky) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.014) {
tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.014) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.014: tmp = math.sin(th) * (math.sin(ky) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.014) tmp = Float64(sin(th) * Float64(sin(ky) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.014) tmp = sin(th) * (sin(ky) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.014], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.014:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 0.0140000000000000003Initial program 91.1%
+-commutative91.1%
unpow291.1%
unpow291.1%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 68.0%
if 0.0140000000000000003 < 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.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 29.0%
add-sqr-sqrt27.4%
sqrt-prod57.0%
rem-sqrt-square57.0%
Applied egg-rr57.0%
Final simplification64.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 0.009) (* (sin ky) (/ (sin th) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.009) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.009) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.009: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.009) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.009) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.009], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.009:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 0.00899999999999999932Initial 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.6%
Taylor expanded in ky around 0 68.0%
if 0.00899999999999999932 < 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.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 29.0%
add-sqr-sqrt27.4%
sqrt-prod57.0%
rem-sqrt-square57.0%
Applied egg-rr57.0%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.104) (* (sin ky) (/ (sin th) (fabs (sin ky)))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.104) {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
} else {
tmp = sin(th) * (sin(ky) / fabs(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.104d0) then
tmp = sin(ky) * (sin(th) / abs(sin(ky)))
else
tmp = sin(th) * (sin(ky) / abs(sin(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.104) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.104: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.104) tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.104) tmp = sin(ky) * (sin(th) / abs(sin(ky))); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.104], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.104:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 0.103999999999999995Initial program 91.6%
unpow291.6%
sqr-neg91.6%
sin-neg91.6%
sin-neg91.6%
unpow291.6%
associate-*l/88.0%
associate-/l*91.5%
unpow291.5%
Simplified99.6%
Taylor expanded in kx around 0 29.3%
add-sqr-sqrt27.5%
sqrt-prod50.4%
rem-sqrt-square55.2%
Applied egg-rr55.2%
if 0.103999999999999995 < kx Initial program 99.4%
unpow299.4%
sin-mult99.1%
Applied egg-rr99.1%
div-sub99.1%
+-inverses99.1%
+-inverses99.1%
+-inverses99.1%
cos-099.1%
metadata-eval99.1%
count-299.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in ky around 0 58.3%
add-sqr-sqrt58.3%
rem-sqrt-square58.3%
sqr-sin-a58.7%
sqrt-unprod28.7%
add-sqr-sqrt58.7%
Applied egg-rr58.7%
Final simplification56.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.5e-223) (* 0.16666666666666666 (* (sin ky) (* th ky))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.5e-223) {
tmp = 0.16666666666666666 * (sin(ky) * (th * ky));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 2.5d-223) then
tmp = 0.16666666666666666d0 * (sin(ky) * (th * ky))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.5e-223) {
tmp = 0.16666666666666666 * (Math.sin(ky) * (th * ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.5e-223: tmp = 0.16666666666666666 * (math.sin(ky) * (th * ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.5e-223) tmp = Float64(0.16666666666666666 * Float64(sin(ky) * Float64(th * ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.5e-223) tmp = 0.16666666666666666 * (sin(ky) * (th * ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.5e-223], N[(0.16666666666666666 * N[(N[Sin[ky], $MachinePrecision] * N[(th * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.5 \cdot 10^{-223}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin ky \cdot \left(th \cdot ky\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.50000000000000012e-223Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/88.6%
associate-/l*91.9%
unpow291.9%
Simplified99.6%
Taylor expanded in kx around 0 15.5%
Taylor expanded in ky around 0 3.6%
associate-*r*3.6%
distribute-rgt1-in3.6%
Simplified3.6%
Taylor expanded in th around 0 3.7%
associate-/l*3.7%
+-commutative3.7%
*-commutative3.7%
fma-define3.7%
Simplified3.7%
Taylor expanded in ky around inf 15.1%
associate-*r*15.1%
Simplified15.1%
if 2.50000000000000012e-223 < ky Initial program 95.5%
unpow295.5%
sqr-neg95.5%
sin-neg95.5%
sin-neg95.5%
unpow295.5%
associate-*l/93.5%
associate-/l*95.3%
unpow295.3%
Simplified99.5%
Taylor expanded in kx around 0 33.9%
Final simplification23.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4e-224) (log (+ th 1.0)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4e-224) {
tmp = log((th + 1.0));
} 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 <= 4d-224) then
tmp = log((th + 1.0d0))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4e-224) {
tmp = Math.log((th + 1.0));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4e-224: tmp = math.log((th + 1.0)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4e-224) tmp = log(Float64(th + 1.0)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 4e-224) tmp = log((th + 1.0)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4e-224], N[Log[N[(th + 1.0), $MachinePrecision]], $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4 \cdot 10^{-224}:\\
\;\;\;\;\log \left(th + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 4.0000000000000001e-224Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/88.6%
associate-/l*91.9%
unpow291.9%
Simplified99.6%
Taylor expanded in kx around 0 15.6%
add-log-exp21.8%
Applied egg-rr21.8%
Taylor expanded in th around 0 15.4%
if 4.0000000000000001e-224 < ky Initial program 95.5%
unpow295.5%
sqr-neg95.5%
sin-neg95.5%
sin-neg95.5%
unpow295.5%
associate-*l/93.5%
associate-/l*95.3%
unpow295.3%
Simplified99.5%
Taylor expanded in kx around 0 33.9%
Final simplification23.8%
(FPCore (kx ky th) :precision binary64 (if (<= th 5.2e-8) th (log th)))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 5.2e-8) {
tmp = th;
} else {
tmp = log(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 (th <= 5.2d-8) then
tmp = th
else
tmp = log(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 5.2e-8) {
tmp = th;
} else {
tmp = Math.log(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 5.2e-8: tmp = th else: tmp = math.log(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 5.2e-8) tmp = th; else tmp = log(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 5.2e-8) tmp = th; else tmp = log(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 5.2e-8], th, N[Log[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 5.2 \cdot 10^{-8}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;\log th\\
\end{array}
\end{array}
if th < 5.2000000000000002e-8Initial program 93.2%
unpow293.2%
sqr-neg93.2%
sin-neg93.2%
sin-neg93.2%
unpow293.2%
associate-*l/89.6%
associate-/l*93.1%
unpow293.1%
Simplified99.6%
Taylor expanded in kx around 0 22.7%
Taylor expanded in th around 0 16.5%
if 5.2000000000000002e-8 < th Initial program 94.8%
unpow294.8%
sqr-neg94.8%
sin-neg94.8%
sin-neg94.8%
unpow294.8%
associate-*l/94.8%
associate-/l*94.7%
unpow294.7%
Simplified99.4%
Taylor expanded in kx around 0 27.6%
add-log-exp27.1%
Applied egg-rr27.1%
Taylor expanded in th around 0 5.5%
Taylor expanded in th around inf 5.8%
mul-1-neg5.8%
log-rec5.8%
remove-double-neg5.8%
Simplified5.8%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return 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(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin 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.9%
(FPCore (kx ky th) :precision binary64 (log1p th))
double code(double kx, double ky, double th) {
return log1p(th);
}
public static double code(double kx, double ky, double th) {
return Math.log1p(th);
}
def code(kx, ky, th): return math.log1p(th)
function code(kx, ky, th) return log1p(th) end
code[kx_, ky_, th_] := N[Log[1 + th], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{log1p}\left(th\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%
Taylor expanded in kx around 0 23.9%
add-log-exp22.5%
Applied egg-rr22.5%
Taylor expanded in th around 0 12.0%
*-un-lft-identity12.0%
log-prod12.0%
metadata-eval12.0%
log1p-define13.3%
Applied egg-rr13.3%
+-lft-identity13.3%
Simplified13.3%
(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)))