
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin ky) (/ (hypot (sin ky) (sin kx)) (sin th))))
double code(double kx, double ky, double th) {
return sin(ky) / (hypot(sin(ky), sin(kx)) / sin(th));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(th));
}
def code(kx, ky, th): return math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(th))
function code(kx, ky, th) return Float64(sin(ky) / Float64(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[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin th}}
\end{array}
Initial program 94.2%
unpow294.2%
sqr-neg94.2%
sin-neg94.2%
sin-neg94.2%
unpow294.2%
associate-*l/92.9%
associate-/l*94.2%
+-commutative94.2%
unpow294.2%
sin-neg94.2%
sin-neg94.2%
Simplified99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(sqrt (pow (sin th) 2.0))
(if (<= (sin ky) 2e-145)
(/ (sin ky) (/ (sin kx) (sin th)))
(if (<= (sin ky) 5e-68)
(* (* ky (sin th)) (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 2e-145) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if (sin(ky) <= 5e-68) {
tmp = (ky * sin(th)) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.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 (sin(ky) <= (-0.02d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 2d-145) then
tmp = sin(ky) / (sin(kx) / sin(th))
else if (sin(ky) <= 5d-68) then
tmp = (ky * sin(th)) * sqrt((1.0d0 / (0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
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.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 2e-145) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 5e-68) {
tmp = (ky * Math.sin(th)) * Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 2e-145: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 5e-68: tmp = (ky * math.sin(th)) * math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-145) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 5e-68) tmp = Float64(Float64(ky * sin(th)) * sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 2e-145) tmp = sin(ky) / (sin(kx) / sin(th)); elseif (sin(ky) <= 5e-68) tmp = (ky * sin(th)) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-145], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-68], N[(N[(ky * N[Sin[th], $MachinePrecision]), $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], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-145}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\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.6%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 3.0%
associate-/r/3.0%
*-inverses3.0%
*-un-lft-identity3.0%
add-sqr-sqrt1.4%
sqrt-unprod16.8%
pow216.8%
Applied egg-rr16.8%
if -0.0200000000000000004 < (sin.f64 ky) < 1.99999999999999983e-145Initial program 87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
associate-*l/84.9%
associate-/l*87.0%
+-commutative87.0%
unpow287.0%
sin-neg87.0%
sin-neg87.0%
Simplified99.6%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 59.8%
if 1.99999999999999983e-145 < (sin.f64 ky) < 4.99999999999999971e-68Initial program 99.5%
unpow299.5%
sin-mult93.0%
Applied egg-rr93.0%
div-sub93.0%
+-inverses93.0%
cos-093.0%
metadata-eval93.0%
count-293.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in ky around 0 57.8%
if 4.99999999999999971e-68 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.7%
Final simplification49.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(/ (sin ky) (fabs (/ (sin ky) (sin th))))
(if (<= (sin ky) 2e-145)
(/ ky (/ (sin kx) (sin th)))
(if (<= (sin ky) 5e-68)
(* (* ky (sin th)) (sqrt (/ 1.0 (- 0.5 (* 0.5 (cos (* kx 2.0)))))))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = sin(ky) / fabs((sin(ky) / sin(th)));
} else if (sin(ky) <= 2e-145) {
tmp = ky / (sin(kx) / sin(th));
} else if (sin(ky) <= 5e-68) {
tmp = (ky * sin(th)) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.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 (sin(ky) <= (-0.005d0)) then
tmp = sin(ky) / abs((sin(ky) / sin(th)))
else if (sin(ky) <= 2d-145) then
tmp = ky / (sin(kx) / sin(th))
else if (sin(ky) <= 5d-68) then
tmp = (ky * sin(th)) * sqrt((1.0d0 / (0.5d0 - (0.5d0 * cos((kx * 2.0d0))))))
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.005) {
tmp = Math.sin(ky) / Math.abs((Math.sin(ky) / Math.sin(th)));
} else if (Math.sin(ky) <= 2e-145) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 5e-68) {
tmp = (ky * Math.sin(th)) * Math.sqrt((1.0 / (0.5 - (0.5 * Math.cos((kx * 2.0))))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = math.sin(ky) / math.fabs((math.sin(ky) / math.sin(th))) elif math.sin(ky) <= 2e-145: tmp = ky / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 5e-68: tmp = (ky * math.sin(th)) * math.sqrt((1.0 / (0.5 - (0.5 * math.cos((kx * 2.0)))))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(sin(ky) / abs(Float64(sin(ky) / sin(th)))); elseif (sin(ky) <= 2e-145) tmp = Float64(ky / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 5e-68) tmp = Float64(Float64(ky * sin(th)) * sqrt(Float64(1.0 / Float64(0.5 - Float64(0.5 * cos(Float64(kx * 2.0))))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = sin(ky) / abs((sin(ky) / sin(th))); elseif (sin(ky) <= 2e-145) tmp = ky / (sin(kx) / sin(th)); elseif (sin(ky) <= 5e-68) tmp = (ky * sin(th)) * sqrt((1.0 / (0.5 - (0.5 * cos((kx * 2.0)))))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-145], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-68], N[(N[(ky * N[Sin[th], $MachinePrecision]), $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], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin ky}{\sin th}\right|}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-145}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\left(ky \cdot \sin th\right) \cdot \sqrt{\frac{1}{0.5 - 0.5 \cdot \cos \left(kx \cdot 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 3.0%
add-sqr-sqrt1.6%
sqrt-unprod25.1%
pow225.1%
Applied egg-rr25.1%
unpow225.1%
rem-sqrt-square33.4%
Simplified33.4%
if -0.0050000000000000001 < (sin.f64 ky) < 1.99999999999999983e-145Initial program 86.9%
unpow286.9%
sqr-neg86.9%
sin-neg86.9%
sin-neg86.9%
unpow286.9%
associate-*l/84.8%
associate-/l*86.9%
+-commutative86.9%
unpow286.9%
sin-neg86.9%
sin-neg86.9%
Simplified99.6%
Taylor expanded in ky around 0 58.3%
associate-/l*60.3%
Simplified60.3%
clear-num60.2%
un-div-inv60.3%
Applied egg-rr60.3%
if 1.99999999999999983e-145 < (sin.f64 ky) < 4.99999999999999971e-68Initial program 99.5%
unpow299.5%
sin-mult93.0%
Applied egg-rr93.0%
div-sub93.0%
+-inverses93.0%
cos-093.0%
metadata-eval93.0%
count-293.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in ky around 0 57.8%
if 4.99999999999999971e-68 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 57.7%
Final simplification53.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (sqrt (pow (sin th) 2.0)) (if (<= (sin ky) 1e-124) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 1e-124) {
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.02d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 1d-124) 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.02) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 1e-124) {
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.02: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 1e-124: 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.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-124) 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.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-124) 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.02], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-124], 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.02:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 10^{-124}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\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.6%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 3.0%
associate-/r/3.0%
*-inverses3.0%
*-un-lft-identity3.0%
add-sqr-sqrt1.4%
sqrt-unprod16.8%
pow216.8%
Applied egg-rr16.8%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999933e-125Initial program 87.1%
unpow287.1%
sqr-neg87.1%
sin-neg87.1%
sin-neg87.1%
unpow287.1%
associate-*l/85.0%
associate-/l*87.1%
+-commutative87.1%
unpow287.1%
sin-neg87.1%
sin-neg87.1%
Simplified99.6%
Taylor expanded in ky around 0 60.1%
if 9.99999999999999933e-125 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.4%
Final simplification48.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (sqrt (pow (sin th) 2.0)) (if (<= (sin ky) 1e-124) (/ (sin ky) (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 1e-124) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 1d-124) then
tmp = sin(ky) / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 1e-124) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 1e-124: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-124) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-124) tmp = sin(ky) / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-124], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 10^{-124}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\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.6%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 3.0%
associate-/r/3.0%
*-inverses3.0%
*-un-lft-identity3.0%
add-sqr-sqrt1.4%
sqrt-unprod16.8%
pow216.8%
Applied egg-rr16.8%
if -0.0200000000000000004 < (sin.f64 ky) < 9.99999999999999933e-125Initial program 87.1%
unpow287.1%
sqr-neg87.1%
sin-neg87.1%
sin-neg87.1%
unpow287.1%
associate-*l/85.0%
associate-/l*87.1%
+-commutative87.1%
unpow287.1%
sin-neg87.1%
sin-neg87.1%
Simplified99.6%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 60.2%
if 9.99999999999999933e-125 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.4%
Final simplification48.4%
(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 94.2%
unpow294.2%
sqr-neg94.2%
sin-neg94.2%
sin-neg94.2%
unpow294.2%
associate-*l/92.9%
associate-/l*94.2%
+-commutative94.2%
unpow294.2%
sin-neg94.2%
sin-neg94.2%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.2%
+-commutative94.2%
unpow294.2%
unpow294.2%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (fabs (sin th)) (if (<= (sin ky) 1e-124) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-124) {
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.005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-124) 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.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-124) {
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.005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-124: 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.005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-124) 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.005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-124) 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.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-124], 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.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-124}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 3.0%
associate-/r/3.0%
*-inverses3.0%
*-un-lft-identity3.0%
add-sqr-sqrt1.4%
sqrt-unprod18.1%
pow218.1%
Applied egg-rr18.1%
unpow218.1%
rem-sqrt-square29.4%
Simplified29.4%
if -0.0050000000000000001 < (sin.f64 ky) < 9.99999999999999933e-125Initial program 87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
associate-*l/84.9%
associate-/l*87.0%
+-commutative87.0%
unpow287.0%
sin-neg87.0%
sin-neg87.0%
Simplified99.6%
Taylor expanded in ky around 0 58.7%
associate-/l*60.6%
Simplified60.6%
if 9.99999999999999933e-125 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.4%
Final simplification51.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (fabs (sin th)) (if (<= (sin ky) 1e-124) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-124) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-124) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-124) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-124: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-124) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-124) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-124], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-124}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 3.0%
associate-/r/3.0%
*-inverses3.0%
*-un-lft-identity3.0%
add-sqr-sqrt1.4%
sqrt-unprod18.1%
pow218.1%
Applied egg-rr18.1%
unpow218.1%
rem-sqrt-square29.4%
Simplified29.4%
if -0.0050000000000000001 < (sin.f64 ky) < 9.99999999999999933e-125Initial program 87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
associate-*l/84.9%
associate-/l*87.0%
+-commutative87.0%
unpow287.0%
sin-neg87.0%
sin-neg87.0%
Simplified99.6%
Taylor expanded in ky around 0 58.7%
associate-/l*60.6%
Simplified60.6%
clear-num60.6%
un-div-inv60.7%
Applied egg-rr60.7%
if 9.99999999999999933e-125 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.4%
Final simplification51.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (sqrt (pow (sin th) 2.0)) (if (<= (sin ky) 1e-124) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = sqrt(pow(sin(th), 2.0));
} else if (sin(ky) <= 1e-124) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.005d0)) then
tmp = sqrt((sin(th) ** 2.0d0))
else if (sin(ky) <= 1d-124) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = Math.sqrt(Math.pow(Math.sin(th), 2.0));
} else if (Math.sin(ky) <= 1e-124) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = math.sqrt(math.pow(math.sin(th), 2.0)) elif math.sin(ky) <= 1e-124: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-124) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = sqrt((sin(th) ^ 2.0)); elseif (sin(ky) <= 1e-124) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[Sqrt[N[Power[N[Sin[th], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-124], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 10^{-124}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 3.0%
associate-/r/3.0%
*-inverses3.0%
*-un-lft-identity3.0%
add-sqr-sqrt1.4%
sqrt-unprod18.1%
pow218.1%
Applied egg-rr18.1%
if -0.0050000000000000001 < (sin.f64 ky) < 9.99999999999999933e-125Initial program 87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
associate-*l/84.9%
associate-/l*87.0%
+-commutative87.0%
unpow287.0%
sin-neg87.0%
sin-neg87.0%
Simplified99.6%
Taylor expanded in ky around 0 58.7%
associate-/l*60.6%
Simplified60.6%
clear-num60.6%
un-div-inv60.7%
Applied egg-rr60.7%
if 9.99999999999999933e-125 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.4%
Final simplification48.8%
(FPCore (kx ky th)
:precision binary64
(if (<= th 1.7e-8)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= th 1.8e+40)
(/ (sin ky) (fabs (/ (sin ky) (sin th))))
(/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.7e-8) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (th <= 1.8e+40) {
tmp = sin(ky) / fabs((sin(ky) / sin(th)));
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.7e-8) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (th <= 1.8e+40) {
tmp = Math.sin(ky) / Math.abs((Math.sin(ky) / Math.sin(th)));
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 1.7e-8: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif th <= 1.8e+40: tmp = math.sin(ky) / math.fabs((math.sin(ky) / math.sin(th))) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 1.7e-8) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (th <= 1.8e+40) tmp = Float64(sin(ky) / abs(Float64(sin(ky) / sin(th)))); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 1.7e-8) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (th <= 1.8e+40) tmp = sin(ky) / abs((sin(ky) / sin(th))); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 1.7e-8], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 1.8e+40], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.7 \cdot 10^{-8}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;th \leq 1.8 \cdot 10^{+40}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin ky}{\sin th}\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if th < 1.7e-8Initial program 95.6%
unpow295.6%
sqr-neg95.6%
sin-neg95.6%
sin-neg95.6%
unpow295.6%
associate-*l/93.8%
associate-/l*95.5%
+-commutative95.5%
unpow295.5%
sin-neg95.5%
sin-neg95.5%
Simplified99.6%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 64.7%
associate-*l/64.8%
+-commutative64.8%
unpow264.8%
unpow264.8%
hypot-undefine68.4%
*-lft-identity68.4%
hypot-undefine64.8%
unpow264.8%
unpow264.8%
+-commutative64.8%
unpow264.8%
unpow264.8%
hypot-undefine68.4%
Simplified68.4%
if 1.7e-8 < th < 1.79999999999999998e40Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/100.0%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
clear-num99.3%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in kx around 0 43.8%
add-sqr-sqrt43.0%
sqrt-unprod60.2%
pow260.2%
Applied egg-rr60.2%
unpow260.2%
rem-sqrt-square60.2%
Simplified60.2%
if 1.79999999999999998e40 < th Initial program 88.8%
unpow288.8%
sqr-neg88.8%
sin-neg88.8%
sin-neg88.8%
unpow288.8%
associate-*l/88.8%
associate-/l*89.0%
+-commutative89.0%
unpow289.0%
sin-neg89.0%
sin-neg89.0%
Simplified99.4%
associate-*r/99.3%
hypot-undefine88.8%
unpow288.8%
unpow288.8%
+-commutative88.8%
associate-*l/88.8%
*-commutative88.8%
clear-num88.8%
un-div-inv89.0%
+-commutative89.0%
unpow289.0%
unpow289.0%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 32.2%
Final simplification60.2%
(FPCore (kx ky th) :precision binary64 (if (<= th 1050.0) (/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)) (/ (* ky (sin th)) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 1050.0) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = (ky * sin(th)) / hypot(sin(ky), sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 1050.0) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = (ky * Math.sin(th)) / Math.hypot(Math.sin(ky), Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 1050.0: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = (ky * math.sin(th)) / math.hypot(math.sin(ky), math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 1050.0) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(Float64(ky * sin(th)) / hypot(sin(ky), sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 1050.0) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = (ky * sin(th)) / hypot(sin(ky), sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 1050.0], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1050:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 1050Initial program 95.6%
unpow295.6%
sqr-neg95.6%
sin-neg95.6%
sin-neg95.6%
unpow295.6%
associate-*l/93.8%
associate-/l*95.5%
+-commutative95.5%
unpow295.5%
sin-neg95.5%
sin-neg95.5%
Simplified99.6%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 64.7%
associate-*l/64.8%
+-commutative64.8%
unpow264.8%
unpow264.8%
hypot-undefine68.4%
*-lft-identity68.4%
hypot-undefine64.8%
unpow264.8%
unpow264.8%
+-commutative64.8%
unpow264.8%
unpow264.8%
hypot-undefine68.4%
Simplified68.4%
if 1050 < th Initial program 90.1%
unpow290.1%
sqr-neg90.1%
sin-neg90.1%
sin-neg90.1%
unpow290.1%
associate-*l/90.1%
associate-/l*90.2%
+-commutative90.2%
unpow290.2%
sin-neg90.2%
sin-neg90.2%
Simplified99.4%
associate-*r/99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 59.8%
*-commutative59.8%
Simplified59.8%
Final simplification66.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (fabs (sin th)) (if (<= (sin ky) 1e-124) (* ky (/ (sin th) kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 1e-124) {
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 (sin(ky) <= (-0.005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 1d-124) 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 (Math.sin(ky) <= -0.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 1e-124) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 1e-124: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-124) 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 (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 1e-124) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-124], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-124}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 3.0%
associate-/r/3.0%
*-inverses3.0%
*-un-lft-identity3.0%
add-sqr-sqrt1.4%
sqrt-unprod18.1%
pow218.1%
Applied egg-rr18.1%
unpow218.1%
rem-sqrt-square29.4%
Simplified29.4%
if -0.0050000000000000001 < (sin.f64 ky) < 9.99999999999999933e-125Initial program 87.0%
unpow287.0%
sqr-neg87.0%
sin-neg87.0%
sin-neg87.0%
unpow287.0%
associate-*l/84.9%
associate-/l*87.0%
+-commutative87.0%
unpow287.0%
sin-neg87.0%
sin-neg87.0%
Simplified99.6%
Taylor expanded in ky around 0 58.7%
associate-/l*60.6%
Simplified60.6%
Taylor expanded in kx around 0 38.9%
associate-/l*40.8%
Simplified40.8%
if 9.99999999999999933e-125 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 55.4%
Final simplification43.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.8e-121) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.8e-121) {
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 <= 2.8d-121) 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 <= 2.8e-121) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.8e-121: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.8e-121) 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 <= 2.8e-121) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.8e-121], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.8 \cdot 10^{-121}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 2.8000000000000001e-121Initial program 91.8%
unpow291.8%
sqr-neg91.8%
sin-neg91.8%
sin-neg91.8%
unpow291.8%
associate-*l/90.5%
associate-/l*91.8%
+-commutative91.8%
unpow291.8%
sin-neg91.8%
sin-neg91.8%
Simplified99.6%
Taylor expanded in ky around 0 37.5%
associate-/l*38.7%
Simplified38.7%
Taylor expanded in th around 0 23.6%
associate-*r/24.7%
Simplified24.7%
if 2.8000000000000001e-121 < ky Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/98.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 29.7%
Final simplification26.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 8.5e-124) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 8.5e-124) {
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 <= 8.5d-124) 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 <= 8.5e-124) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 8.5e-124: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 8.5e-124) 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 <= 8.5e-124) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 8.5e-124], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 8.5 \cdot 10^{-124}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.5000000000000002e-124Initial program 91.8%
unpow291.8%
sqr-neg91.8%
sin-neg91.8%
sin-neg91.8%
unpow291.8%
associate-*l/90.5%
associate-/l*91.8%
+-commutative91.8%
unpow291.8%
sin-neg91.8%
sin-neg91.8%
Simplified99.6%
Taylor expanded in ky around 0 37.5%
associate-/l*38.7%
Simplified38.7%
Taylor expanded in kx around 0 25.3%
associate-/l*26.5%
Simplified26.5%
if 8.5000000000000002e-124 < ky Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/98.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 29.7%
Final simplification27.5%
(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 94.2%
unpow294.2%
sqr-neg94.2%
sin-neg94.2%
sin-neg94.2%
unpow294.2%
associate-*l/92.9%
associate-/l*94.2%
+-commutative94.2%
unpow294.2%
sin-neg94.2%
sin-neg94.2%
Simplified99.6%
Taylor expanded in kx around 0 21.7%
Final simplification21.7%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.2%
unpow294.2%
sqr-neg94.2%
sin-neg94.2%
sin-neg94.2%
unpow294.2%
associate-*l/92.9%
associate-/l*94.2%
+-commutative94.2%
unpow294.2%
sin-neg94.2%
sin-neg94.2%
Simplified99.6%
clear-num99.5%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 21.7%
Taylor expanded in th around 0 13.6%
Final simplification13.6%
herbie shell --seed 2024112
(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)))