
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 93.1%
+-commutative93.1%
unpow293.1%
unpow293.1%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 1e-202)
(* (sin th) (/ ky (sin kx)))
(if (<= (sin ky) 5e-86)
(fabs (/ ky (/ (sin kx) (sin th))))
(if (or (<= (sin ky) 3e-78) (not (<= (sin ky) 5e-10)))
(sin th)
(fabs (* (sin th) (/ (sin ky) (sin kx)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 1e-202) {
tmp = sin(th) * (ky / sin(kx));
} else if (sin(ky) <= 5e-86) {
tmp = fabs((ky / (sin(kx) / sin(th))));
} else if ((sin(ky) <= 3e-78) || !(sin(ky) <= 5e-10)) {
tmp = sin(th);
} else {
tmp = fabs((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(ky) <= (-0.005d0)) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(ky) <= 1d-202) then
tmp = sin(th) * (ky / sin(kx))
else if (sin(ky) <= 5d-86) then
tmp = abs((ky / (sin(kx) / sin(th))))
else if ((sin(ky) <= 3d-78) .or. (.not. (sin(ky) <= 5d-10))) then
tmp = sin(th)
else
tmp = abs((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(ky) <= -0.005) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-202) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else if (Math.sin(ky) <= 5e-86) {
tmp = Math.abs((ky / (Math.sin(kx) / Math.sin(th))));
} else if ((Math.sin(ky) <= 3e-78) || !(Math.sin(ky) <= 5e-10)) {
tmp = Math.sin(th);
} else {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.005: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 1e-202: tmp = math.sin(th) * (ky / math.sin(kx)) elif math.sin(ky) <= 5e-86: tmp = math.fabs((ky / (math.sin(kx) / math.sin(th)))) elif (math.sin(ky) <= 3e-78) or not (math.sin(ky) <= 5e-10): tmp = math.sin(th) else: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 1e-202) tmp = Float64(sin(th) * Float64(ky / sin(kx))); elseif (sin(ky) <= 5e-86) tmp = abs(Float64(ky / Float64(sin(kx) / sin(th)))); elseif ((sin(ky) <= 3e-78) || !(sin(ky) <= 5e-10)) tmp = sin(th); else tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 1e-202) tmp = sin(th) * (ky / sin(kx)); elseif (sin(ky) <= 5e-86) tmp = abs((ky / (sin(kx) / sin(th)))); elseif ((sin(ky) <= 3e-78) || ~((sin(ky) <= 5e-10))) tmp = sin(th); else tmp = abs((sin(th) * (sin(ky) / sin(kx)))); 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[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-202], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-86], N[Abs[N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 3e-78], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 5e-10]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-202}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-86}:\\
\;\;\;\;\left|\frac{ky}{\frac{\sin kx}{\sin th}}\right|\\
\mathbf{elif}\;\sin ky \leq 3 \cdot 10^{-78} \lor \neg \left(\sin ky \leq 5 \cdot 10^{-10}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.1%
add-sqr-sqrt0.9%
sqrt-unprod35.2%
pow235.2%
Applied egg-rr35.2%
unpow235.2%
rem-sqrt-square40.1%
Simplified40.1%
if -0.0050000000000000001 < (sin.f64 ky) < 1e-202Initial program 85.0%
unpow285.0%
sqr-neg85.0%
sin-neg85.0%
sin-neg85.0%
unpow285.0%
associate-*l/84.2%
associate-/l*84.9%
unpow284.9%
Simplified99.6%
Taylor expanded in ky around 0 47.1%
*-commutative47.1%
associate-/l*47.6%
Simplified47.6%
if 1e-202 < (sin.f64 ky) < 4.9999999999999999e-86Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/86.1%
associate-/l*89.8%
unpow289.8%
Simplified99.3%
Taylor expanded in ky around 0 60.3%
associate-/l*60.0%
Simplified60.0%
add-sqr-sqrt42.3%
sqrt-unprod36.1%
pow236.1%
Applied egg-rr36.1%
unpow236.1%
rem-sqrt-square54.5%
associate-*r/54.9%
*-rgt-identity54.9%
times-frac54.7%
/-rgt-identity54.7%
associate-/r/54.6%
Simplified54.6%
if 4.9999999999999999e-86 < (sin.f64 ky) < 2.99999999999999988e-78 or 5.00000000000000031e-10 < (sin.f64 ky) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 52.9%
if 2.99999999999999988e-78 < (sin.f64 ky) < 5.00000000000000031e-10Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in ky around 0 35.1%
add-sqr-sqrt18.0%
sqrt-unprod25.3%
pow225.3%
Applied egg-rr25.3%
unpow225.3%
rem-sqrt-square35.4%
*-commutative35.4%
associate-*l/35.4%
associate-/l*35.6%
Simplified35.6%
Final simplification47.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.01)
(fabs (/ ky (/ (sin kx) (sin th))))
(if (<= (sin kx) 1e-148)
(sin th)
(if (<= (sin kx) 1.5e-121)
(* (sin ky) (/ (sin th) kx))
(if (<= (sin kx) 1e-102)
(/ (* (sin ky) (sin th)) (sin ky))
(/ (sin th) (/ (sin kx) (sin ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = fabs((ky / (sin(kx) / sin(th))));
} else if (sin(kx) <= 1e-148) {
tmp = sin(th);
} else if (sin(kx) <= 1.5e-121) {
tmp = sin(ky) * (sin(th) / kx);
} else if (sin(kx) <= 1e-102) {
tmp = (sin(ky) * sin(th)) / sin(ky);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.01d0)) then
tmp = abs((ky / (sin(kx) / sin(th))))
else if (sin(kx) <= 1d-148) then
tmp = sin(th)
else if (sin(kx) <= 1.5d-121) then
tmp = sin(ky) * (sin(th) / kx)
else if (sin(kx) <= 1d-102) then
tmp = (sin(ky) * sin(th)) / sin(ky)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.01) {
tmp = Math.abs((ky / (Math.sin(kx) / Math.sin(th))));
} else if (Math.sin(kx) <= 1e-148) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1.5e-121) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else if (Math.sin(kx) <= 1e-102) {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(ky);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = math.fabs((ky / (math.sin(kx) / math.sin(th)))) elif math.sin(kx) <= 1e-148: tmp = math.sin(th) elif math.sin(kx) <= 1.5e-121: tmp = math.sin(ky) * (math.sin(th) / kx) elif math.sin(kx) <= 1e-102: tmp = (math.sin(ky) * math.sin(th)) / math.sin(ky) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = abs(Float64(ky / Float64(sin(kx) / sin(th)))); elseif (sin(kx) <= 1e-148) tmp = sin(th); elseif (sin(kx) <= 1.5e-121) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); elseif (sin(kx) <= 1e-102) tmp = Float64(Float64(sin(ky) * sin(th)) / sin(ky)); 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 (sin(kx) <= -0.01) tmp = abs((ky / (sin(kx) / sin(th)))); elseif (sin(kx) <= 1e-148) tmp = sin(th); elseif (sin(kx) <= 1.5e-121) tmp = sin(ky) * (sin(th) / kx); elseif (sin(kx) <= 1e-102) tmp = (sin(ky) * sin(th)) / sin(ky); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[Abs[N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-148], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.5e-121], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-102], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $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}\;\sin kx \leq -0.01:\\
\;\;\;\;\left|\frac{ky}{\frac{\sin kx}{\sin th}}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-148}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 1.5 \cdot 10^{-121}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;\sin kx \leq 10^{-102}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin ky}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 19.2%
associate-/l*19.2%
Simplified19.2%
add-sqr-sqrt17.3%
sqrt-unprod26.2%
pow226.2%
Applied egg-rr26.2%
unpow226.2%
rem-sqrt-square45.3%
associate-*r/45.3%
*-rgt-identity45.3%
times-frac45.3%
/-rgt-identity45.3%
associate-/r/45.3%
Simplified45.3%
if -0.0100000000000000002 < (sin.f64 kx) < 9.99999999999999936e-149Initial program 82.3%
unpow282.3%
sqr-neg82.3%
sin-neg82.3%
sin-neg82.3%
unpow282.3%
associate-*l/81.0%
associate-/l*82.2%
unpow282.2%
Simplified99.7%
Taylor expanded in kx around 0 35.1%
if 9.99999999999999936e-149 < (sin.f64 kx) < 1.5e-121Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/91.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 62.3%
Taylor expanded in kx around 0 62.3%
if 1.5e-121 < (sin.f64 kx) < 9.99999999999999933e-103Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/100.0%
associate-/l*100.0%
unpow2100.0%
Simplified100.0%
associate-*r/100.0%
Applied egg-rr100.0%
Taylor expanded in kx around 0 34.4%
if 9.99999999999999933e-103 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
associate-*r/99.5%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
associate-*l/99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 60.2%
Final simplification47.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.01)
(fabs (* (sin th) (/ (sin ky) (sin kx))))
(if (<= (sin kx) 1e-148)
(sin th)
(if (<= (sin kx) 1.5e-121)
(* (sin ky) (/ (sin th) kx))
(if (<= (sin kx) 1e-102)
(/ (* (sin ky) (sin th)) (sin ky))
(/ (sin th) (/ (sin kx) (sin ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else if (sin(kx) <= 1e-148) {
tmp = sin(th);
} else if (sin(kx) <= 1.5e-121) {
tmp = sin(ky) * (sin(th) / kx);
} else if (sin(kx) <= 1e-102) {
tmp = (sin(ky) * sin(th)) / sin(ky);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.01d0)) then
tmp = abs((sin(th) * (sin(ky) / sin(kx))))
else if (sin(kx) <= 1d-148) then
tmp = sin(th)
else if (sin(kx) <= 1.5d-121) then
tmp = sin(ky) * (sin(th) / kx)
else if (sin(kx) <= 1d-102) then
tmp = (sin(ky) * sin(th)) / sin(ky)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.01) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-148) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1.5e-121) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else if (Math.sin(kx) <= 1e-102) {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(ky);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) elif math.sin(kx) <= 1e-148: tmp = math.sin(th) elif math.sin(kx) <= 1.5e-121: tmp = math.sin(ky) * (math.sin(th) / kx) elif math.sin(kx) <= 1e-102: tmp = (math.sin(ky) * math.sin(th)) / math.sin(ky) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= 1e-148) tmp = sin(th); elseif (sin(kx) <= 1.5e-121) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); elseif (sin(kx) <= 1e-102) tmp = Float64(Float64(sin(ky) * sin(th)) / sin(ky)); 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 (sin(kx) <= -0.01) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); elseif (sin(kx) <= 1e-148) tmp = sin(th); elseif (sin(kx) <= 1.5e-121) tmp = sin(ky) * (sin(th) / kx); elseif (sin(kx) <= 1e-102) tmp = (sin(ky) * sin(th)) / sin(ky); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-148], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.5e-121], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-102], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $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}\;\sin kx \leq -0.01:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-148}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 1.5 \cdot 10^{-121}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;\sin kx \leq 10^{-102}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin ky}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 18.7%
add-sqr-sqrt17.1%
sqrt-unprod29.4%
pow229.4%
Applied egg-rr29.4%
unpow229.4%
rem-sqrt-square48.6%
*-commutative48.6%
associate-*l/48.6%
associate-/l*48.6%
Simplified48.6%
if -0.0100000000000000002 < (sin.f64 kx) < 9.99999999999999936e-149Initial program 82.3%
unpow282.3%
sqr-neg82.3%
sin-neg82.3%
sin-neg82.3%
unpow282.3%
associate-*l/81.0%
associate-/l*82.2%
unpow282.2%
Simplified99.7%
Taylor expanded in kx around 0 35.1%
if 9.99999999999999936e-149 < (sin.f64 kx) < 1.5e-121Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/91.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 62.3%
Taylor expanded in kx around 0 62.3%
if 1.5e-121 < (sin.f64 kx) < 9.99999999999999933e-103Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/100.0%
associate-/l*100.0%
unpow2100.0%
Simplified100.0%
associate-*r/100.0%
Applied egg-rr100.0%
Taylor expanded in kx around 0 34.4%
if 9.99999999999999933e-103 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
associate-*r/99.5%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
associate-*l/99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 60.2%
Final simplification47.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.01)
(* (sin ky) (fabs (/ (sin th) (sin kx))))
(if (<= (sin kx) 1e-148)
(sin th)
(if (<= (sin kx) 1.5e-121)
(* (sin ky) (/ (sin th) kx))
(if (<= (sin kx) 1e-102)
(/ (* (sin ky) (sin th)) (sin ky))
(/ (sin th) (/ (sin kx) (sin ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 1e-148) {
tmp = sin(th);
} else if (sin(kx) <= 1.5e-121) {
tmp = sin(ky) * (sin(th) / kx);
} else if (sin(kx) <= 1e-102) {
tmp = (sin(ky) * sin(th)) / sin(ky);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.01d0)) then
tmp = sin(ky) * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 1d-148) then
tmp = sin(th)
else if (sin(kx) <= 1.5d-121) then
tmp = sin(ky) * (sin(th) / kx)
else if (sin(kx) <= 1d-102) then
tmp = (sin(ky) * sin(th)) / sin(ky)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.01) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-148) {
tmp = Math.sin(th);
} else if (Math.sin(kx) <= 1.5e-121) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else if (Math.sin(kx) <= 1e-102) {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(ky);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 1e-148: tmp = math.sin(th) elif math.sin(kx) <= 1.5e-121: tmp = math.sin(ky) * (math.sin(th) / kx) elif math.sin(kx) <= 1e-102: tmp = (math.sin(ky) * math.sin(th)) / math.sin(ky) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-148) tmp = sin(th); elseif (sin(kx) <= 1.5e-121) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); elseif (sin(kx) <= 1e-102) tmp = Float64(Float64(sin(ky) * sin(th)) / sin(ky)); 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 (sin(kx) <= -0.01) tmp = sin(ky) * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 1e-148) tmp = sin(th); elseif (sin(kx) <= 1.5e-121) tmp = sin(ky) * (sin(th) / kx); elseif (sin(kx) <= 1e-102) tmp = (sin(ky) * sin(th)) / sin(ky); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-148], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1.5e-121], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-102], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $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}\;\sin kx \leq -0.01:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-148}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 1.5 \cdot 10^{-121}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;\sin kx \leq 10^{-102}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin ky}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 18.7%
add-sqr-sqrt13.7%
sqrt-unprod39.9%
pow239.9%
Applied egg-rr39.9%
unpow239.9%
rem-sqrt-square39.9%
Simplified39.9%
if -0.0100000000000000002 < (sin.f64 kx) < 9.99999999999999936e-149Initial program 82.3%
unpow282.3%
sqr-neg82.3%
sin-neg82.3%
sin-neg82.3%
unpow282.3%
associate-*l/81.0%
associate-/l*82.2%
unpow282.2%
Simplified99.7%
Taylor expanded in kx around 0 35.1%
if 9.99999999999999936e-149 < (sin.f64 kx) < 1.5e-121Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/91.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 62.3%
Taylor expanded in kx around 0 62.3%
if 1.5e-121 < (sin.f64 kx) < 9.99999999999999933e-103Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/100.0%
associate-/l*100.0%
unpow2100.0%
Simplified100.0%
associate-*r/100.0%
Applied egg-rr100.0%
Taylor expanded in kx around 0 34.4%
if 9.99999999999999933e-103 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
associate-*r/99.5%
hypot-undefine99.5%
unpow299.5%
unpow299.5%
+-commutative99.5%
associate-*l/99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 60.2%
Final simplification45.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.02)
(sin th)
(if (<= (sin th) 2e-8)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(* (sin ky) (fabs (/ (sin th) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.02) {
tmp = sin(th);
} else if (sin(th) <= 2e-8) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.02) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= 2e-8) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.02: tmp = math.sin(th) elif math.sin(th) <= 2e-8: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.02) tmp = sin(th); elseif (sin(th) <= 2e-8) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.02) tmp = sin(th); elseif (sin(th) <= 2e-8) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = sin(ky) * abs((sin(th) / sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.02], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 2e-8], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.02:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0200000000000000004Initial program 90.1%
unpow290.1%
sqr-neg90.1%
sin-neg90.1%
sin-neg90.1%
unpow290.1%
associate-*l/90.0%
associate-/l*90.0%
unpow290.0%
Simplified99.4%
Taylor expanded in kx around 0 17.0%
if -0.0200000000000000004 < (sin.f64 th) < 2e-8Initial program 93.4%
unpow293.4%
sqr-neg93.4%
sin-neg93.4%
sin-neg93.4%
unpow293.4%
associate-*l/92.0%
associate-/l*93.4%
unpow293.4%
Simplified99.7%
associate-*r/92.8%
Applied egg-rr92.8%
Taylor expanded in th around 0 92.6%
associate-/l*99.6%
*-commutative99.6%
Applied egg-rr99.6%
if 2e-8 < (sin.f64 th) Initial program 94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/94.4%
associate-/l*94.6%
unpow294.6%
Simplified99.4%
Taylor expanded in ky around 0 28.7%
add-sqr-sqrt27.8%
sqrt-unprod46.4%
pow246.4%
Applied egg-rr46.4%
unpow246.4%
rem-sqrt-square49.0%
Simplified49.0%
Final simplification62.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.005)
(fabs (sin th))
(if (<= (sin ky) 5e-165)
(* ky (/ (sin th) kx))
(if (or (<= (sin ky) 4e-135) (not (<= (sin ky) 5e-86)))
(sin th)
(/ (* ky (sin th)) kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.005) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-165) {
tmp = ky * (sin(th) / kx);
} else if ((sin(ky) <= 4e-135) || !(sin(ky) <= 5e-86)) {
tmp = sin(th);
} else {
tmp = (ky * sin(th)) / 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(ky) <= (-0.005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-165) then
tmp = ky * (sin(th) / kx)
else if ((sin(ky) <= 4d-135) .or. (.not. (sin(ky) <= 5d-86))) then
tmp = sin(th)
else
tmp = (ky * sin(th)) / kx
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) <= 5e-165) {
tmp = ky * (Math.sin(th) / kx);
} else if ((Math.sin(ky) <= 4e-135) || !(Math.sin(ky) <= 5e-86)) {
tmp = Math.sin(th);
} else {
tmp = (ky * Math.sin(th)) / kx;
}
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) <= 5e-165: tmp = ky * (math.sin(th) / kx) elif (math.sin(ky) <= 4e-135) or not (math.sin(ky) <= 5e-86): tmp = math.sin(th) else: tmp = (ky * math.sin(th)) / kx return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-165) tmp = Float64(ky * Float64(sin(th) / kx)); elseif ((sin(ky) <= 4e-135) || !(sin(ky) <= 5e-86)) tmp = sin(th); else tmp = Float64(Float64(ky * sin(th)) / kx); 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) <= 5e-165) tmp = ky * (sin(th) / kx); elseif ((sin(ky) <= 4e-135) || ~((sin(ky) <= 5e-86))) tmp = sin(th); else tmp = (ky * sin(th)) / kx; 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], 5e-165], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 4e-135], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 5e-86]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / kx), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-165}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-135} \lor \neg \left(\sin ky \leq 5 \cdot 10^{-86}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.1%
add-sqr-sqrt1.2%
sqrt-unprod32.4%
pow232.4%
clear-num32.3%
un-div-inv32.4%
Applied egg-rr32.4%
unpow232.4%
rem-sqrt-square34.3%
associate-/r/34.4%
*-inverses34.4%
*-lft-identity34.4%
Simplified34.4%
if -0.0050000000000000001 < (sin.f64 ky) < 4.99999999999999981e-165Initial program 84.6%
unpow284.6%
sqr-neg84.6%
sin-neg84.6%
sin-neg84.6%
unpow284.6%
associate-*l/83.8%
associate-/l*84.5%
unpow284.5%
Simplified99.6%
Taylor expanded in ky around 0 49.4%
associate-/l*49.7%
Simplified49.7%
Taylor expanded in kx around 0 31.1%
associate-/l*31.4%
Simplified31.4%
if 4.99999999999999981e-165 < (sin.f64 ky) < 4.0000000000000002e-135 or 4.9999999999999999e-86 < (sin.f64 ky) Initial program 99.1%
unpow299.1%
sqr-neg99.1%
sin-neg99.1%
sin-neg99.1%
unpow299.1%
associate-*l/99.0%
associate-/l*99.1%
unpow299.1%
Simplified99.5%
Taylor expanded in kx around 0 49.0%
if 4.0000000000000002e-135 < (sin.f64 ky) < 4.9999999999999999e-86Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/88.2%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in ky around 0 51.9%
associate-/l*51.5%
Simplified51.5%
Taylor expanded in kx around 0 36.9%
Final simplification38.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.01) (fabs (/ ky (/ (sin kx) (sin th)))) (if (<= (sin kx) 1e-148) (sin th) (* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = fabs((ky / (sin(kx) / sin(th))));
} else if (sin(kx) <= 1e-148) {
tmp = sin(th);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.01d0)) then
tmp = abs((ky / (sin(kx) / sin(th))))
else if (sin(kx) <= 1d-148) then
tmp = sin(th)
else
tmp = sin(ky) * (sin(th) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.01) {
tmp = Math.abs((ky / (Math.sin(kx) / Math.sin(th))));
} else if (Math.sin(kx) <= 1e-148) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = math.fabs((ky / (math.sin(kx) / math.sin(th)))) elif math.sin(kx) <= 1e-148: tmp = math.sin(th) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = abs(Float64(ky / Float64(sin(kx) / sin(th)))); elseif (sin(kx) <= 1e-148) tmp = sin(th); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.01) tmp = abs((ky / (sin(kx) / sin(th)))); elseif (sin(kx) <= 1e-148) tmp = sin(th); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[Abs[N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-148], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.01:\\
\;\;\;\;\left|\frac{ky}{\frac{\sin kx}{\sin th}}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-148}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 19.2%
associate-/l*19.2%
Simplified19.2%
add-sqr-sqrt17.3%
sqrt-unprod26.2%
pow226.2%
Applied egg-rr26.2%
unpow226.2%
rem-sqrt-square45.3%
associate-*r/45.3%
*-rgt-identity45.3%
times-frac45.3%
/-rgt-identity45.3%
associate-/r/45.3%
Simplified45.3%
if -0.0100000000000000002 < (sin.f64 kx) < 9.99999999999999936e-149Initial program 82.3%
unpow282.3%
sqr-neg82.3%
sin-neg82.3%
sin-neg82.3%
unpow282.3%
associate-*l/81.0%
associate-/l*82.2%
unpow282.2%
Simplified99.7%
Taylor expanded in kx around 0 35.1%
if 9.99999999999999936e-149 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.0%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 58.7%
Final simplification46.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.01) (fabs (/ ky (/ (sin kx) (sin th)))) (if (<= (sin kx) 1e-148) (sin th) (/ (sin th) (/ (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = fabs((ky / (sin(kx) / sin(th))));
} else if (sin(kx) <= 1e-148) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.01d0)) then
tmp = abs((ky / (sin(kx) / sin(th))))
else if (sin(kx) <= 1d-148) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.01) {
tmp = Math.abs((ky / (Math.sin(kx) / Math.sin(th))));
} else if (Math.sin(kx) <= 1e-148) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = math.fabs((ky / (math.sin(kx) / math.sin(th)))) elif math.sin(kx) <= 1e-148: tmp = 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 (sin(kx) <= -0.01) tmp = abs(Float64(ky / Float64(sin(kx) / sin(th)))); elseif (sin(kx) <= 1e-148) tmp = 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 (sin(kx) <= -0.01) tmp = abs((ky / (sin(kx) / sin(th)))); elseif (sin(kx) <= 1e-148) tmp = sin(th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[Abs[N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-148], N[Sin[th], $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}\;\sin kx \leq -0.01:\\
\;\;\;\;\left|\frac{ky}{\frac{\sin kx}{\sin th}}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-148}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 19.2%
associate-/l*19.2%
Simplified19.2%
add-sqr-sqrt17.3%
sqrt-unprod26.2%
pow226.2%
Applied egg-rr26.2%
unpow226.2%
rem-sqrt-square45.3%
associate-*r/45.3%
*-rgt-identity45.3%
times-frac45.3%
/-rgt-identity45.3%
associate-/r/45.3%
Simplified45.3%
if -0.0100000000000000002 < (sin.f64 kx) < 9.99999999999999936e-149Initial program 82.3%
unpow282.3%
sqr-neg82.3%
sin-neg82.3%
sin-neg82.3%
unpow282.3%
associate-*l/81.0%
associate-/l*82.2%
unpow282.2%
Simplified99.7%
Taylor expanded in kx around 0 35.1%
if 9.99999999999999936e-149 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.0%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
associate-*r/99.0%
hypot-undefine99.0%
unpow299.0%
unpow299.0%
+-commutative99.0%
associate-*l/99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 58.7%
Final simplification46.8%
(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.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
associate-*l/92.3%
associate-/l*93.0%
unpow293.0%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (fabs (sin th)) (if (<= (sin ky) 5e-86) (* 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) <= 5e-86) {
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) <= 5d-86) 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) <= 5e-86) {
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) <= 5e-86: 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) <= 5e-86) 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) <= 5e-86) 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], 5e-86], 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 5 \cdot 10^{-86}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.1%
add-sqr-sqrt1.2%
sqrt-unprod32.4%
pow232.4%
clear-num32.3%
un-div-inv32.4%
Applied egg-rr32.4%
unpow232.4%
rem-sqrt-square34.3%
associate-/r/34.4%
*-inverses34.4%
*-lft-identity34.4%
Simplified34.4%
if -0.0050000000000000001 < (sin.f64 ky) < 4.9999999999999999e-86Initial program 86.0%
unpow286.0%
sqr-neg86.0%
sin-neg86.0%
sin-neg86.0%
unpow286.0%
associate-*l/84.6%
associate-/l*85.9%
unpow285.9%
Simplified99.5%
Taylor expanded in ky around 0 49.7%
associate-/l*49.9%
Simplified49.9%
if 4.9999999999999999e-86 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 49.8%
Final simplification46.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.005) (fabs (sin th)) (if (<= (sin ky) 5e-86) (* (sin th) (/ ky (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) <= 5e-86) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.005d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-86) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-86) {
tmp = Math.sin(th) * (ky / 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) <= 5e-86: tmp = math.sin(th) * (ky / 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) <= 5e-86) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.005) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-86) tmp = sin(th) * (ky / 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], 5e-86], N[(N[Sin[th], $MachinePrecision] * N[(ky / 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 5 \cdot 10^{-86}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.1%
add-sqr-sqrt1.2%
sqrt-unprod32.4%
pow232.4%
clear-num32.3%
un-div-inv32.4%
Applied egg-rr32.4%
unpow232.4%
rem-sqrt-square34.3%
associate-/r/34.4%
*-inverses34.4%
*-lft-identity34.4%
Simplified34.4%
if -0.0050000000000000001 < (sin.f64 ky) < 4.9999999999999999e-86Initial program 86.0%
unpow286.0%
sqr-neg86.0%
sin-neg86.0%
sin-neg86.0%
unpow286.0%
associate-*l/84.6%
associate-/l*85.9%
unpow285.9%
Simplified99.5%
Taylor expanded in ky around 0 49.7%
*-commutative49.7%
associate-/l*50.0%
Simplified50.0%
if 4.9999999999999999e-86 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 49.8%
Final simplification46.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.01) (fabs (/ ky (/ (sin kx) (sin th)))) (if (<= (sin kx) 5e-141) (sin th) (* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.01) {
tmp = fabs((ky / (sin(kx) / sin(th))));
} else if (sin(kx) <= 5e-141) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.01d0)) then
tmp = abs((ky / (sin(kx) / sin(th))))
else if (sin(kx) <= 5d-141) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.01) {
tmp = Math.abs((ky / (Math.sin(kx) / Math.sin(th))));
} else if (Math.sin(kx) <= 5e-141) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.01: tmp = math.fabs((ky / (math.sin(kx) / math.sin(th)))) elif math.sin(kx) <= 5e-141: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.01) tmp = abs(Float64(ky / Float64(sin(kx) / sin(th)))); elseif (sin(kx) <= 5e-141) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.01) tmp = abs((ky / (sin(kx) / sin(th)))); elseif (sin(kx) <= 5e-141) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.01], N[Abs[N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 5e-141], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.01:\\
\;\;\;\;\left|\frac{ky}{\frac{\sin kx}{\sin th}}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-141}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0100000000000000002Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 19.2%
associate-/l*19.2%
Simplified19.2%
add-sqr-sqrt17.3%
sqrt-unprod26.2%
pow226.2%
Applied egg-rr26.2%
unpow226.2%
rem-sqrt-square45.3%
associate-*r/45.3%
*-rgt-identity45.3%
times-frac45.3%
/-rgt-identity45.3%
associate-/r/45.3%
Simplified45.3%
if -0.0100000000000000002 < (sin.f64 kx) < 4.9999999999999999e-141Initial program 82.7%
unpow282.7%
sqr-neg82.7%
sin-neg82.7%
sin-neg82.7%
unpow282.7%
associate-*l/81.4%
associate-/l*82.5%
unpow282.5%
Simplified99.7%
Taylor expanded in kx around 0 35.4%
if 4.9999999999999999e-141 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.0%
associate-/l*99.4%
unpow299.4%
Simplified99.5%
Taylor expanded in ky around 0 52.7%
*-commutative52.7%
associate-/l*53.3%
Simplified53.3%
Final simplification44.7%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (hypot (sin ky) (sin kx)))) (if (<= th 3e-6) (* (/ (sin ky) t_1) th) (/ (* ky (sin th)) t_1))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (th <= 3e-6) {
tmp = (sin(ky) / t_1) * th;
} else {
tmp = (ky * sin(th)) / t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (th <= 3e-6) {
tmp = (Math.sin(ky) / t_1) * th;
} else {
tmp = (ky * Math.sin(th)) / t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if th <= 3e-6: tmp = (math.sin(ky) / t_1) * th else: tmp = (ky * math.sin(th)) / t_1 return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (th <= 3e-6) tmp = Float64(Float64(sin(ky) / t_1) * th); else tmp = Float64(Float64(ky * sin(th)) / t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (th <= 3e-6) tmp = (sin(ky) / t_1) * th; else tmp = (ky * sin(th)) / t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[th, 3e-6], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;th \leq 3 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sin ky}{t\_1} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{t\_1}\\
\end{array}
\end{array}
if th < 3.0000000000000001e-6Initial program 94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/93.7%
associate-/l*94.6%
unpow294.6%
Simplified99.6%
associate-*r/95.3%
Applied egg-rr95.3%
Taylor expanded in th around 0 58.6%
associate-/l*63.0%
*-commutative63.0%
Applied egg-rr63.0%
if 3.0000000000000001e-6 < th Initial program 89.7%
unpow289.7%
sqr-neg89.7%
sin-neg89.7%
sin-neg89.7%
unpow289.7%
associate-*l/89.5%
associate-/l*89.5%
unpow289.5%
Simplified99.4%
associate-*r/99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 56.0%
Final simplification60.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.26e-138) (sin th) (if (<= kx 1.05) (* ky (/ (sin th) kx)) (* ky (/ th (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.26e-138) {
tmp = sin(th);
} else if (kx <= 1.05) {
tmp = ky * (sin(th) / kx);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 1.26d-138) then
tmp = sin(th)
else if (kx <= 1.05d0) then
tmp = ky * (sin(th) / kx)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.26e-138) {
tmp = Math.sin(th);
} else if (kx <= 1.05) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.26e-138: tmp = math.sin(th) elif kx <= 1.05: tmp = ky * (math.sin(th) / kx) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.26e-138) tmp = sin(th); elseif (kx <= 1.05) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.26e-138) tmp = sin(th); elseif (kx <= 1.05) tmp = ky * (sin(th) / kx); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.26e-138], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 1.05], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.26 \cdot 10^{-138}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 1.05:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 1.26e-138Initial program 89.1%
unpow289.1%
sqr-neg89.1%
sin-neg89.1%
sin-neg89.1%
unpow289.1%
associate-*l/88.2%
associate-/l*89.0%
unpow289.0%
Simplified99.6%
Taylor expanded in kx around 0 25.6%
if 1.26e-138 < kx < 1.05000000000000004Initial program 99.9%
unpow299.9%
sqr-neg99.9%
sin-neg99.9%
sin-neg99.9%
unpow299.9%
associate-*l/98.3%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in ky around 0 50.8%
associate-/l*52.3%
Simplified52.3%
Taylor expanded in kx around 0 48.5%
associate-/l*50.0%
Simplified50.0%
if 1.05000000000000004 < kx Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.3%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 33.3%
associate-/l*33.3%
Simplified33.3%
Taylor expanded in th around 0 15.7%
associate-/l*15.7%
Simplified15.7%
Final simplification26.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 7.8e-53) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 7.8e-53) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (kx <= 7.8d-53) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 7.8e-53) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 7.8e-53: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 7.8e-53) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 7.8e-53) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 7.8e-53], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 7.8 \cdot 10^{-53}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if kx < 7.8000000000000004e-53Initial program 90.1%
unpow290.1%
sqr-neg90.1%
sin-neg90.1%
sin-neg90.1%
unpow290.1%
associate-*l/89.0%
associate-/l*90.0%
unpow290.0%
Simplified99.6%
Taylor expanded in kx around 0 25.6%
if 7.8000000000000004e-53 < kx Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in ky around 0 39.3%
associate-/l*39.3%
Simplified39.3%
Taylor expanded in th around 0 18.2%
associate-/l*18.2%
Simplified18.2%
Final simplification23.3%
(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.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
associate-*l/92.3%
associate-/l*93.0%
unpow293.0%
Simplified99.6%
Taylor expanded in kx around 0 20.8%
Final simplification20.8%
(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.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
associate-*l/92.3%
associate-/l*93.0%
unpow293.0%
Simplified99.6%
Taylor expanded in kx around 0 20.8%
Taylor expanded in th around 0 10.3%
Final simplification10.3%
herbie shell --seed 2024059
(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)))