
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(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 94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -2e-17)
(fabs (sin th))
(if (<= (sin ky) -4e-305)
(/ (sin th) (/ (sin kx) ky))
(if (<= (sin ky) 1e-18)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-17) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -4e-305) {
tmp = sin(th) / (sin(kx) / ky);
} else if (sin(ky) <= 1e-18) {
tmp = sin(th) * fabs((sin(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) <= (-2d-17)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-4d-305)) then
tmp = sin(th) / (sin(kx) / ky)
else if (sin(ky) <= 1d-18) then
tmp = sin(th) * abs((sin(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) <= -2e-17) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -4e-305) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else if (Math.sin(ky) <= 1e-18) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-17: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -4e-305: tmp = math.sin(th) / (math.sin(kx) / ky) elif math.sin(ky) <= 1e-18: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-305) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif (sin(ky) <= 1e-18) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= -4e-305) tmp = sin(th) / (sin(kx) / ky); elseif (sin(ky) <= 1e-18) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-17], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -4e-305], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-18], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-17}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -4 \cdot 10^{-305}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;\sin ky \leq 10^{-18}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.00000000000000014e-17Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square30.0%
Simplified30.0%
if -2.00000000000000014e-17 < (sin.f64 ky) < -3.99999999999999999e-305Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.7%
hypot-udef90.3%
unpow290.3%
unpow290.3%
+-commutative90.3%
unpow290.3%
unpow290.3%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 59.2%
if -3.99999999999999999e-305 < (sin.f64 ky) < 1.0000000000000001e-18Initial program 85.4%
Taylor expanded in ky around 0 57.1%
add-log-exp21.5%
Applied egg-rr21.5%
rem-log-exp57.1%
add-sqr-sqrt49.9%
sqrt-unprod65.4%
pow265.4%
Applied egg-rr65.4%
unpow265.4%
rem-sqrt-square84.3%
Simplified84.3%
if 1.0000000000000001e-18 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.6%
Final simplification57.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(if (<= (sin ky) 1e-18)
(/ (sin th) (* (hypot (sin kx) (sin ky)) (/ 1.0 ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else if (sin(ky) <= 1e-18) {
tmp = sin(th) / (hypot(sin(kx), sin(ky)) * (1.0 / ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else if (Math.sin(ky) <= 1e-18) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th elif math.sin(ky) <= 1e-18: tmp = math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) * (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); elseif (sin(ky) <= 1e-18) tmp = Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) * Float64(1.0 / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; elseif (sin(ky) <= 1e-18) tmp = sin(th) / (hypot(sin(kx), sin(ky)) * (1.0 / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-18], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;\sin ky \leq 10^{-18}:\\
\;\;\;\;\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 47.2%
if -0.0200000000000000004 < (sin.f64 ky) < 1.0000000000000001e-18Initial program 88.3%
+-commutative88.3%
unpow288.3%
unpow288.3%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef88.2%
unpow288.2%
unpow288.2%
+-commutative88.2%
unpow288.2%
unpow288.2%
hypot-def99.7%
Applied egg-rr99.7%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
if 1.0000000000000001e-18 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 65.6%
Final simplification76.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(fabs (sin th))
(if (<= (sin th) 5e-19)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(/ (* (sin ky) (sin th)) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(th) <= 5e-19) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = (sin(ky) * sin(th)) / sin(kx);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= 5e-19) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= 5e-19: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = (math.sin(ky) * math.sin(th)) / math.sin(kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 5e-19) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sin(kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 5e-19) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = (sin(ky) * sin(th)) / sin(kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 5e-19], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 26.3%
add-sqr-sqrt0.0%
sqrt-unprod31.2%
pow231.2%
Applied egg-rr31.2%
unpow231.2%
rem-sqrt-square31.2%
Simplified31.2%
if -0.050000000000000003 < (sin.f64 th) < 5.0000000000000004e-19Initial program 93.7%
associate-*l/90.3%
*-commutative90.3%
associate-*l/93.6%
+-commutative93.6%
unpow293.6%
unpow293.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 98.8%
if 5.0000000000000004e-19 < (sin.f64 th) Initial program 98.1%
Taylor expanded in ky around 0 31.8%
Taylor expanded in ky around inf 31.9%
Final simplification65.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(fabs (sin th))
(if (<= (sin th) 5e-18)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(/ (* (sin ky) (sin th)) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(th) <= 5e-18) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = (sin(ky) * sin(th)) / sin(kx);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= 5e-18) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= 5e-18: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = (math.sin(ky) * math.sin(th)) / math.sin(kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 5e-18) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(Float64(sin(ky) * sin(th)) / sin(kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 5e-18) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = (sin(ky) * sin(th)) / sin(kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 5e-18], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq 5 \cdot 10^{-18}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 26.3%
add-sqr-sqrt0.0%
sqrt-unprod31.2%
pow231.2%
Applied egg-rr31.2%
unpow231.2%
rem-sqrt-square31.2%
Simplified31.2%
if -0.050000000000000003 < (sin.f64 th) < 5.00000000000000036e-18Initial program 93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 99.0%
if 5.00000000000000036e-18 < (sin.f64 th) Initial program 98.1%
Taylor expanded in ky around 0 31.2%
Taylor expanded in ky around inf 31.3%
Final simplification65.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(fabs (sin th))
(if (<= (sin th) 5e-18)
(/ th (/ (hypot (sin kx) (sin ky)) (sin ky)))
(/ (* (sin ky) (sin th)) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = fabs(sin(th));
} else if (sin(th) <= 5e-18) {
tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky));
} else {
tmp = (sin(ky) * sin(th)) / sin(kx);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(th) <= 5e-18) {
tmp = th / (Math.hypot(Math.sin(kx), Math.sin(ky)) / Math.sin(ky));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.fabs(math.sin(th)) elif math.sin(th) <= 5e-18: tmp = th / (math.hypot(math.sin(kx), math.sin(ky)) / math.sin(ky)) else: tmp = (math.sin(ky) * math.sin(th)) / math.sin(kx) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 5e-18) tmp = Float64(th / Float64(hypot(sin(kx), sin(ky)) / sin(ky))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sin(kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = abs(sin(th)); elseif (sin(th) <= 5e-18) tmp = th / (hypot(sin(kx), sin(ky)) / sin(ky)); else tmp = (sin(ky) * sin(th)) / sin(kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 5e-18], N[(th / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin th \leq 5 \cdot 10^{-18}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 26.3%
add-sqr-sqrt0.0%
sqrt-unprod31.2%
pow231.2%
Applied egg-rr31.2%
unpow231.2%
rem-sqrt-square31.2%
Simplified31.2%
if -0.050000000000000003 < (sin.f64 th) < 5.00000000000000036e-18Initial program 93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 99.0%
*-commutative99.0%
clear-num98.9%
un-div-inv99.0%
add-sqr-sqrt98.5%
add-sqr-sqrt99.0%
hypot-udef93.0%
+-commutative93.0%
hypot-udef99.0%
Applied egg-rr99.0%
if 5.00000000000000036e-18 < (sin.f64 th) Initial program 98.1%
Taylor expanded in ky around 0 31.2%
Taylor expanded in ky around inf 31.3%
Final simplification65.9%
(FPCore (kx ky th)
:precision binary64
(if (or (<= th -2.26e-7) (not (<= th 4.6e+25)))
(/
(sin th)
(* (hypot (sin kx) (sin ky)) (+ (* ky 0.16666666666666666) (/ 1.0 ky))))
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)))
double code(double kx, double ky, double th) {
double tmp;
if ((th <= -2.26e-7) || !(th <= 4.6e+25)) {
tmp = sin(th) / (hypot(sin(kx), sin(ky)) * ((ky * 0.16666666666666666) + (1.0 / ky)));
} else {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if ((th <= -2.26e-7) || !(th <= 4.6e+25)) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * ((ky * 0.16666666666666666) + (1.0 / ky)));
} else {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (th <= -2.26e-7) or not (th <= 4.6e+25): tmp = math.sin(th) / (math.hypot(math.sin(kx), math.sin(ky)) * ((ky * 0.16666666666666666) + (1.0 / ky))) else: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th return tmp
function code(kx, ky, th) tmp = 0.0 if ((th <= -2.26e-7) || !(th <= 4.6e+25)) tmp = Float64(sin(th) / Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky)))); else tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((th <= -2.26e-7) || ~((th <= 4.6e+25))) tmp = sin(th) / (hypot(sin(kx), sin(ky)) * ((ky * 0.16666666666666666) + (1.0 / ky))); else tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[th, -2.26e-7], N[Not[LessEqual[th, 4.6e+25]], $MachinePrecision]], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq -2.26 \cdot 10^{-7} \lor \neg \left(th \leq 4.6 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(ky \cdot 0.16666666666666666 + \frac{1}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\end{array}
\end{array}
if th < -2.26000000000000012e-7 or 4.5999999999999996e25 < th Initial program 94.9%
+-commutative94.9%
unpow294.9%
unpow294.9%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.4%
un-div-inv99.5%
hypot-udef94.8%
unpow294.8%
unpow294.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-def99.5%
Applied egg-rr99.5%
div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 52.7%
if -2.26000000000000012e-7 < th < 4.5999999999999996e25Initial program 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 98.4%
Final simplification76.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-17) (fabs (sin th)) (if (<= (sin ky) 5e-32) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-17) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-32) {
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) <= (-2d-17)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-32) 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) <= -2e-17) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-32) {
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) <= -2e-17: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-32: 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) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) 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) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) 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], -2e-17], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-32], 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 -2 \cdot 10^{-17}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.00000000000000014e-17Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square30.0%
Simplified30.0%
if -2.00000000000000014e-17 < (sin.f64 ky) < 5e-32Initial program 87.9%
Taylor expanded in ky around 0 57.8%
if 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 64.7%
Final simplification51.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-17) (fabs (sin th)) (if (<= (sin ky) 5e-32) (/ ky (/ (sin kx) (sin th))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-17) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-32) {
tmp = ky / (sin(kx) / sin(th));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-2d-17)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-32) then
tmp = ky / (sin(kx) / sin(th))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -2e-17) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-32) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-17: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-32: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-17) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-32) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-17], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-32], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-17}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -2.00000000000000014e-17Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.5%
sqrt-unprod25.7%
pow225.7%
Applied egg-rr25.7%
unpow225.7%
rem-sqrt-square30.0%
Simplified30.0%
if -2.00000000000000014e-17 < (sin.f64 ky) < 5e-32Initial program 87.9%
+-commutative87.9%
unpow287.9%
unpow287.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 55.4%
associate-/l*57.8%
Simplified57.8%
if 5e-32 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 64.7%
Final simplification51.7%
(FPCore (kx ky th) :precision binary64 (if (<= kx 4.8e-253) (sin th) (if (<= kx 4.8e-20) (fabs (sin th)) (fabs (* ky (/ th (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.8e-253) {
tmp = sin(th);
} else if (kx <= 4.8e-20) {
tmp = fabs(sin(th));
} else {
tmp = fabs((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 <= 4.8d-253) then
tmp = sin(th)
else if (kx <= 4.8d-20) then
tmp = abs(sin(th))
else
tmp = abs((ky * (th / sin(kx))))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4.8e-253) {
tmp = Math.sin(th);
} else if (kx <= 4.8e-20) {
tmp = Math.abs(Math.sin(th));
} else {
tmp = Math.abs((ky * (th / Math.sin(kx))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 4.8e-253: tmp = math.sin(th) elif kx <= 4.8e-20: tmp = math.fabs(math.sin(th)) else: tmp = math.fabs((ky * (th / math.sin(kx)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 4.8e-253) tmp = sin(th); elseif (kx <= 4.8e-20) tmp = abs(sin(th)); else tmp = abs(Float64(ky * Float64(th / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 4.8e-253) tmp = sin(th); elseif (kx <= 4.8e-20) tmp = abs(sin(th)); else tmp = abs((ky * (th / sin(kx)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 4.8e-253], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 4.8e-20], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], N[Abs[N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 4.8 \cdot 10^{-253}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 4.8 \cdot 10^{-20}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{else}:\\
\;\;\;\;\left|ky \cdot \frac{th}{\sin kx}\right|\\
\end{array}
\end{array}
if kx < 4.80000000000000018e-253Initial program 94.2%
+-commutative94.2%
unpow294.2%
unpow294.2%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 27.4%
if 4.80000000000000018e-253 < kx < 4.79999999999999986e-20Initial program 87.7%
+-commutative87.7%
unpow287.7%
unpow287.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 33.9%
add-sqr-sqrt20.0%
sqrt-unprod37.3%
pow237.3%
Applied egg-rr37.3%
unpow237.3%
rem-sqrt-square43.9%
Simplified43.9%
if 4.79999999999999986e-20 < kx Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in th around 0 56.3%
Taylor expanded in ky around 0 22.2%
associate-/l*23.0%
Simplified23.0%
add-sqr-sqrt19.8%
sqrt-unprod19.0%
pow219.0%
div-inv19.0%
clear-num19.0%
Applied egg-rr19.0%
unpow219.0%
rem-sqrt-square22.6%
Simplified22.6%
Final simplification29.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 1.25e-254) (sin th) (if (<= kx 1.05e-22) (fabs (sin th)) (/ ky (/ (sin kx) th)))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.25e-254) {
tmp = sin(th);
} else if (kx <= 1.05e-22) {
tmp = fabs(sin(th));
} else {
tmp = ky / (sin(kx) / 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 (kx <= 1.25d-254) then
tmp = sin(th)
else if (kx <= 1.05d-22) then
tmp = abs(sin(th))
else
tmp = ky / (sin(kx) / th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 1.25e-254) {
tmp = Math.sin(th);
} else if (kx <= 1.05e-22) {
tmp = Math.abs(Math.sin(th));
} else {
tmp = ky / (Math.sin(kx) / th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 1.25e-254: tmp = math.sin(th) elif kx <= 1.05e-22: tmp = math.fabs(math.sin(th)) else: tmp = ky / (math.sin(kx) / th) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 1.25e-254) tmp = sin(th); elseif (kx <= 1.05e-22) tmp = abs(sin(th)); else tmp = Float64(ky / Float64(sin(kx) / th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 1.25e-254) tmp = sin(th); elseif (kx <= 1.05e-22) tmp = abs(sin(th)); else tmp = ky / (sin(kx) / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 1.25e-254], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 1.05e-22], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 1.25 \cdot 10^{-254}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 1.05 \cdot 10^{-22}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\end{array}
\end{array}
if kx < 1.2500000000000001e-254Initial program 94.2%
+-commutative94.2%
unpow294.2%
unpow294.2%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 27.4%
if 1.2500000000000001e-254 < kx < 1.05000000000000004e-22Initial program 87.5%
+-commutative87.5%
unpow287.5%
unpow287.5%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 34.6%
add-sqr-sqrt20.4%
sqrt-unprod38.0%
pow238.0%
Applied egg-rr38.0%
unpow238.0%
rem-sqrt-square44.8%
Simplified44.8%
if 1.05000000000000004e-22 < kx Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in th around 0 55.6%
Taylor expanded in ky around 0 21.9%
associate-/l*22.8%
Simplified22.8%
Final simplification29.3%
(FPCore (kx ky th)
:precision binary64
(if (or (<= ky -9.5)
(and (not (<= ky 6.2e-144))
(or (<= ky 4.3e-71) (not (<= ky 3.2e-32)))))
(sin th)
(* th (/ ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -9.5) || (!(ky <= 6.2e-144) && ((ky <= 4.3e-71) || !(ky <= 3.2e-32)))) {
tmp = sin(th);
} else {
tmp = 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 ((ky <= (-9.5d0)) .or. (.not. (ky <= 6.2d-144)) .and. (ky <= 4.3d-71) .or. (.not. (ky <= 3.2d-32))) then
tmp = sin(th)
else
tmp = th * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -9.5) || (!(ky <= 6.2e-144) && ((ky <= 4.3e-71) || !(ky <= 3.2e-32)))) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -9.5) or (not (ky <= 6.2e-144) and ((ky <= 4.3e-71) or not (ky <= 3.2e-32))): tmp = math.sin(th) else: tmp = th * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -9.5) || (!(ky <= 6.2e-144) && ((ky <= 4.3e-71) || !(ky <= 3.2e-32)))) tmp = sin(th); else tmp = Float64(th * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -9.5) || (~((ky <= 6.2e-144)) && ((ky <= 4.3e-71) || ~((ky <= 3.2e-32))))) tmp = sin(th); else tmp = th * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -9.5], And[N[Not[LessEqual[ky, 6.2e-144]], $MachinePrecision], Or[LessEqual[ky, 4.3e-71], N[Not[LessEqual[ky, 3.2e-32]], $MachinePrecision]]]], N[Sin[th], $MachinePrecision], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -9.5 \lor \neg \left(ky \leq 6.2 \cdot 10^{-144}\right) \land \left(ky \leq 4.3 \cdot 10^{-71} \lor \neg \left(ky \leq 3.2 \cdot 10^{-32}\right)\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if ky < -9.5 or 6.2000000000000001e-144 < ky < 4.2999999999999997e-71 or 3.2000000000000002e-32 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 35.0%
if -9.5 < ky < 6.2000000000000001e-144 or 4.2999999999999997e-71 < ky < 3.2000000000000002e-32Initial program 87.0%
+-commutative87.0%
unpow287.0%
unpow287.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 53.4%
Taylor expanded in ky around 0 33.5%
associate-/l*36.1%
Simplified36.1%
associate-/r/36.1%
Applied egg-rr36.1%
Final simplification35.5%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -9.5)
(sin th)
(if (<= ky 3.1e-140)
(* th (/ ky (sin kx)))
(if (or (<= ky 3.8e-70) (not (<= ky 3.2e-32)))
(sin th)
(/ ky (/ (sin kx) th))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -9.5) {
tmp = sin(th);
} else if (ky <= 3.1e-140) {
tmp = th * (ky / sin(kx));
} else if ((ky <= 3.8e-70) || !(ky <= 3.2e-32)) {
tmp = sin(th);
} else {
tmp = ky / (sin(kx) / 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 <= (-9.5d0)) then
tmp = sin(th)
else if (ky <= 3.1d-140) then
tmp = th * (ky / sin(kx))
else if ((ky <= 3.8d-70) .or. (.not. (ky <= 3.2d-32))) then
tmp = sin(th)
else
tmp = ky / (sin(kx) / th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -9.5) {
tmp = Math.sin(th);
} else if (ky <= 3.1e-140) {
tmp = th * (ky / Math.sin(kx));
} else if ((ky <= 3.8e-70) || !(ky <= 3.2e-32)) {
tmp = Math.sin(th);
} else {
tmp = ky / (Math.sin(kx) / th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -9.5: tmp = math.sin(th) elif ky <= 3.1e-140: tmp = th * (ky / math.sin(kx)) elif (ky <= 3.8e-70) or not (ky <= 3.2e-32): tmp = math.sin(th) else: tmp = ky / (math.sin(kx) / th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -9.5) tmp = sin(th); elseif (ky <= 3.1e-140) tmp = Float64(th * Float64(ky / sin(kx))); elseif ((ky <= 3.8e-70) || !(ky <= 3.2e-32)) tmp = sin(th); else tmp = Float64(ky / Float64(sin(kx) / th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -9.5) tmp = sin(th); elseif (ky <= 3.1e-140) tmp = th * (ky / sin(kx)); elseif ((ky <= 3.8e-70) || ~((ky <= 3.2e-32))) tmp = sin(th); else tmp = ky / (sin(kx) / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -9.5], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.1e-140], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 3.8e-70], N[Not[LessEqual[ky, 3.2e-32]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -9.5:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.1 \cdot 10^{-140}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 3.8 \cdot 10^{-70} \lor \neg \left(ky \leq 3.2 \cdot 10^{-32}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\end{array}
\end{array}
if ky < -9.5 or 3.0999999999999999e-140 < ky < 3.7999999999999998e-70 or 3.2000000000000002e-32 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 35.0%
if -9.5 < ky < 3.0999999999999999e-140Initial program 86.1%
+-commutative86.1%
unpow286.1%
unpow286.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 52.1%
Taylor expanded in ky around 0 32.7%
associate-/l*35.4%
Simplified35.4%
associate-/r/35.5%
Applied egg-rr35.5%
if 3.7999999999999998e-70 < ky < 3.2000000000000002e-32Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 72.1%
Taylor expanded in ky around 0 44.6%
associate-/l*44.8%
Simplified44.8%
Final simplification35.5%
(FPCore (kx ky th)
:precision binary64
(if (<= ky -9.5)
(sin th)
(if (<= ky 9.5e-142)
(/ th (/ (sin kx) ky))
(if (or (<= ky 2.25e-72) (not (<= ky 3.2e-32)))
(sin th)
(/ ky (/ (sin kx) th))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -9.5) {
tmp = sin(th);
} else if (ky <= 9.5e-142) {
tmp = th / (sin(kx) / ky);
} else if ((ky <= 2.25e-72) || !(ky <= 3.2e-32)) {
tmp = sin(th);
} else {
tmp = ky / (sin(kx) / 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 <= (-9.5d0)) then
tmp = sin(th)
else if (ky <= 9.5d-142) then
tmp = th / (sin(kx) / ky)
else if ((ky <= 2.25d-72) .or. (.not. (ky <= 3.2d-32))) then
tmp = sin(th)
else
tmp = ky / (sin(kx) / th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -9.5) {
tmp = Math.sin(th);
} else if (ky <= 9.5e-142) {
tmp = th / (Math.sin(kx) / ky);
} else if ((ky <= 2.25e-72) || !(ky <= 3.2e-32)) {
tmp = Math.sin(th);
} else {
tmp = ky / (Math.sin(kx) / th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -9.5: tmp = math.sin(th) elif ky <= 9.5e-142: tmp = th / (math.sin(kx) / ky) elif (ky <= 2.25e-72) or not (ky <= 3.2e-32): tmp = math.sin(th) else: tmp = ky / (math.sin(kx) / th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -9.5) tmp = sin(th); elseif (ky <= 9.5e-142) tmp = Float64(th / Float64(sin(kx) / ky)); elseif ((ky <= 2.25e-72) || !(ky <= 3.2e-32)) tmp = sin(th); else tmp = Float64(ky / Float64(sin(kx) / th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -9.5) tmp = sin(th); elseif (ky <= 9.5e-142) tmp = th / (sin(kx) / ky); elseif ((ky <= 2.25e-72) || ~((ky <= 3.2e-32))) tmp = sin(th); else tmp = ky / (sin(kx) / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -9.5], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 9.5e-142], N[(th / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 2.25e-72], N[Not[LessEqual[ky, 3.2e-32]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -9.5:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 9.5 \cdot 10^{-142}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;ky \leq 2.25 \cdot 10^{-72} \lor \neg \left(ky \leq 3.2 \cdot 10^{-32}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\end{array}
\end{array}
if ky < -9.5 or 9.49999999999999967e-142 < ky < 2.25e-72 or 3.2000000000000002e-32 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 35.0%
if -9.5 < ky < 9.49999999999999967e-142Initial program 86.1%
+-commutative86.1%
unpow286.1%
unpow286.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 52.1%
associate-*l/43.1%
add-sqr-sqrt43.1%
add-sqr-sqrt43.1%
hypot-udef40.8%
+-commutative40.8%
hypot-udef43.1%
Applied egg-rr43.1%
Taylor expanded in ky around 0 32.7%
*-commutative32.7%
associate-/l*35.5%
Simplified35.5%
if 2.25e-72 < ky < 3.2000000000000002e-32Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 72.1%
Taylor expanded in ky around 0 44.6%
associate-/l*44.8%
Simplified44.8%
Final simplification35.5%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -9.5) (not (<= ky 1e-140))) (sin th) (* th (/ ky kx))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -9.5) || !(ky <= 1e-140)) {
tmp = sin(th);
} else {
tmp = th * (ky / 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 ((ky <= (-9.5d0)) .or. (.not. (ky <= 1d-140))) then
tmp = sin(th)
else
tmp = th * (ky / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -9.5) || !(ky <= 1e-140)) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -9.5) or not (ky <= 1e-140): tmp = math.sin(th) else: tmp = th * (ky / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -9.5) || !(ky <= 1e-140)) tmp = sin(th); else tmp = Float64(th * Float64(ky / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -9.5) || ~((ky <= 1e-140))) tmp = sin(th); else tmp = th * (ky / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -9.5], N[Not[LessEqual[ky, 1e-140]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -9.5 \lor \neg \left(ky \leq 10^{-140}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\end{array}
\end{array}
if ky < -9.5 or 9.9999999999999998e-141 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 33.8%
if -9.5 < ky < 9.9999999999999998e-141Initial program 86.1%
+-commutative86.1%
unpow286.1%
unpow286.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 52.1%
Taylor expanded in ky around 0 32.7%
associate-/l*35.4%
Simplified35.4%
Taylor expanded in kx around 0 29.4%
associate-/l*32.1%
Simplified32.1%
associate-/r/32.2%
Applied egg-rr32.2%
Final simplification33.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky -0.8) th (if (<= ky 3.1e-34) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.8) {
tmp = th;
} else if (ky <= 3.1e-34) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-0.8d0)) then
tmp = th
else if (ky <= 3.1d-34) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -0.8) {
tmp = th;
} else if (ky <= 3.1e-34) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -0.8: tmp = th elif ky <= 3.1e-34: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -0.8) tmp = th; elseif (ky <= 3.1e-34) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -0.8) tmp = th; elseif (ky <= 3.1e-34) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -0.8], th, If[LessEqual[ky, 3.1e-34], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.8:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 3.1 \cdot 10^{-34}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -0.80000000000000004 or 3.0999999999999998e-34 < ky Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 53.7%
Taylor expanded in kx around 0 20.8%
if -0.80000000000000004 < ky < 3.0999999999999998e-34Initial program 88.1%
+-commutative88.1%
unpow288.1%
unpow288.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 52.4%
Taylor expanded in ky around 0 31.8%
associate-/l*34.1%
Simplified34.1%
Taylor expanded in kx around 0 28.2%
associate-/l*30.4%
Simplified30.4%
associate-/r/30.5%
Applied egg-rr30.5%
Final simplification25.3%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 53.1%
Taylor expanded in kx around 0 14.2%
Final simplification14.2%
herbie shell --seed 2023299
(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)))