
(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 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 92.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
associate-*l/90.0%
associate-/l*92.8%
unpow292.8%
Simplified99.6%
associate-*r/94.1%
hypot-undefine90.0%
unpow290.0%
unpow290.0%
+-commutative90.0%
associate-*l/92.8%
*-commutative92.8%
clear-num92.7%
un-div-inv92.9%
+-commutative92.9%
unpow292.9%
unpow292.9%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 1e-205)
(* (sin th) (fabs (/ ky (sin kx))))
(if (<= (sin ky) 5e-9)
(/ 1.0 (/ (hypot (sin ky) (sin kx)) (* (sin th) ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 1e-205) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else if (sin(ky) <= 5e-9) {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (sin(th) * 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.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-205) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else if (Math.sin(ky) <= 5e-9) {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (Math.sin(th) * 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.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 1e-205: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) elif math.sin(ky) <= 5e-9: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (math.sin(th) * ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 1e-205) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); elseif (sin(ky) <= 5e-9) tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(sin(th) * 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) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 1e-205) tmp = sin(th) * abs((ky / sin(kx))); elseif (sin(ky) <= 5e-9) tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (sin(th) * ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-205], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-9], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-205}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin th \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod14.9%
pow214.9%
Applied egg-rr14.9%
unpow214.9%
rem-sqrt-square22.3%
Simplified22.3%
if -0.0200000000000000004 < (sin.f64 ky) < 1e-205Initial program 83.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 50.8%
add-sqr-sqrt16.4%
sqrt-unprod28.5%
pow228.5%
Applied egg-rr28.5%
unpow228.5%
rem-sqrt-square35.4%
Simplified35.4%
if 1e-205 < (sin.f64 ky) < 5.0000000000000001e-9Initial program 93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
associate-*l/91.5%
associate-/l*93.7%
unpow293.7%
Simplified99.6%
associate-*r/93.7%
hypot-undefine91.5%
unpow291.5%
unpow291.5%
+-commutative91.5%
clear-num90.5%
+-commutative90.5%
unpow290.5%
unpow290.5%
hypot-undefine92.7%
Applied egg-rr92.7%
Taylor expanded in ky around 0 92.7%
if 5.0000000000000001e-9 < (sin.f64 ky) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 59.8%
Final simplification49.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.02)
(/ 1.0 (/ t_1 (* th (sin ky))))
(if (<= (sin ky) 1e-205)
(* (sin th) (fabs (/ ky (sin kx))))
(if (<= (sin ky) 5e-9) (/ 1.0 (/ t_1 (* (sin th) ky))) (sin th))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.02) {
tmp = 1.0 / (t_1 / (th * sin(ky)));
} else if (sin(ky) <= 1e-205) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else if (sin(ky) <= 5e-9) {
tmp = 1.0 / (t_1 / (sin(th) * ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = 1.0 / (t_1 / (th * Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-205) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else if (Math.sin(ky) <= 5e-9) {
tmp = 1.0 / (t_1 / (Math.sin(th) * ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.02: tmp = 1.0 / (t_1 / (th * math.sin(ky))) elif math.sin(ky) <= 1e-205: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) elif math.sin(ky) <= 5e-9: tmp = 1.0 / (t_1 / (math.sin(th) * ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(1.0 / Float64(t_1 / Float64(th * sin(ky)))); elseif (sin(ky) <= 1e-205) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); elseif (sin(ky) <= 5e-9) tmp = Float64(1.0 / Float64(t_1 / Float64(sin(th) * ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.02) tmp = 1.0 / (t_1 / (th * sin(ky))); elseif (sin(ky) <= 1e-205) tmp = sin(th) * abs((ky / sin(kx))); elseif (sin(ky) <= 5e-9) tmp = 1.0 / (t_1 / (sin(th) * ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(1.0 / N[(t$95$1 / N[(th * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-205], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-9], N[(1.0 / N[(t$95$1 / N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{1}{\frac{t\_1}{th \cdot \sin ky}}\\
\mathbf{elif}\;\sin ky \leq 10^{-205}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\frac{t\_1}{\sin th \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
associate-*r/99.6%
hypot-undefine99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
clear-num99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-undefine99.3%
Applied egg-rr99.3%
Taylor expanded in th around 0 53.9%
associate-*l/53.9%
+-commutative53.9%
unpow253.9%
unpow253.9%
hypot-undefine53.8%
*-lft-identity53.8%
Simplified53.8%
if -0.0200000000000000004 < (sin.f64 ky) < 1e-205Initial program 83.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 50.8%
add-sqr-sqrt16.4%
sqrt-unprod28.5%
pow228.5%
Applied egg-rr28.5%
unpow228.5%
rem-sqrt-square35.4%
Simplified35.4%
if 1e-205 < (sin.f64 ky) < 5.0000000000000001e-9Initial program 93.8%
unpow293.8%
sqr-neg93.8%
sin-neg93.8%
sin-neg93.8%
unpow293.8%
associate-*l/91.5%
associate-/l*93.7%
unpow293.7%
Simplified99.6%
associate-*r/93.7%
hypot-undefine91.5%
unpow291.5%
unpow291.5%
+-commutative91.5%
clear-num90.5%
+-commutative90.5%
unpow290.5%
unpow290.5%
hypot-undefine92.7%
Applied egg-rr92.7%
Taylor expanded in ky around 0 92.7%
if 5.0000000000000001e-9 < (sin.f64 ky) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 59.8%
Final simplification56.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 5e-9) (* (sin th) (fabs (/ ky (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-9) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-9) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-9) {
tmp = Math.sin(th) * Math.abs((ky / 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-9: tmp = math.sin(th) * math.fabs((ky / 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-9) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-9) tmp = sin(th) * abs((ky / 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-9], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $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^{-9}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod32.5%
pow232.5%
associate-*r/32.5%
*-commutative32.5%
associate-/l*32.5%
Applied egg-rr32.5%
unpow232.5%
rem-sqrt-square42.6%
*-inverses42.6%
*-rgt-identity42.6%
Simplified42.6%
if -0.0200000000000000004 < (sin.f64 ky) < 5.0000000000000001e-9Initial program 87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 46.4%
add-sqr-sqrt23.2%
sqrt-unprod38.5%
pow238.5%
Applied egg-rr38.5%
unpow238.5%
rem-sqrt-square47.1%
Simplified47.1%
if 5.0000000000000001e-9 < (sin.f64 ky) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 59.8%
Final simplification49.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (* (sin ky) (fabs (/ (sin th) (sin ky)))) (if (<= (sin ky) 5e-9) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 5e-9) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(ky) <= 5d-9) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 5e-9) {
tmp = Math.sin(th) * Math.abs((ky / 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.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 5e-9: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 5e-9) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 5e-9) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-9], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod14.9%
pow214.9%
Applied egg-rr14.9%
unpow214.9%
rem-sqrt-square22.3%
Simplified22.3%
if -0.0200000000000000004 < (sin.f64 ky) < 5.0000000000000001e-9Initial program 87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 46.4%
add-sqr-sqrt23.2%
sqrt-unprod38.5%
pow238.5%
Applied egg-rr38.5%
unpow238.5%
rem-sqrt-square47.1%
Simplified47.1%
if 5.0000000000000001e-9 < (sin.f64 ky) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in kx around 0 59.8%
Final simplification44.9%
(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 92.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
associate-*l/90.0%
associate-/l*92.8%
unpow292.8%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 92.8%
+-commutative92.8%
unpow292.8%
unpow292.8%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 5e-85) (* 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-85) {
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-85) 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-85) {
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-85: 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-85) 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-85) 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-85], 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^{-85}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod32.5%
pow232.5%
associate-*r/32.5%
*-commutative32.5%
associate-/l*32.5%
Applied egg-rr32.5%
unpow232.5%
rem-sqrt-square42.6%
*-inverses42.6%
*-rgt-identity42.6%
Simplified42.6%
if -0.0200000000000000004 < (sin.f64 ky) < 5.0000000000000002e-85Initial program 85.6%
unpow285.6%
sqr-neg85.6%
sin-neg85.6%
sin-neg85.6%
unpow285.6%
associate-*l/79.9%
associate-/l*85.5%
unpow285.5%
Simplified99.6%
Taylor expanded in ky around 0 45.5%
associate-/l*49.8%
Simplified49.8%
if 5.0000000000000002e-85 < (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.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 58.6%
Final simplification50.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (fabs (sin th)) (if (<= (sin ky) 5e-85) (* (sin th) (/ ky (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-85) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-85) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-85) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-85: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-85) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-85) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-85], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-85}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
add-sqr-sqrt1.4%
sqrt-unprod32.5%
pow232.5%
associate-*r/32.5%
*-commutative32.5%
associate-/l*32.5%
Applied egg-rr32.5%
unpow232.5%
rem-sqrt-square42.6%
*-inverses42.6%
*-rgt-identity42.6%
Simplified42.6%
if -0.0200000000000000004 < (sin.f64 ky) < 5.0000000000000002e-85Initial program 85.6%
unpow285.6%
sqr-neg85.6%
sin-neg85.6%
sin-neg85.6%
unpow285.6%
associate-*l/79.9%
associate-/l*85.5%
unpow285.5%
Simplified99.6%
Taylor expanded in ky around 0 45.5%
*-commutative45.5%
associate-/l*49.9%
Simplified49.9%
if 5.0000000000000002e-85 < (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.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 58.6%
Final simplification51.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.022) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 4e-74) (sin th) (* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.022) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 4e-74) {
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.022d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 4d-74) 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.022) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 4e-74) {
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.022: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 4e-74: 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.022) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 4e-74) 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.022) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 4e-74) 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.022], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 4e-74], 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.022:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 4 \cdot 10^{-74}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.021999999999999999Initial program 99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 13.3%
add-sqr-sqrt11.5%
sqrt-unprod26.8%
pow226.8%
associate-*l/26.7%
associate-/l*26.8%
Applied egg-rr26.8%
unpow226.8%
rem-sqrt-square38.3%
Simplified38.3%
if -0.021999999999999999 < (sin.f64 kx) < 3.99999999999999983e-74Initial program 84.4%
unpow284.4%
sqr-neg84.4%
sin-neg84.4%
sin-neg84.4%
unpow284.4%
associate-*l/79.2%
associate-/l*84.3%
unpow284.3%
Simplified99.8%
Taylor expanded in kx around 0 39.6%
if 3.99999999999999983e-74 < (sin.f64 kx) Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/97.9%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 54.0%
*-commutative54.0%
associate-/l*55.6%
Simplified55.6%
Final simplification44.1%
(FPCore (kx ky th) :precision binary64 (if (<= kx 6.4e-74) (sin th) (if (<= kx 0.0001) (* (sin th) (/ ky kx)) (fabs (/ ky (/ (sin kx) th))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.4e-74) {
tmp = sin(th);
} else if (kx <= 0.0001) {
tmp = sin(th) * (ky / kx);
} else {
tmp = fabs((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 <= 6.4d-74) then
tmp = sin(th)
else if (kx <= 0.0001d0) then
tmp = sin(th) * (ky / kx)
else
tmp = abs((ky / (sin(kx) / th)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 6.4e-74) {
tmp = Math.sin(th);
} else if (kx <= 0.0001) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.abs((ky / (Math.sin(kx) / th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 6.4e-74: tmp = math.sin(th) elif kx <= 0.0001: tmp = math.sin(th) * (ky / kx) else: tmp = math.fabs((ky / (math.sin(kx) / th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 6.4e-74) tmp = sin(th); elseif (kx <= 0.0001) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = abs(Float64(ky / Float64(sin(kx) / th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 6.4e-74) tmp = sin(th); elseif (kx <= 0.0001) tmp = sin(th) * (ky / kx); else tmp = abs((ky / (sin(kx) / th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 6.4e-74], N[Sin[th], $MachinePrecision], If[LessEqual[kx, 0.0001], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Abs[N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 6.4 \cdot 10^{-74}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;kx \leq 0.0001:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{ky}{\frac{\sin kx}{th}}\right|\\
\end{array}
\end{array}
if kx < 6.3999999999999997e-74Initial program 89.1%
unpow289.1%
sqr-neg89.1%
sin-neg89.1%
sin-neg89.1%
unpow289.1%
associate-*l/85.5%
associate-/l*89.0%
unpow289.0%
Simplified99.6%
Taylor expanded in kx around 0 30.1%
if 6.3999999999999997e-74 < kx < 1.00000000000000005e-4Initial program 99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-undefine99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 50.9%
Taylor expanded in kx around 0 50.9%
if 1.00000000000000005e-4 < kx Initial 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%
associate-*r/99.5%
hypot-undefine99.4%
unpow299.4%
unpow299.4%
+-commutative99.4%
clear-num98.9%
+-commutative98.9%
unpow298.9%
unpow298.9%
hypot-undefine98.8%
Applied egg-rr98.8%
Taylor expanded in ky around 0 36.9%
associate-/r*36.9%
Simplified36.9%
Taylor expanded in th around 0 25.6%
associate-/l*25.6%
Simplified25.6%
add-sqr-sqrt23.1%
sqrt-unprod23.0%
pow223.0%
Applied egg-rr23.0%
unpow223.0%
rem-sqrt-square27.7%
associate-*r/27.7%
associate-*l/27.7%
associate-/r/27.7%
Simplified27.7%
Final simplification30.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky 4.8e-178) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 4.8e-178) {
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 <= 4.8d-178) 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 <= 4.8e-178) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 4.8e-178: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 4.8e-178) 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 <= 4.8e-178) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 4.8e-178], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 4.8 \cdot 10^{-178}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 4.8000000000000001e-178Initial program 89.9%
unpow289.9%
sqr-neg89.9%
sin-neg89.9%
sin-neg89.9%
unpow289.9%
associate-*l/85.3%
associate-/l*89.9%
unpow289.9%
Simplified99.7%
associate-*r/91.5%
hypot-undefine85.3%
unpow285.3%
unpow285.3%
+-commutative85.3%
clear-num85.2%
+-commutative85.2%
unpow285.2%
unpow285.2%
hypot-undefine91.3%
Applied egg-rr91.3%
Taylor expanded in ky around 0 32.5%
associate-/r*35.7%
Simplified35.7%
Taylor expanded in th around 0 19.9%
associate-/l*23.5%
Simplified23.5%
if 4.8000000000000001e-178 < ky Initial program 96.9%
unpow296.9%
sqr-neg96.9%
sin-neg96.9%
sin-neg96.9%
unpow296.9%
associate-*l/96.7%
associate-/l*96.8%
unpow296.8%
Simplified99.5%
Taylor expanded in kx around 0 36.7%
Final simplification29.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.4e-176) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.4e-176) {
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.4d-176) 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.4e-176) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.4e-176: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.4e-176) 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.4e-176) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.4e-176], 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.4 \cdot 10^{-176}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.3999999999999997e-176Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/85.4%
associate-/l*90.0%
unpow290.0%
Simplified99.7%
associate-*r/91.6%
hypot-undefine85.4%
unpow285.4%
unpow285.4%
+-commutative85.4%
clear-num85.3%
+-commutative85.3%
unpow285.3%
unpow285.3%
hypot-undefine91.4%
Applied egg-rr91.4%
Taylor expanded in ky around 0 32.9%
associate-/r*36.2%
Simplified36.2%
Taylor expanded in kx around 0 22.0%
associate-/l*25.7%
Simplified25.7%
if 3.3999999999999997e-176 < ky Initial program 96.9%
unpow296.9%
sqr-neg96.9%
sin-neg96.9%
sin-neg96.9%
unpow296.9%
associate-*l/96.7%
associate-/l*96.8%
unpow296.8%
Simplified99.5%
Taylor expanded in kx around 0 37.0%
Final simplification30.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.4e-176) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.4e-176) {
tmp = sin(th) * (ky / 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.4d-176) then
tmp = sin(th) * (ky / 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.4e-176) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.4e-176: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.4e-176) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 3.4e-176) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.4e-176], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3.4 \cdot 10^{-176}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.3999999999999997e-176Initial program 90.0%
+-commutative90.0%
unpow290.0%
unpow290.0%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 36.5%
Taylor expanded in kx around 0 25.7%
if 3.3999999999999997e-176 < ky Initial program 96.9%
unpow296.9%
sqr-neg96.9%
sin-neg96.9%
sin-neg96.9%
unpow296.9%
associate-*l/96.7%
associate-/l*96.8%
unpow296.8%
Simplified99.5%
Taylor expanded in kx around 0 37.0%
Final simplification30.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 9e-178) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9e-178) {
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 <= 9d-178) 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 <= 9e-178) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 9e-178: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 9e-178) 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 <= 9e-178) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 9e-178], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 9 \cdot 10^{-178}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 8.99999999999999957e-178Initial program 89.9%
unpow289.9%
sqr-neg89.9%
sin-neg89.9%
sin-neg89.9%
unpow289.9%
associate-*l/85.3%
associate-/l*89.9%
unpow289.9%
Simplified99.7%
associate-*r/91.5%
hypot-undefine85.3%
unpow285.3%
unpow285.3%
+-commutative85.3%
clear-num85.2%
+-commutative85.2%
unpow285.2%
unpow285.2%
hypot-undefine91.3%
Applied egg-rr91.3%
Taylor expanded in ky around 0 32.5%
associate-/r*35.7%
Simplified35.7%
Taylor expanded in th around 0 19.9%
associate-/l*23.5%
Simplified23.5%
Taylor expanded in kx around 0 15.9%
associate-/l*19.5%
Simplified19.5%
if 8.99999999999999957e-178 < ky Initial program 96.9%
unpow296.9%
sqr-neg96.9%
sin-neg96.9%
sin-neg96.9%
unpow296.9%
associate-*l/96.7%
associate-/l*96.8%
unpow296.8%
Simplified99.5%
Taylor expanded in kx around 0 36.7%
Final simplification26.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.4e-176) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.4e-176) {
tmp = ky * (th / 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 <= 1.4d-176) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.4e-176) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.4e-176: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.4e-176) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 1.4e-176) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.4e-176], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.4 \cdot 10^{-176}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 1.4000000000000001e-176Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/85.4%
associate-/l*90.0%
unpow290.0%
Simplified99.7%
associate-*r/91.6%
hypot-undefine85.4%
unpow285.4%
unpow285.4%
+-commutative85.4%
clear-num85.3%
+-commutative85.3%
unpow285.3%
unpow285.3%
hypot-undefine91.4%
Applied egg-rr91.4%
Taylor expanded in ky around 0 32.9%
associate-/r*36.2%
Simplified36.2%
Taylor expanded in th around 0 19.8%
associate-/l*23.4%
Simplified23.4%
Taylor expanded in kx around 0 15.8%
associate-/l*19.4%
Simplified19.4%
if 1.4000000000000001e-176 < ky Initial program 96.9%
unpow296.9%
sqr-neg96.9%
sin-neg96.9%
sin-neg96.9%
unpow296.9%
associate-*l/96.7%
associate-/l*96.8%
unpow296.8%
Simplified99.5%
Taylor expanded in kx around 0 36.9%
Taylor expanded in th around 0 22.9%
Final simplification20.8%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 92.8%
unpow292.8%
sqr-neg92.8%
sin-neg92.8%
sin-neg92.8%
unpow292.8%
associate-*l/90.0%
associate-/l*92.8%
unpow292.8%
Simplified99.6%
Taylor expanded in kx around 0 24.2%
Taylor expanded in th around 0 15.7%
Final simplification15.7%
herbie shell --seed 2024074
(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)))