
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 94.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/92.3%
associate-/l*94.7%
unpow294.7%
Simplified99.6%
associate-*r/95.5%
hypot-undefine92.3%
unpow292.3%
unpow292.3%
+-commutative92.3%
associate-*l/94.7%
*-commutative94.7%
clear-num94.6%
un-div-inv94.7%
+-commutative94.7%
unpow294.7%
unpow294.7%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.5)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= (sin th) -0.005)
(sin th)
(if (<= (sin th) 5e-5)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(* (sin ky) (fabs (/ (sin th) (sin kx))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.5) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(th) <= -0.005) {
tmp = sin(th);
} else if (sin(th) <= 5e-5) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / 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.5) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(th) <= -0.005) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= 5e-5) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / 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.5: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(th) <= -0.005: tmp = math.sin(th) elif math.sin(th) <= 5e-5: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / 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.5) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(th) <= -0.005) tmp = sin(th); elseif (sin(th) <= 5e-5) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / 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.5) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(th) <= -0.005) tmp = sin(th); elseif (sin(th) <= 5e-5) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / 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.5], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.005], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 5e-5], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.5:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin th \leq -0.005:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.5Initial program 91.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 27.0%
if -0.5 < (sin.f64 th) < -0.0050000000000000001Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 24.3%
if -0.0050000000000000001 < (sin.f64 th) < 5.00000000000000024e-5Initial program 93.4%
unpow293.4%
sqr-neg93.4%
sin-neg93.4%
sin-neg93.4%
unpow293.4%
associate-*l/88.5%
associate-/l*93.3%
unpow293.3%
Simplified99.7%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 92.9%
associate-*l/93.0%
+-commutative93.0%
unpow293.0%
unpow293.0%
hypot-undefine99.4%
*-lft-identity99.4%
hypot-undefine93.0%
unpow293.0%
unpow293.0%
+-commutative93.0%
unpow293.0%
unpow293.0%
hypot-define99.4%
Simplified99.4%
if 5.00000000000000024e-5 < (sin.f64 th) Initial program 98.0%
unpow298.0%
sqr-neg98.0%
sin-neg98.0%
sin-neg98.0%
unpow298.0%
associate-*l/98.0%
associate-/l*98.0%
unpow298.0%
Simplified99.5%
Taylor expanded in ky around 0 20.0%
add-sqr-sqrt16.0%
sqrt-unprod43.8%
pow243.8%
Applied egg-rr48.6%
unpow243.8%
rem-sqrt-square45.5%
Simplified50.3%
Final simplification67.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 5e-52)
(* ky (/ (sin th) (sin kx)))
(if (or (<= (sin ky) 5e-33) (not (<= (sin ky) 5e-14)))
(sin th)
(* (sin th) (/ ky (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-52) {
tmp = ky * (sin(th) / sin(kx));
} else if ((sin(ky) <= 5e-33) || !(sin(ky) <= 5e-14)) {
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(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-52) then
tmp = ky * (sin(th) / sin(kx))
else if ((sin(ky) <= 5d-33) .or. (.not. (sin(ky) <= 5d-14))) 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(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-52) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if ((Math.sin(ky) <= 5e-33) || !(Math.sin(ky) <= 5e-14)) {
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(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-52: tmp = ky * (math.sin(th) / math.sin(kx)) elif (math.sin(ky) <= 5e-33) or not (math.sin(ky) <= 5e-14): 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(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-52) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif ((sin(ky) <= 5e-33) || !(sin(ky) <= 5e-14)) 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(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-52) tmp = ky * (sin(th) / sin(kx)); elseif ((sin(ky) <= 5e-33) || ~((sin(ky) <= 5e-14))) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-52], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-33], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 5e-14]], $MachinePrecision]], 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 ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-52}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-33} \lor \neg \left(\sin ky \leq 5 \cdot 10^{-14}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\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.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.5%
sqrt-unprod19.4%
pow219.4%
associate-*r/19.4%
*-commutative19.4%
associate-/l*19.4%
Applied egg-rr19.4%
unpow219.4%
rem-sqrt-square30.5%
*-inverses30.5%
*-rgt-identity30.5%
Simplified30.5%
if -0.0200000000000000004 < (sin.f64 ky) < 5e-52Initial program 89.8%
unpow289.8%
sqr-neg89.8%
sin-neg89.8%
sin-neg89.8%
unpow289.8%
associate-*l/85.8%
associate-/l*89.7%
unpow289.7%
Simplified99.6%
Taylor expanded in ky around 0 43.8%
associate-/l*47.3%
Simplified47.3%
if 5e-52 < (sin.f64 ky) < 5.00000000000000028e-33 or 5.0000000000000002e-14 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.2%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 58.9%
if 5.00000000000000028e-33 < (sin.f64 ky) < 5.0000000000000002e-14Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/99.0%
associate-/l*100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in ky around 0 35.6%
*-commutative35.6%
associate-/l*35.6%
Simplified35.6%
Final simplification46.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) 5e-52)
(/ (sin th) (/ (sin kx) ky))
(if (or (<= (sin ky) 5e-33) (not (<= (sin ky) 5e-14)))
(sin th)
(* (sin th) (/ ky (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-52) {
tmp = sin(th) / (sin(kx) / ky);
} else if ((sin(ky) <= 5e-33) || !(sin(ky) <= 5e-14)) {
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(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-52) then
tmp = sin(th) / (sin(kx) / ky)
else if ((sin(ky) <= 5d-33) .or. (.not. (sin(ky) <= 5d-14))) 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(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-52) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else if ((Math.sin(ky) <= 5e-33) || !(Math.sin(ky) <= 5e-14)) {
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(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-52: tmp = math.sin(th) / (math.sin(kx) / ky) elif (math.sin(ky) <= 5e-33) or not (math.sin(ky) <= 5e-14): 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(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-52) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif ((sin(ky) <= 5e-33) || !(sin(ky) <= 5e-14)) 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(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-52) tmp = sin(th) / (sin(kx) / ky); elseif ((sin(ky) <= 5e-33) || ~((sin(ky) <= 5e-14))) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-52], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 5e-33], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 5e-14]], $MachinePrecision]], 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 ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-52}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-33} \lor \neg \left(\sin ky \leq 5 \cdot 10^{-14}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\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.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.5%
sqrt-unprod19.4%
pow219.4%
associate-*r/19.4%
*-commutative19.4%
associate-/l*19.4%
Applied egg-rr19.4%
unpow219.4%
rem-sqrt-square30.5%
*-inverses30.5%
*-rgt-identity30.5%
Simplified30.5%
if -0.0200000000000000004 < (sin.f64 ky) < 5e-52Initial program 89.8%
unpow289.8%
sqr-neg89.8%
sin-neg89.8%
sin-neg89.8%
unpow289.8%
associate-*l/85.8%
associate-/l*89.7%
unpow289.7%
Simplified99.6%
associate-*r/92.1%
hypot-undefine85.8%
unpow285.8%
unpow285.8%
+-commutative85.8%
associate-*l/89.8%
*-commutative89.8%
clear-num89.7%
un-div-inv89.8%
+-commutative89.8%
unpow289.8%
unpow289.8%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 47.3%
if 5e-52 < (sin.f64 ky) < 5.00000000000000028e-33 or 5.0000000000000002e-14 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.2%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 58.9%
if 5.00000000000000028e-33 < (sin.f64 ky) < 5.0000000000000002e-14Initial program 100.0%
unpow2100.0%
sqr-neg100.0%
sin-neg100.0%
sin-neg100.0%
unpow2100.0%
associate-*l/99.0%
associate-/l*100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in ky around 0 35.6%
*-commutative35.6%
associate-/l*35.6%
Simplified35.6%
Final simplification46.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.08)
(* (sin ky) (fabs (/ (sin th) (sin kx))))
(if (<= (sin kx) 1e-93)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.08) {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 1e-93) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.08d0)) then
tmp = sin(ky) * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 1d-93) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.08) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-93) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.08: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 1e-93: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.08) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-93) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.08) tmp = sin(ky) * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 1e-93) tmp = sin(ky) * abs((sin(th) / sin(ky))); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.08], 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-93], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.08:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-93}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0800000000000000017Initial 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.5%
add-sqr-sqrt9.7%
sqrt-unprod46.4%
pow246.4%
Applied egg-rr48.5%
unpow246.4%
rem-sqrt-square48.6%
Simplified51.7%
if -0.0800000000000000017 < (sin.f64 kx) < 9.999999999999999e-94Initial program 88.2%
unpow288.2%
sqr-neg88.2%
sin-neg88.2%
sin-neg88.2%
unpow288.2%
associate-*l/85.2%
associate-/l*88.1%
unpow288.1%
Simplified99.8%
Taylor expanded in kx around 0 40.6%
add-sqr-sqrt16.6%
sqrt-unprod28.9%
pow228.9%
Applied egg-rr28.9%
unpow228.9%
rem-sqrt-square32.6%
Simplified32.6%
if 9.999999999999999e-94 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 57.5%
Final simplification45.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.08)
(* ky (fabs t_1))
(if (<= (sin kx) 2e-96) (sin th) (* (sin ky) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.08) {
tmp = ky * fabs(t_1);
} else if (sin(kx) <= 2e-96) {
tmp = sin(th);
} else {
tmp = sin(ky) * t_1;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(th) / sin(kx)
if (sin(kx) <= (-0.08d0)) then
tmp = ky * abs(t_1)
else if (sin(kx) <= 2d-96) then
tmp = sin(th)
else
tmp = sin(ky) * t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.08) {
tmp = ky * Math.abs(t_1);
} else if (Math.sin(kx) <= 2e-96) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.08: tmp = ky * math.fabs(t_1) elif math.sin(kx) <= 2e-96: tmp = math.sin(th) else: tmp = math.sin(ky) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.08) tmp = Float64(ky * abs(t_1)); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = Float64(sin(ky) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.08) tmp = ky * abs(t_1); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = sin(ky) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.08], N[(ky * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-96], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.08:\\
\;\;\;\;ky \cdot \left|t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-96}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0800000000000000017Initial 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.4%
associate-/l*19.4%
Simplified19.4%
add-sqr-sqrt9.7%
sqrt-unprod46.4%
pow246.4%
Applied egg-rr46.4%
unpow246.4%
rem-sqrt-square48.6%
Simplified48.6%
if -0.0800000000000000017 < (sin.f64 kx) < 1.9999999999999998e-96Initial program 88.1%
unpow288.1%
sqr-neg88.1%
sin-neg88.1%
sin-neg88.1%
unpow288.1%
associate-*l/85.1%
associate-/l*88.0%
unpow288.0%
Simplified99.8%
Taylor expanded in kx around 0 40.1%
if 1.9999999999999998e-96 < (sin.f64 kx) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/96.3%
associate-/l*99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in ky around 0 56.9%
Final simplification47.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.08) (* ky (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-96) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.08) {
tmp = ky * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 2e-96) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.08d0)) then
tmp = ky * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 2d-96) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.08) {
tmp = ky * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 2e-96) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.08: tmp = ky * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 2e-96: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.08) tmp = Float64(ky * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.08) tmp = ky * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.08], N[(ky * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-96], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.08:\\
\;\;\;\;ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-96}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0800000000000000017Initial 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.4%
associate-/l*19.4%
Simplified19.4%
add-sqr-sqrt9.7%
sqrt-unprod46.4%
pow246.4%
Applied egg-rr46.4%
unpow246.4%
rem-sqrt-square48.6%
Simplified48.6%
if -0.0800000000000000017 < (sin.f64 kx) < 1.9999999999999998e-96Initial program 88.1%
unpow288.1%
sqr-neg88.1%
sin-neg88.1%
sin-neg88.1%
unpow288.1%
associate-*l/85.1%
associate-/l*88.0%
unpow288.0%
Simplified99.8%
Taylor expanded in kx around 0 40.1%
if 1.9999999999999998e-96 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 56.9%
Final simplification47.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.08) (fabs (* (sin ky) (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-96) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.08) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(kx) <= 2e-96) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.08d0)) then
tmp = abs((sin(ky) * (sin(th) / sin(kx))))
else if (sin(kx) <= 2d-96) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.08) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-96) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.08: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 2e-96: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.08) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.08) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.08], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-96], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.08:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-96}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0800000000000000017Initial 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.5%
add-sqr-sqrt17.3%
sqrt-unprod38.2%
pow238.2%
Applied egg-rr38.2%
unpow238.2%
rem-sqrt-square43.5%
Simplified43.5%
if -0.0800000000000000017 < (sin.f64 kx) < 1.9999999999999998e-96Initial program 88.1%
unpow288.1%
sqr-neg88.1%
sin-neg88.1%
sin-neg88.1%
unpow288.1%
associate-*l/85.1%
associate-/l*88.0%
unpow288.0%
Simplified99.8%
Taylor expanded in kx around 0 40.1%
if 1.9999999999999998e-96 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 56.9%
Final simplification46.5%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (* (sin th) (/ (sin ky) (sin kx))))) (if (<= (sin kx) -0.08) (fabs t_1) (if (<= (sin kx) 2e-96) (sin th) t_1))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (sin(ky) / sin(kx));
double tmp;
if (sin(kx) <= -0.08) {
tmp = fabs(t_1);
} else if (sin(kx) <= 2e-96) {
tmp = sin(th);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(th) * (sin(ky) / sin(kx))
if (sin(kx) <= (-0.08d0)) then
tmp = abs(t_1)
else if (sin(kx) <= 2d-96) then
tmp = sin(th)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
double tmp;
if (Math.sin(kx) <= -0.08) {
tmp = Math.abs(t_1);
} else if (Math.sin(kx) <= 2e-96) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * (math.sin(ky) / math.sin(kx)) tmp = 0 if math.sin(kx) <= -0.08: tmp = math.fabs(t_1) elif math.sin(kx) <= 2e-96: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(sin(ky) / sin(kx))) tmp = 0.0 if (sin(kx) <= -0.08) tmp = abs(t_1); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * (sin(ky) / sin(kx)); tmp = 0.0; if (sin(kx) <= -0.08) tmp = abs(t_1); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.08], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-96], N[Sin[th], $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.08:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-96}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0800000000000000017Initial 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.5%
expm1-log1p-u19.5%
expm1-undefine20.5%
Applied egg-rr20.5%
expm1-define19.5%
Simplified19.5%
expm1-log1p-u19.5%
add-sqr-sqrt17.3%
sqrt-unprod38.2%
pow238.2%
Applied egg-rr38.2%
unpow238.2%
rem-sqrt-square43.5%
*-commutative43.5%
associate-*l/43.4%
associate-*r/43.5%
Simplified43.5%
if -0.0800000000000000017 < (sin.f64 kx) < 1.9999999999999998e-96Initial program 88.1%
unpow288.1%
sqr-neg88.1%
sin-neg88.1%
sin-neg88.1%
unpow288.1%
associate-*l/85.1%
associate-/l*88.0%
unpow288.0%
Simplified99.8%
Taylor expanded in kx around 0 40.1%
if 1.9999999999999998e-96 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 56.9%
Final simplification46.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.08) (* (sin ky) (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-96) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.08) {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 2e-96) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.08d0)) then
tmp = sin(ky) * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 2d-96) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.08) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 2e-96) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.08: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 2e-96: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.08) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.08) tmp = sin(ky) * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 2e-96) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.08], 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], 2e-96], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.08:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-96}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0800000000000000017Initial 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.5%
add-sqr-sqrt9.7%
sqrt-unprod46.4%
pow246.4%
Applied egg-rr48.5%
unpow246.4%
rem-sqrt-square48.6%
Simplified51.7%
if -0.0800000000000000017 < (sin.f64 kx) < 1.9999999999999998e-96Initial program 88.1%
unpow288.1%
sqr-neg88.1%
sin-neg88.1%
sin-neg88.1%
unpow288.1%
associate-*l/85.1%
associate-/l*88.0%
unpow288.0%
Simplified99.8%
Taylor expanded in kx around 0 40.1%
if 1.9999999999999998e-96 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 56.9%
Final simplification48.5%
(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.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/92.3%
associate-/l*94.7%
unpow294.7%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 5e-52) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-52) {
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.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-52) 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.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-52) {
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.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-52: 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-52) 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-52) 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.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-52], 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.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-52}:\\
\;\;\;\;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.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.5%
sqrt-unprod19.4%
pow219.4%
associate-*r/19.4%
*-commutative19.4%
associate-/l*19.4%
Applied egg-rr19.4%
unpow219.4%
rem-sqrt-square30.5%
*-inverses30.5%
*-rgt-identity30.5%
Simplified30.5%
if -0.0200000000000000004 < (sin.f64 ky) < 5e-52Initial program 89.8%
unpow289.8%
sqr-neg89.8%
sin-neg89.8%
sin-neg89.8%
unpow289.8%
associate-*l/85.8%
associate-/l*89.7%
unpow289.7%
Simplified99.6%
Taylor expanded in ky around 0 43.8%
associate-/l*47.3%
Simplified47.3%
if 5e-52 < (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%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 56.9%
Final simplification46.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.08) (* ky (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 1e-93) (sin th) (/ (sin th) (/ (sin kx) ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.08) {
tmp = ky * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 1e-93) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / 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.08d0)) then
tmp = ky * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 1d-93) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.08) {
tmp = ky * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-93) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.08: tmp = ky * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 1e-93: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.08) tmp = Float64(ky * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-93) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.08) tmp = ky * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 1e-93) tmp = sin(th); else tmp = sin(th) / (sin(kx) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.08], N[(ky * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-93], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.08:\\
\;\;\;\;ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-93}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0800000000000000017Initial 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.4%
associate-/l*19.4%
Simplified19.4%
add-sqr-sqrt9.7%
sqrt-unprod46.4%
pow246.4%
Applied egg-rr46.4%
unpow246.4%
rem-sqrt-square48.6%
Simplified48.6%
if -0.0800000000000000017 < (sin.f64 kx) < 9.999999999999999e-94Initial program 88.2%
unpow288.2%
sqr-neg88.2%
sin-neg88.2%
sin-neg88.2%
unpow288.2%
associate-*l/85.2%
associate-/l*88.1%
unpow288.1%
Simplified99.8%
Taylor expanded in kx around 0 40.7%
if 9.999999999999999e-94 < (sin.f64 kx) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/96.3%
associate-/l*99.5%
unpow299.5%
Simplified99.6%
associate-*r/96.3%
hypot-undefine96.3%
unpow296.3%
unpow296.3%
+-commutative96.3%
associate-*l/99.5%
*-commutative99.5%
clear-num99.4%
un-div-inv99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-undefine99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 48.8%
Final simplification45.3%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.102) (/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)) (/ (* (sin th) ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.102) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = (sin(th) * ky) / hypot(sin(ky), sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.102) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = (Math.sin(th) * ky) / Math.hypot(Math.sin(ky), Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.102: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = (math.sin(th) * ky) / math.hypot(math.sin(ky), math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.102) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(Float64(sin(th) * ky) / hypot(sin(ky), sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.102) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = (sin(th) * ky) / hypot(sin(ky), sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.102], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $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 0.102:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\end{array}
\end{array}
if th < 0.101999999999999993Initial program 93.5%
unpow293.5%
sqr-neg93.5%
sin-neg93.5%
sin-neg93.5%
unpow293.5%
associate-*l/90.4%
associate-/l*93.5%
unpow293.5%
Simplified99.7%
clear-num99.4%
un-div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 61.2%
associate-*l/61.3%
+-commutative61.3%
unpow261.3%
unpow261.3%
hypot-undefine65.4%
*-lft-identity65.4%
hypot-undefine61.3%
unpow261.3%
unpow261.3%
+-commutative61.3%
unpow261.3%
unpow261.3%
hypot-define65.4%
Simplified65.4%
if 0.101999999999999993 < th Initial program 98.0%
unpow298.0%
sqr-neg98.0%
sin-neg98.0%
sin-neg98.0%
unpow298.0%
associate-*l/98.0%
associate-/l*98.1%
unpow298.1%
Simplified99.5%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 51.5%
Final simplification61.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 5e-71) (* ky (/ (sin th) kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-71) {
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.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-71) 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.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-71) {
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.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-71: 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-71) 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.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-71) 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.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-71], 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.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-71}:\\
\;\;\;\;ky \cdot \frac{\sin th}{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.7%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 3.1%
add-sqr-sqrt1.5%
sqrt-unprod19.4%
pow219.4%
associate-*r/19.4%
*-commutative19.4%
associate-/l*19.4%
Applied egg-rr19.4%
unpow219.4%
rem-sqrt-square30.5%
*-inverses30.5%
*-rgt-identity30.5%
Simplified30.5%
if -0.0200000000000000004 < (sin.f64 ky) < 4.99999999999999998e-71Initial program 89.2%
unpow289.2%
sqr-neg89.2%
sin-neg89.2%
sin-neg89.2%
unpow289.2%
associate-*l/85.0%
associate-/l*89.1%
unpow289.1%
Simplified99.6%
Taylor expanded in ky around 0 45.7%
associate-/l*49.4%
Simplified49.4%
Taylor expanded in kx around 0 31.6%
associate-/l*35.2%
Simplified35.2%
if 4.99999999999999998e-71 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/98.4%
associate-/l*99.6%
unpow299.6%
Simplified99.7%
Taylor expanded in kx around 0 56.2%
Final simplification41.0%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky 1.2e-140) (and (not (<= ky 1.35e-90)) (<= ky 4.2e-71))) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= 1.2e-140) || (!(ky <= 1.35e-90) && (ky <= 4.2e-71))) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= 1.2d-140) .or. (.not. (ky <= 1.35d-90)) .and. (ky <= 4.2d-71)) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= 1.2e-140) || (!(ky <= 1.35e-90) && (ky <= 4.2e-71))) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= 1.2e-140) or (not (ky <= 1.35e-90) and (ky <= 4.2e-71)): tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= 1.2e-140) || (!(ky <= 1.35e-90) && (ky <= 4.2e-71))) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= 1.2e-140) || (~((ky <= 1.35e-90)) && (ky <= 4.2e-71))) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, 1.2e-140], And[N[Not[LessEqual[ky, 1.35e-90]], $MachinePrecision], LessEqual[ky, 4.2e-71]]], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.2 \cdot 10^{-140} \lor \neg \left(ky \leq 1.35 \cdot 10^{-90}\right) \land ky \leq 4.2 \cdot 10^{-71}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.19999999999999993e-140 or 1.34999999999999998e-90 < ky < 4.2000000000000002e-71Initial program 92.1%
unpow292.1%
sqr-neg92.1%
sin-neg92.1%
sin-neg92.1%
unpow292.1%
associate-*l/89.0%
associate-/l*92.1%
unpow292.1%
Simplified99.7%
Taylor expanded in ky around 0 32.7%
associate-/l*35.3%
Simplified35.3%
Taylor expanded in th around 0 21.7%
associate-/l*24.4%
Simplified24.4%
if 1.19999999999999993e-140 < ky < 1.34999999999999998e-90 or 4.2000000000000002e-71 < ky Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/98.5%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 35.1%
Final simplification28.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.9e-71) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.9e-71) {
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 <= 3.9d-71) 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 <= 3.9e-71) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.9e-71: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.9e-71) 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 <= 3.9e-71) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.9e-71], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.9 \cdot 10^{-71}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.9000000000000002e-71Initial program 92.5%
unpow292.5%
sqr-neg92.5%
sin-neg92.5%
sin-neg92.5%
unpow292.5%
associate-*l/89.7%
associate-/l*92.5%
unpow292.5%
Simplified99.7%
Taylor expanded in ky around 0 32.1%
associate-/l*34.7%
Simplified34.7%
Taylor expanded in kx around 0 22.4%
associate-/l*25.0%
Simplified25.0%
if 3.9000000000000002e-71 < 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%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 34.0%
Final simplification27.7%
(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.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/92.3%
associate-/l*94.7%
unpow294.7%
Simplified99.6%
Taylor expanded in kx around 0 22.9%
Final simplification22.9%
(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.7%
unpow294.7%
sqr-neg94.7%
sin-neg94.7%
sin-neg94.7%
unpow294.7%
associate-*l/92.3%
associate-/l*94.7%
unpow294.7%
Simplified99.6%
Taylor expanded in kx around 0 22.9%
Taylor expanded in th around 0 12.0%
Final simplification12.0%
herbie shell --seed 2024071
(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)))