
(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 93.7%
+-commutative93.7%
unpow293.7%
unpow293.7%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.005)
(sin th)
(if (<= (sin th) 0.0002)
(/ th (/ (hypot (sin ky) (sin kx)) (sin ky)))
(if (or (<= (sin th) 0.47)
(and (not (<= (sin th) 0.807)) (<= (sin th) 0.9)))
(* (sin ky) (fabs (/ (sin th) (sin kx))))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.005) {
tmp = sin(th);
} else if (sin(th) <= 0.0002) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else if ((sin(th) <= 0.47) || (!(sin(th) <= 0.807) && (sin(th) <= 0.9))) {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.005) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= 0.0002) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else if ((Math.sin(th) <= 0.47) || (!(Math.sin(th) <= 0.807) && (Math.sin(th) <= 0.9))) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.005: tmp = math.sin(th) elif math.sin(th) <= 0.0002: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) elif (math.sin(th) <= 0.47) or (not (math.sin(th) <= 0.807) and (math.sin(th) <= 0.9)): tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.005) tmp = sin(th); elseif (sin(th) <= 0.0002) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); elseif ((sin(th) <= 0.47) || (!(sin(th) <= 0.807) && (sin(th) <= 0.9))) tmp = Float64(sin(ky) * abs(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(th) <= -0.005) tmp = sin(th); elseif (sin(th) <= 0.0002) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); elseif ((sin(th) <= 0.47) || (~((sin(th) <= 0.807)) && (sin(th) <= 0.9))) tmp = sin(ky) * abs((sin(th) / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.005], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.0002], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[th], $MachinePrecision], 0.47], And[N[Not[LessEqual[N[Sin[th], $MachinePrecision], 0.807]], $MachinePrecision], LessEqual[N[Sin[th], $MachinePrecision], 0.9]]], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.005:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq 0.0002:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{elif}\;\sin th \leq 0.47 \lor \neg \left(\sin th \leq 0.807\right) \land \sin th \leq 0.9:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0050000000000000001 or 0.46999999999999997 < (sin.f64 th) < 0.807000000000000051 or 0.900000000000000022 < (sin.f64 th) Initial program 91.2%
unpow291.2%
sqr-neg91.2%
sin-neg91.2%
sin-neg91.2%
unpow291.2%
associate-*l/91.0%
associate-/l*90.9%
unpow290.9%
Simplified99.4%
Taylor expanded in kx around 0 21.3%
if -0.0050000000000000001 < (sin.f64 th) < 2.0000000000000001e-4Initial program 95.1%
unpow295.1%
sqr-neg95.1%
sin-neg95.1%
sin-neg95.1%
unpow295.1%
associate-*l/91.8%
associate-/l*95.1%
unpow295.1%
Simplified99.7%
Taylor expanded in th around 0 90.9%
associate-*l*93.6%
sqrt-div94.5%
metadata-eval94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-undefine99.0%
div-inv99.2%
clear-num99.2%
un-div-inv99.3%
Applied egg-rr99.3%
if 2.0000000000000001e-4 < (sin.f64 th) < 0.46999999999999997 or 0.807000000000000051 < (sin.f64 th) < 0.900000000000000022Initial program 96.4%
unpow296.4%
sqr-neg96.4%
sin-neg96.4%
sin-neg96.4%
unpow296.4%
associate-*l/96.2%
associate-/l*96.3%
unpow296.3%
Simplified99.5%
Taylor expanded in ky around 0 13.7%
add-sqr-sqrt12.2%
sqrt-unprod40.3%
pow240.3%
Applied egg-rr40.3%
unpow240.3%
rem-sqrt-square43.8%
Simplified43.8%
Final simplification62.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.005)
(sin th)
(if (<= (sin th) 0.0002)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (or (<= (sin th) 0.47)
(and (not (<= (sin th) 0.807)) (<= (sin th) 0.9)))
(* (sin ky) (fabs (/ (sin th) (sin kx))))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.005) {
tmp = sin(th);
} else if (sin(th) <= 0.0002) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if ((sin(th) <= 0.47) || (!(sin(th) <= 0.807) && (sin(th) <= 0.9))) {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.005) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= 0.0002) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if ((Math.sin(th) <= 0.47) || (!(Math.sin(th) <= 0.807) && (Math.sin(th) <= 0.9))) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.005: tmp = math.sin(th) elif math.sin(th) <= 0.0002: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif (math.sin(th) <= 0.47) or (not (math.sin(th) <= 0.807) and (math.sin(th) <= 0.9)): tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.005) tmp = sin(th); elseif (sin(th) <= 0.0002) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif ((sin(th) <= 0.47) || (!(sin(th) <= 0.807) && (sin(th) <= 0.9))) tmp = Float64(sin(ky) * abs(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(th) <= -0.005) tmp = sin(th); elseif (sin(th) <= 0.0002) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif ((sin(th) <= 0.47) || (~((sin(th) <= 0.807)) && (sin(th) <= 0.9))) tmp = sin(ky) * abs((sin(th) / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.005], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.0002], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[th], $MachinePrecision], 0.47], And[N[Not[LessEqual[N[Sin[th], $MachinePrecision], 0.807]], $MachinePrecision], LessEqual[N[Sin[th], $MachinePrecision], 0.9]]], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.005:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq 0.0002:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin th \leq 0.47 \lor \neg \left(\sin th \leq 0.807\right) \land \sin th \leq 0.9:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0050000000000000001 or 0.46999999999999997 < (sin.f64 th) < 0.807000000000000051 or 0.900000000000000022 < (sin.f64 th) Initial program 91.2%
unpow291.2%
sqr-neg91.2%
sin-neg91.2%
sin-neg91.2%
unpow291.2%
associate-*l/91.0%
associate-/l*90.9%
unpow290.9%
Simplified99.4%
Taylor expanded in kx around 0 21.3%
if -0.0050000000000000001 < (sin.f64 th) < 2.0000000000000001e-4Initial program 95.1%
unpow295.1%
sqr-neg95.1%
sin-neg95.1%
sin-neg95.1%
unpow295.1%
associate-*l/91.8%
associate-/l*95.1%
unpow295.1%
Simplified99.7%
Taylor expanded in th around 0 90.9%
associate-*l*93.6%
sqrt-div94.5%
metadata-eval94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-undefine99.0%
div-inv99.2%
clear-num99.2%
un-div-inv99.3%
Applied egg-rr99.3%
associate-/r/99.2%
Simplified99.2%
if 2.0000000000000001e-4 < (sin.f64 th) < 0.46999999999999997 or 0.807000000000000051 < (sin.f64 th) < 0.900000000000000022Initial program 96.4%
unpow296.4%
sqr-neg96.4%
sin-neg96.4%
sin-neg96.4%
unpow296.4%
associate-*l/96.2%
associate-/l*96.3%
unpow296.3%
Simplified99.5%
Taylor expanded in ky around 0 13.7%
add-sqr-sqrt12.2%
sqrt-unprod40.3%
pow240.3%
Applied egg-rr40.3%
unpow240.3%
rem-sqrt-square43.8%
Simplified43.8%
Final simplification62.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.08) (* (sin ky) (fabs (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-71) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.08) {
tmp = sin(ky) * fabs((sin(th) / sin(kx)));
} else if (sin(kx) <= 2e-71) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.08d0)) then
tmp = sin(ky) * abs((sin(th) / sin(kx)))
else if (sin(kx) <= 2d-71) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.08) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(kx)));
} else if (Math.sin(kx) <= 2e-71) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.08: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(kx))) elif math.sin(kx) <= 2e-71: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.08) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-71) tmp = sin(th); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.08) tmp = sin(ky) * abs((sin(th) / sin(kx))); elseif (sin(kx) <= 2e-71) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.08], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-71], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.08:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-71}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0800000000000000017Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 15.7%
add-sqr-sqrt7.8%
sqrt-unprod32.7%
pow232.7%
Applied egg-rr32.7%
unpow232.7%
rem-sqrt-square35.1%
Simplified35.1%
if -0.0800000000000000017 < (sin.f64 kx) < 1.9999999999999998e-71Initial program 86.7%
unpow286.7%
sqr-neg86.7%
sin-neg86.7%
sin-neg86.7%
unpow286.7%
associate-*l/83.2%
associate-/l*86.5%
unpow286.5%
Simplified99.6%
Taylor expanded in kx around 0 39.5%
if 1.9999999999999998e-71 < (sin.f64 kx) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 52.3%
Final simplification42.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* (sin ky) (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-71) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
} else if (sin(kx) <= 2e-71) {
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.05d0)) then
tmp = abs((sin(ky) * (sin(th) / sin(kx))))
else if (sin(kx) <= 2d-71) 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.05) {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-71) {
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.05: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 2e-71: 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.05) tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-71) 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.05) tmp = abs((sin(ky) * (sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-71) 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.05], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-71], 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.05:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-71}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 15.5%
add-sqr-sqrt12.7%
sqrt-unprod26.5%
pow226.5%
Applied egg-rr26.5%
unpow226.5%
rem-sqrt-square34.8%
*-commutative34.8%
Simplified34.8%
if -0.050000000000000003 < (sin.f64 kx) < 1.9999999999999998e-71Initial program 86.6%
unpow286.6%
sqr-neg86.6%
sin-neg86.6%
sin-neg86.6%
unpow286.6%
associate-*l/83.0%
associate-/l*86.4%
unpow286.4%
Simplified99.6%
Taylor expanded in kx around 0 39.8%
if 1.9999999999999998e-71 < (sin.f64 kx) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 52.3%
Final simplification42.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 2e-71) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 2e-71) {
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.05d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 2d-71) 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.05) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 2e-71) {
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.05: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 2e-71: 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.05) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-71) 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.05) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 2e-71) 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.05], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-71], 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.05:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-71}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 15.7%
add-sqr-sqrt12.3%
sqrt-unprod22.9%
pow222.9%
*-commutative22.9%
Applied egg-rr22.9%
unpow222.9%
rem-sqrt-square30.4%
associate-*l/30.4%
*-commutative30.4%
Simplified30.4%
if -0.050000000000000003 < (sin.f64 kx) < 1.9999999999999998e-71Initial program 86.6%
unpow286.6%
sqr-neg86.6%
sin-neg86.6%
sin-neg86.6%
unpow286.6%
associate-*l/83.0%
associate-/l*86.4%
unpow286.4%
Simplified99.6%
Taylor expanded in kx around 0 39.8%
if 1.9999999999999998e-71 < (sin.f64 kx) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 52.3%
Final simplification41.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.05)
(fabs (* ky t_1))
(if (<= (sin kx) 2e-71) (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.05) {
tmp = fabs((ky * t_1));
} else if (sin(kx) <= 2e-71) {
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.05d0)) then
tmp = abs((ky * t_1))
else if (sin(kx) <= 2d-71) 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.05) {
tmp = Math.abs((ky * t_1));
} else if (Math.sin(kx) <= 2e-71) {
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.05: tmp = math.fabs((ky * t_1)) elif math.sin(kx) <= 2e-71: 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.05) tmp = abs(Float64(ky * t_1)); elseif (sin(kx) <= 2e-71) 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.05) tmp = abs((ky * t_1)); elseif (sin(kx) <= 2e-71) 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.05], N[Abs[N[(ky * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-71], 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.05:\\
\;\;\;\;\left|ky \cdot t\_1\right|\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-71}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t\_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 15.7%
add-sqr-sqrt12.3%
sqrt-unprod22.9%
pow222.9%
*-commutative22.9%
Applied egg-rr22.9%
unpow222.9%
rem-sqrt-square30.4%
associate-*l/30.4%
*-commutative30.4%
Simplified30.4%
if -0.050000000000000003 < (sin.f64 kx) < 1.9999999999999998e-71Initial program 86.6%
unpow286.6%
sqr-neg86.6%
sin-neg86.6%
sin-neg86.6%
unpow286.6%
associate-*l/83.0%
associate-/l*86.4%
unpow286.4%
Simplified99.6%
Taylor expanded in kx around 0 39.8%
if 1.9999999999999998e-71 < (sin.f64 kx) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.5%
Taylor expanded in ky around 0 52.3%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 93.7%
unpow293.7%
sqr-neg93.7%
sin-neg93.7%
sin-neg93.7%
unpow293.7%
associate-*l/92.0%
associate-/l*93.6%
unpow293.6%
Simplified99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.05) (fabs (* ky (/ (sin th) (sin kx)))) (if (<= (sin kx) 1e-69) (sin th) (* (sin th) (/ ky (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.05) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= 1e-69) {
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.05d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= 1d-69) 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.05) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= 1e-69) {
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.05: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= 1e-69: 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.05) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-69) 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.05) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= 1e-69) 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.05], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-69], 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.05:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 10^{-69}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.050000000000000003Initial program 99.5%
unpow299.5%
sqr-neg99.5%
sin-neg99.5%
sin-neg99.5%
unpow299.5%
associate-*l/99.4%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in ky around 0 15.7%
add-sqr-sqrt12.3%
sqrt-unprod22.9%
pow222.9%
*-commutative22.9%
Applied egg-rr22.9%
unpow222.9%
rem-sqrt-square30.4%
associate-*l/30.4%
*-commutative30.4%
Simplified30.4%
if -0.050000000000000003 < (sin.f64 kx) < 9.9999999999999996e-70Initial program 86.7%
unpow286.7%
sqr-neg86.7%
sin-neg86.7%
sin-neg86.7%
unpow286.7%
associate-*l/83.2%
associate-/l*86.6%
unpow286.6%
Simplified99.6%
Taylor expanded in kx around 0 40.3%
if 9.9999999999999996e-70 < (sin.f64 kx) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-undefine99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 44.8%
Final simplification39.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.5e-90) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.5e-90) {
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 (ky <= 1.5d-90) 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 (ky <= 1.5e-90) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.5e-90: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.5e-90) 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 (ky <= 1.5e-90) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.5e-90], 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}\;ky \leq 1.5 \cdot 10^{-90}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.5000000000000001e-90Initial program 91.2%
unpow291.2%
sqr-neg91.2%
sin-neg91.2%
sin-neg91.2%
unpow291.2%
associate-*l/88.9%
associate-/l*91.0%
unpow291.0%
Simplified99.5%
Taylor expanded in ky around 0 26.6%
associate-/l*27.9%
Simplified27.9%
if 1.5000000000000001e-90 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 36.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) 2e-6) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 2e-6) {
tmp = sin(th);
} else {
tmp = ky * (th / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= 2d-6) then
tmp = sin(th)
else
tmp = ky * (th / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= 2e-6) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= 2e-6: tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 2e-6) tmp = sin(th); else tmp = Float64(ky * Float64(th / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= 2e-6) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-6], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 1.99999999999999991e-6Initial program 91.9%
unpow291.9%
sqr-neg91.9%
sin-neg91.9%
sin-neg91.9%
unpow291.9%
associate-*l/89.7%
associate-/l*91.7%
unpow291.7%
Simplified99.6%
Taylor expanded in kx around 0 30.2%
if 1.99999999999999991e-6 < (sin.f64 kx) Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.5%
associate-/l*99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in th around 0 58.3%
Taylor expanded in ky around 0 23.7%
associate-/l*23.7%
Simplified23.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.76e-90) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.76e-90) {
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 <= 1.76d-90) 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 <= 1.76e-90) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.76e-90: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.76e-90) 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 <= 1.76e-90) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.76e-90], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.76 \cdot 10^{-90}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.7600000000000001e-90Initial program 91.2%
unpow291.2%
sqr-neg91.2%
sin-neg91.2%
sin-neg91.2%
unpow291.2%
associate-*l/88.9%
associate-/l*91.0%
unpow291.0%
Simplified99.5%
Taylor expanded in ky around 0 26.6%
Taylor expanded in kx around 0 17.5%
associate-/l*18.7%
Simplified18.7%
if 1.7600000000000001e-90 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 36.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 1.4e-164) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 1.4e-164) {
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 <= 1.4d-164) 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 <= 1.4e-164) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 1.4e-164: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 1.4e-164) 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 <= 1.4e-164) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 1.4e-164], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 1.4 \cdot 10^{-164}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 1.4000000000000001e-164Initial program 90.7%
unpow290.7%
sqr-neg90.7%
sin-neg90.7%
sin-neg90.7%
unpow290.7%
associate-*l/89.0%
associate-/l*90.6%
unpow290.6%
Simplified99.6%
Taylor expanded in th around 0 45.5%
Taylor expanded in ky around 0 15.5%
associate-/l*16.6%
Simplified16.6%
Taylor expanded in kx around 0 13.3%
if 1.4000000000000001e-164 < ky Initial program 98.9%
unpow298.9%
sqr-neg98.9%
sin-neg98.9%
sin-neg98.9%
unpow298.9%
associate-*l/97.3%
associate-/l*98.8%
unpow298.8%
Simplified99.6%
Taylor expanded in kx around 0 34.2%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3e-55) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3e-55) {
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 <= 3d-55) 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 <= 3e-55) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3e-55: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3e-55) 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 <= 3e-55) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3e-55], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 3 \cdot 10^{-55}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 3.00000000000000016e-55Initial program 91.5%
unpow291.5%
sqr-neg91.5%
sin-neg91.5%
sin-neg91.5%
unpow291.5%
associate-*l/89.3%
associate-/l*91.4%
unpow291.4%
Simplified99.6%
Taylor expanded in th around 0 43.8%
Taylor expanded in ky around 0 15.9%
associate-/l*17.0%
Simplified17.0%
Taylor expanded in kx around 0 14.1%
if 3.00000000000000016e-55 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.4%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in th around 0 53.4%
Taylor expanded in kx around 0 20.8%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 93.7%
unpow293.7%
sqr-neg93.7%
sin-neg93.7%
sin-neg93.7%
unpow293.7%
associate-*l/92.0%
associate-/l*93.6%
unpow293.6%
Simplified99.6%
Taylor expanded in th around 0 46.4%
Taylor expanded in kx around 0 13.9%
herbie shell --seed 2024097
(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)))