
(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 15 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 95.5%
+-commutative95.5%
unpow295.5%
unpow295.5%
hypot-undefine99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 2e-295)
(/ (sin ky) (fabs (/ (sin kx) (sin th))))
(if (<= (sin ky) 1e-8)
(/ (* ky (sin th)) (hypot (sin kx) (sin ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-295) {
tmp = sin(ky) / fabs((sin(kx) / sin(th)));
} else if (sin(ky) <= 1e-8) {
tmp = (ky * sin(th)) / hypot(sin(kx), sin(ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-295) {
tmp = Math.sin(ky) / Math.abs((Math.sin(kx) / Math.sin(th)));
} else if (Math.sin(ky) <= 1e-8) {
tmp = (ky * Math.sin(th)) / Math.hypot(Math.sin(kx), Math.sin(ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-295: tmp = math.sin(ky) / math.fabs((math.sin(kx) / math.sin(th))) elif math.sin(ky) <= 1e-8: tmp = (ky * math.sin(th)) / math.hypot(math.sin(kx), math.sin(ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-295) tmp = Float64(sin(ky) / abs(Float64(sin(kx) / sin(th)))); elseif (sin(ky) <= 1e-8) tmp = Float64(Float64(ky * sin(th)) / hypot(sin(kx), sin(ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-295) tmp = sin(ky) / abs((sin(kx) / sin(th))); elseif (sin(ky) <= 1e-8) tmp = (ky * sin(th)) / hypot(sin(kx), sin(ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-295], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-8], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-295}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\mathbf{elif}\;\sin ky \leq 10^{-8}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2.00000000000000012e-295Initial program 94.5%
unpow294.5%
sqr-neg94.5%
sin-neg94.5%
sin-neg94.5%
unpow294.5%
associate-*l/91.6%
associate-/l*94.5%
unpow294.5%
Simplified99.6%
Taylor expanded in ky around 0 28.9%
clear-num28.9%
un-div-inv28.9%
Applied egg-rr28.9%
add-sqr-sqrt16.8%
sqrt-unprod28.1%
pow228.1%
Applied egg-rr28.1%
unpow228.1%
rem-sqrt-square30.4%
Simplified30.4%
if 2.00000000000000012e-295 < (sin.f64 ky) < 1e-8Initial program 93.5%
unpow293.5%
sqr-neg93.5%
sin-neg93.5%
sin-neg93.5%
unpow293.5%
associate-*l/87.6%
associate-/l*93.4%
unpow293.4%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
associate-/r/99.7%
associate-*l/92.4%
*-commutative92.4%
hypot-undefine87.6%
unpow287.6%
unpow287.6%
+-commutative87.6%
unpow287.6%
unpow287.6%
hypot-undefine92.4%
Simplified92.4%
Taylor expanded in ky around 0 92.4%
if 1e-8 < (sin.f64 ky) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 49.3%
Final simplification49.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.005)
(* ky (fabs t_1))
(if (<= (sin kx) 2e-132) (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.005) {
tmp = ky * fabs(t_1);
} else if (sin(kx) <= 2e-132) {
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.005d0)) then
tmp = ky * abs(t_1)
else if (sin(kx) <= 2d-132) 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.005) {
tmp = ky * Math.abs(t_1);
} else if (Math.sin(kx) <= 2e-132) {
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.005: tmp = ky * math.fabs(t_1) elif math.sin(kx) <= 2e-132: 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.005) tmp = Float64(ky * abs(t_1)); elseif (sin(kx) <= 2e-132) 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.005) tmp = ky * abs(t_1); elseif (sin(kx) <= 2e-132) 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.005], N[(ky * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-132], 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.005:\\
\;\;\;\;ky \cdot \left|t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-132}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 14.6%
associate-/l*14.6%
Simplified14.6%
add-sqr-sqrt9.8%
sqrt-unprod32.3%
pow232.3%
Applied egg-rr32.3%
unpow232.3%
rem-sqrt-square33.3%
Simplified33.3%
if -0.0050000000000000001 < (sin.f64 kx) < 2e-132Initial program 87.6%
unpow287.6%
sqr-neg87.6%
sin-neg87.6%
sin-neg87.6%
unpow287.6%
associate-*l/81.2%
associate-/l*87.5%
unpow287.5%
Simplified99.8%
Taylor expanded in kx around 0 37.8%
if 2e-132 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/97.7%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 58.0%
Final simplification45.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.005) (* ky (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-132) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = ky * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 2e-132) {
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.005d0)) then
tmp = ky * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 2d-132) 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.005) {
tmp = ky * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 2e-132) {
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.005: tmp = ky * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 2e-132: 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.005) tmp = Float64(ky * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-132) 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.005) tmp = ky * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 2e-132) 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.005], N[(ky * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-132], 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.005:\\
\;\;\;\;ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-132}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 14.6%
associate-/l*14.6%
Simplified14.6%
add-sqr-sqrt9.8%
sqrt-unprod32.3%
pow232.3%
Applied egg-rr32.3%
unpow232.3%
rem-sqrt-square33.3%
Simplified33.3%
if -0.0050000000000000001 < (sin.f64 kx) < 2e-132Initial program 87.6%
unpow287.6%
sqr-neg87.6%
sin-neg87.6%
sin-neg87.6%
unpow287.6%
associate-*l/81.2%
associate-/l*87.5%
unpow287.5%
Simplified99.8%
Taylor expanded in kx around 0 37.8%
if 2e-132 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 58.1%
Final simplification45.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ (sin ky) (sin kx)))))
(if (<= (sin kx) -0.005)
(fabs t_1)
(if (<= (sin kx) 2e-132) (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.005) {
tmp = fabs(t_1);
} else if (sin(kx) <= 2e-132) {
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.005d0)) then
tmp = abs(t_1)
else if (sin(kx) <= 2d-132) 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.005) {
tmp = Math.abs(t_1);
} else if (Math.sin(kx) <= 2e-132) {
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.005: tmp = math.fabs(t_1) elif math.sin(kx) <= 2e-132: 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.005) tmp = abs(t_1); elseif (sin(kx) <= 2e-132) 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.005) tmp = abs(t_1); elseif (sin(kx) <= 2e-132) 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.005], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-132], 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.005:\\
\;\;\;\;\left|t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-132}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 14.3%
add-sqr-sqrt12.9%
sqrt-unprod24.3%
pow224.3%
Applied egg-rr24.3%
unpow224.3%
rem-sqrt-square29.3%
*-commutative29.3%
associate-*l/29.3%
remove-double-neg29.3%
distribute-rgt-neg-in29.3%
distribute-frac-neg29.3%
distribute-frac-neg229.3%
associate-*r/29.3%
distribute-frac-neg229.3%
distribute-frac-neg29.3%
remove-double-neg29.3%
Simplified29.3%
if -0.0050000000000000001 < (sin.f64 kx) < 2e-132Initial program 87.6%
unpow287.6%
sqr-neg87.6%
sin-neg87.6%
sin-neg87.6%
unpow287.6%
associate-*l/81.2%
associate-/l*87.5%
unpow287.5%
Simplified99.8%
Taylor expanded in kx around 0 37.8%
if 2e-132 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 58.1%
Final simplification44.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.005) (fabs (/ (sin th) (/ (sin kx) (sin ky)))) (if (<= (sin kx) 2e-132) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = fabs((sin(th) / (sin(kx) / sin(ky))));
} else if (sin(kx) <= 2e-132) {
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.005d0)) then
tmp = abs((sin(th) / (sin(kx) / sin(ky))))
else if (sin(kx) <= 2d-132) 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.005) {
tmp = Math.abs((Math.sin(th) / (Math.sin(kx) / Math.sin(ky))));
} else if (Math.sin(kx) <= 2e-132) {
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.005: tmp = math.fabs((math.sin(th) / (math.sin(kx) / math.sin(ky)))) elif math.sin(kx) <= 2e-132: 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.005) tmp = abs(Float64(sin(th) / Float64(sin(kx) / sin(ky)))); elseif (sin(kx) <= 2e-132) 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.005) tmp = abs((sin(th) / (sin(kx) / sin(ky)))); elseif (sin(kx) <= 2e-132) 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.005], N[Abs[N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-132], 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.005:\\
\;\;\;\;\left|\frac{\sin th}{\frac{\sin kx}{\sin ky}}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-132}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 14.3%
add-sqr-sqrt12.9%
sqrt-unprod24.3%
pow224.3%
Applied egg-rr24.3%
unpow224.3%
rem-sqrt-square29.3%
*-commutative29.3%
associate-*l/29.3%
remove-double-neg29.3%
distribute-rgt-neg-in29.3%
distribute-frac-neg29.3%
distribute-frac-neg229.3%
associate-*r/29.3%
distribute-frac-neg229.3%
distribute-frac-neg29.3%
remove-double-neg29.3%
Simplified29.3%
clear-num29.3%
un-div-inv29.3%
Applied egg-rr29.3%
if -0.0050000000000000001 < (sin.f64 kx) < 2e-132Initial program 87.6%
unpow287.6%
sqr-neg87.6%
sin-neg87.6%
sin-neg87.6%
unpow287.6%
associate-*l/81.2%
associate-/l*87.5%
unpow287.5%
Simplified99.8%
Taylor expanded in kx around 0 37.8%
if 2e-132 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 58.1%
Final simplification44.1%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.005) (* (sin ky) (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-132) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 2e-132) {
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.005d0)) then
tmp = sin(ky) * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 2d-132) 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.005) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 2e-132) {
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.005: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 2e-132: 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.005) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-132) 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.005) tmp = sin(ky) * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 2e-132) 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.005], 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-132], 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.005:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-132}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 14.3%
add-sqr-sqrt9.8%
sqrt-unprod32.3%
pow232.3%
Applied egg-rr34.9%
unpow232.3%
rem-sqrt-square33.3%
Simplified36.9%
if -0.0050000000000000001 < (sin.f64 kx) < 2e-132Initial program 87.6%
unpow287.6%
sqr-neg87.6%
sin-neg87.6%
sin-neg87.6%
unpow287.6%
associate-*l/81.2%
associate-/l*87.5%
unpow287.5%
Simplified99.8%
Taylor expanded in kx around 0 37.8%
if 2e-132 < (sin.f64 kx) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 58.1%
Final simplification46.0%
(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 95.5%
unpow295.5%
sqr-neg95.5%
sin-neg95.5%
sin-neg95.5%
unpow295.5%
associate-*l/92.5%
associate-/l*95.4%
unpow295.4%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.005) (* ky (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-132) (sin th) (* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = ky * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 2e-132) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.005d0)) then
tmp = ky * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 2d-132) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.005) {
tmp = ky * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 2e-132) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = ky * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 2e-132: tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(ky * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-132) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.005) tmp = ky * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 2e-132) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.005], N[(ky * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-132], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-132}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0050000000000000001Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.4%
associate-/l*99.4%
unpow299.4%
Simplified99.3%
Taylor expanded in ky around 0 14.6%
associate-/l*14.6%
Simplified14.6%
add-sqr-sqrt9.8%
sqrt-unprod32.3%
pow232.3%
Applied egg-rr32.3%
unpow232.3%
rem-sqrt-square33.3%
Simplified33.3%
if -0.0050000000000000001 < (sin.f64 kx) < 2e-132Initial program 87.6%
unpow287.6%
sqr-neg87.6%
sin-neg87.6%
sin-neg87.6%
unpow287.6%
associate-*l/81.2%
associate-/l*87.5%
unpow287.5%
Simplified99.8%
Taylor expanded in kx around 0 37.8%
if 2e-132 < (sin.f64 kx) Initial program 99.6%
Taylor expanded in ky around 0 50.6%
Final simplification42.0%
(FPCore (kx ky th) :precision binary64 (let* ((t_1 (hypot (sin kx) (sin ky)))) (if (<= th 3.9e-6) (/ (* (sin ky) th) t_1) (/ (* ky (sin th)) t_1))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(kx), sin(ky));
double tmp;
if (th <= 3.9e-6) {
tmp = (sin(ky) * th) / t_1;
} else {
tmp = (ky * sin(th)) / t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(kx), Math.sin(ky));
double tmp;
if (th <= 3.9e-6) {
tmp = (Math.sin(ky) * th) / t_1;
} else {
tmp = (ky * Math.sin(th)) / t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(kx), math.sin(ky)) tmp = 0 if th <= 3.9e-6: tmp = (math.sin(ky) * th) / t_1 else: tmp = (ky * math.sin(th)) / t_1 return tmp
function code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)) tmp = 0.0 if (th <= 3.9e-6) tmp = Float64(Float64(sin(ky) * th) / t_1); else tmp = Float64(Float64(ky * sin(th)) / t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(kx), sin(ky)); tmp = 0.0; if (th <= 3.9e-6) tmp = (sin(ky) * th) / t_1; else tmp = (ky * sin(th)) / t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[th, 3.9e-6], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;th \leq 3.9 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sin ky \cdot th}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot \sin th}{t\_1}\\
\end{array}
\end{array}
if th < 3.8999999999999999e-6Initial program 94.9%
unpow294.9%
sqr-neg94.9%
sin-neg94.9%
sin-neg94.9%
unpow294.9%
associate-*l/90.8%
associate-/l*94.8%
unpow294.8%
Simplified99.6%
clear-num99.4%
un-div-inv99.5%
Applied egg-rr99.5%
associate-/r/99.6%
associate-*l/94.1%
*-commutative94.1%
hypot-undefine90.8%
unpow290.8%
unpow290.8%
+-commutative90.8%
unpow290.8%
unpow290.8%
hypot-undefine94.1%
Simplified94.1%
Taylor expanded in th around 0 64.7%
*-commutative64.7%
Simplified64.7%
if 3.8999999999999999e-6 < th Initial program 97.0%
unpow297.0%
sqr-neg97.0%
sin-neg97.0%
sin-neg97.0%
unpow297.0%
associate-*l/96.8%
associate-/l*96.9%
unpow296.9%
Simplified99.5%
clear-num99.3%
un-div-inv99.3%
Applied egg-rr99.3%
associate-/r/99.7%
associate-*l/99.5%
*-commutative99.5%
hypot-undefine96.8%
unpow296.8%
unpow296.8%
+-commutative96.8%
unpow296.8%
unpow296.8%
hypot-undefine99.5%
Simplified99.5%
Taylor expanded in ky around 0 53.5%
Final simplification61.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-70) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-70) {
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) <= 2d-70) 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) <= 2e-70) {
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) <= 2e-70: 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) <= 2e-70) 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) <= 2e-70) 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], 2e-70], 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 2 \cdot 10^{-70}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.99999999999999999e-70Initial program 93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
associate-*l/90.1%
associate-/l*93.7%
unpow293.7%
Simplified99.6%
Taylor expanded in ky around 0 33.0%
associate-/l*34.5%
Simplified34.5%
if 1.99999999999999999e-70 < (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.4%
unpow299.4%
Simplified99.4%
Taylor expanded in kx around 0 51.5%
Final simplification39.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.06e-125) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.06e-125) {
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.06d-125) 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.06e-125) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.06e-125: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.06e-125) 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.06e-125) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.06e-125], 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.06 \cdot 10^{-125}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.05999999999999999e-125Initial program 92.6%
unpow292.6%
sqr-neg92.6%
sin-neg92.6%
sin-neg92.6%
unpow292.6%
associate-*l/88.9%
associate-/l*92.6%
unpow292.6%
Simplified99.6%
Taylor expanded in ky around 0 32.3%
associate-/l*34.1%
Simplified34.1%
Taylor expanded in th around 0 20.0%
associate-/l*21.7%
Simplified21.7%
if 1.05999999999999999e-125 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.9%
associate-/l*99.5%
unpow299.5%
Simplified99.6%
Taylor expanded in kx around 0 30.6%
Final simplification25.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.3e-136) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.3e-136) {
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.3d-136) 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.3e-136) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.3e-136: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.3e-136) 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.3e-136) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.3e-136], 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.3 \cdot 10^{-136}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.30000000000000018e-136Initial program 92.6%
unpow292.6%
sqr-neg92.6%
sin-neg92.6%
sin-neg92.6%
unpow292.6%
associate-*l/88.8%
associate-/l*92.5%
unpow292.5%
Simplified99.6%
Taylor expanded in ky around 0 31.9%
associate-/l*33.7%
Simplified33.7%
Taylor expanded in kx around 0 21.1%
associate-/l*22.9%
Simplified22.9%
if 3.30000000000000018e-136 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/97.9%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 30.4%
Final simplification26.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 5e-199) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5e-199) {
tmp = ky * (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 <= 5d-199) then
tmp = ky * (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 <= 5e-199) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 5e-199: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 5e-199) tmp = Float64(ky * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 5e-199) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 5e-199], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5 \cdot 10^{-199}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 4.9999999999999996e-199Initial program 93.6%
unpow293.6%
sqr-neg93.6%
sin-neg93.6%
sin-neg93.6%
unpow293.6%
associate-*l/90.2%
associate-/l*93.5%
unpow293.5%
Simplified99.6%
Taylor expanded in ky around 0 30.8%
associate-/l*32.8%
Simplified32.8%
Taylor expanded in th around 0 20.2%
associate-/l*22.1%
Simplified22.1%
Taylor expanded in kx around 0 17.5%
associate-/l*19.6%
Simplified19.6%
if 4.9999999999999996e-199 < ky Initial program 97.7%
unpow297.7%
sqr-neg97.7%
sin-neg97.7%
sin-neg97.7%
unpow297.7%
associate-*l/95.3%
associate-/l*97.6%
unpow297.6%
Simplified99.6%
Taylor expanded in kx around 0 30.3%
Final simplification24.5%
(FPCore (kx ky th) :precision binary64 (* ky (/ th kx)))
double code(double kx, double ky, double th) {
return ky * (th / kx);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = ky * (th / kx)
end function
public static double code(double kx, double ky, double th) {
return ky * (th / kx);
}
def code(kx, ky, th): return ky * (th / kx)
function code(kx, ky, th) return Float64(ky * Float64(th / kx)) end
function tmp = code(kx, ky, th) tmp = ky * (th / kx); end
code[kx_, ky_, th_] := N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
ky \cdot \frac{th}{kx}
\end{array}
Initial program 95.5%
unpow295.5%
sqr-neg95.5%
sin-neg95.5%
sin-neg95.5%
unpow295.5%
associate-*l/92.5%
associate-/l*95.4%
unpow295.4%
Simplified99.6%
Taylor expanded in ky around 0 26.1%
associate-/l*27.1%
Simplified27.1%
Taylor expanded in th around 0 15.4%
associate-/l*16.4%
Simplified16.4%
Taylor expanded in kx around 0 12.6%
associate-/l*13.7%
Simplified13.7%
Final simplification13.7%
herbie shell --seed 2024075
(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)))