
(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 16 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) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.0%
unpow294.0%
sqr-neg94.0%
sin-neg94.0%
sin-neg94.0%
unpow294.0%
associate-*l/91.9%
associate-/l*94.0%
+-commutative94.0%
unpow294.0%
sin-neg94.0%
sin-neg94.0%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.54)
(sin th)
(if (<= (sin th) -0.005)
(/ (sin th) (/ (sin kx) (sin ky)))
(if (<= (sin th) 0.01)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin th) 0.78)
(/ (sin ky) (fabs (/ (sin kx) (sin th))))
(* (sin ky) (fabs (/ (sin th) (sin ky)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.54) {
tmp = sin(th);
} else if (sin(th) <= -0.005) {
tmp = sin(th) / (sin(kx) / sin(ky));
} else if (sin(th) <= 0.01) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(th) <= 0.78) {
tmp = sin(ky) / fabs((sin(kx) / sin(th)));
} else {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.54) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= -0.005) {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
} else if (Math.sin(th) <= 0.01) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(th) <= 0.78) {
tmp = Math.sin(ky) / Math.abs((Math.sin(kx) / Math.sin(th)));
} else {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.54: tmp = math.sin(th) elif math.sin(th) <= -0.005: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) elif math.sin(th) <= 0.01: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(th) <= 0.78: tmp = math.sin(ky) / math.fabs((math.sin(kx) / math.sin(th))) else: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.54) tmp = sin(th); elseif (sin(th) <= -0.005) tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); elseif (sin(th) <= 0.01) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(th) <= 0.78) tmp = Float64(sin(ky) / abs(Float64(sin(kx) / sin(th)))); else tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.54) tmp = sin(th); elseif (sin(th) <= -0.005) tmp = sin(th) / (sin(kx) / sin(ky)); elseif (sin(th) <= 0.01) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (sin(th) <= 0.78) tmp = sin(ky) / abs((sin(kx) / sin(th))); else tmp = sin(ky) * abs((sin(th) / sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.54], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.005], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.01], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.78], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.54:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq -0.005:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\mathbf{elif}\;\sin th \leq 0.01:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin th \leq 0.78:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.54000000000000004Initial program 90.0%
unpow290.0%
sqr-neg90.0%
sin-neg90.0%
sin-neg90.0%
unpow290.0%
associate-*l/90.0%
associate-/l*89.9%
+-commutative89.9%
unpow289.9%
sin-neg89.9%
sin-neg89.9%
Simplified99.5%
Taylor expanded in kx around 0 18.5%
if -0.54000000000000004 < (sin.f64 th) < -0.0050000000000000001Initial program 96.1%
+-commutative96.1%
unpow296.1%
unpow296.1%
hypot-undefine99.8%
Applied egg-rr99.8%
clear-num99.6%
associate-*l/99.6%
*-un-lft-identity99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 27.3%
if -0.0050000000000000001 < (sin.f64 th) < 0.0100000000000000002Initial program 94.5%
unpow294.5%
sqr-neg94.5%
sin-neg94.5%
sin-neg94.5%
unpow294.5%
associate-*l/90.6%
associate-/l*94.5%
+-commutative94.5%
unpow294.5%
sin-neg94.5%
sin-neg94.5%
Simplified99.7%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 92.0%
associate-*l/92.7%
+-commutative92.7%
unpow292.7%
unpow292.7%
hypot-undefine97.8%
*-lft-identity97.8%
hypot-undefine92.7%
unpow292.7%
unpow292.7%
+-commutative92.7%
unpow292.7%
unpow292.7%
hypot-define97.8%
Simplified97.8%
if 0.0100000000000000002 < (sin.f64 th) < 0.78000000000000003Initial program 93.1%
unpow293.1%
sqr-neg93.1%
sin-neg93.1%
sin-neg93.1%
unpow293.1%
associate-*l/92.9%
associate-/l*93.1%
+-commutative93.1%
unpow293.1%
sin-neg93.1%
sin-neg93.1%
Simplified99.4%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 30.7%
add-sqr-sqrt29.3%
sqrt-unprod53.8%
pow253.8%
Applied egg-rr53.8%
unpow253.8%
rem-sqrt-square57.3%
Simplified57.3%
if 0.78000000000000003 < (sin.f64 th) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.2%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
Taylor expanded in kx around 0 15.0%
add-sqr-sqrt13.5%
sqrt-unprod38.9%
pow238.9%
Applied egg-rr38.9%
unpow238.9%
rem-sqrt-square39.5%
Simplified39.5%
Final simplification67.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 1e-110)
(* ky (/ (sin th) (sin kx)))
(if (or (<= (sin ky) 2e-74) (not (<= (sin ky) 1e-50)))
(sin th)
(/ 1.0 (fabs (/ (sin kx) (* ky (sin th)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 1e-110) {
tmp = ky * (sin(th) / sin(kx));
} else if ((sin(ky) <= 2e-74) || !(sin(ky) <= 1e-50)) {
tmp = sin(th);
} else {
tmp = 1.0 / fabs((sin(kx) / (ky * 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.004d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 1d-110) then
tmp = ky * (sin(th) / sin(kx))
else if ((sin(ky) <= 2d-74) .or. (.not. (sin(ky) <= 1d-50))) then
tmp = sin(th)
else
tmp = 1.0d0 / abs((sin(kx) / (ky * 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.004) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-110) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if ((Math.sin(ky) <= 2e-74) || !(Math.sin(ky) <= 1e-50)) {
tmp = Math.sin(th);
} else {
tmp = 1.0 / Math.abs((Math.sin(kx) / (ky * Math.sin(th))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.004: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 1e-110: tmp = ky * (math.sin(th) / math.sin(kx)) elif (math.sin(ky) <= 2e-74) or not (math.sin(ky) <= 1e-50): tmp = math.sin(th) else: tmp = 1.0 / math.fabs((math.sin(kx) / (ky * math.sin(th)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.004) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 1e-110) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif ((sin(ky) <= 2e-74) || !(sin(ky) <= 1e-50)) tmp = sin(th); else tmp = Float64(1.0 / abs(Float64(sin(kx) / Float64(ky * sin(th))))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.004) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 1e-110) tmp = ky * (sin(th) / sin(kx)); elseif ((sin(ky) <= 2e-74) || ~((sin(ky) <= 1e-50))) tmp = sin(th); else tmp = 1.0 / abs((sin(kx) / (ky * sin(th)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.004], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-110], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 2e-74], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 1e-50]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(1.0 / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.004:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-110}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-74} \lor \neg \left(\sin ky \leq 10^{-50}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left|\frac{\sin kx}{ky \cdot \sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0040000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.1%
sqrt-unprod23.2%
pow223.2%
Applied egg-rr23.2%
unpow223.2%
rem-sqrt-square35.9%
Simplified35.9%
Taylor expanded in th around 0 22.7%
if -0.0040000000000000001 < (sin.f64 ky) < 1.0000000000000001e-110Initial program 86.6%
unpow286.6%
sqr-neg86.6%
sin-neg86.6%
sin-neg86.6%
unpow286.6%
associate-*l/81.8%
associate-/l*86.6%
+-commutative86.6%
unpow286.6%
sin-neg86.6%
sin-neg86.6%
Simplified99.7%
Taylor expanded in ky around 0 52.8%
associate-/l*54.5%
Simplified54.5%
if 1.0000000000000001e-110 < (sin.f64 ky) < 1.99999999999999992e-74 or 1.00000000000000001e-50 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in kx around 0 60.0%
if 1.99999999999999992e-74 < (sin.f64 ky) < 1.00000000000000001e-50Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.1%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
associate-*r/99.1%
clear-num99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 44.5%
add-sqr-sqrt28.9%
sqrt-unprod45.4%
pow245.4%
*-commutative45.4%
Applied egg-rr45.4%
unpow245.4%
rem-sqrt-square58.2%
*-commutative58.2%
Simplified58.2%
Final simplification48.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(if (<= (sin ky) 1e-110)
(* ky (/ (sin th) (sin kx)))
(if (or (<= (sin ky) 2e-74) (not (<= (sin ky) 1e-50)))
(sin th)
(/ 1.0 (fabs (/ (sin kx) (* ky (sin th)))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else if (sin(ky) <= 1e-110) {
tmp = ky * (sin(th) / sin(kx));
} else if ((sin(ky) <= 2e-74) || !(sin(ky) <= 1e-50)) {
tmp = sin(th);
} else {
tmp = 1.0 / fabs((sin(kx) / (ky * 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.004d0)) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else if (sin(ky) <= 1d-110) then
tmp = ky * (sin(th) / sin(kx))
else if ((sin(ky) <= 2d-74) .or. (.not. (sin(ky) <= 1d-50))) then
tmp = sin(th)
else
tmp = 1.0d0 / abs((sin(kx) / (ky * 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.004) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-110) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if ((Math.sin(ky) <= 2e-74) || !(Math.sin(ky) <= 1e-50)) {
tmp = Math.sin(th);
} else {
tmp = 1.0 / Math.abs((Math.sin(kx) / (ky * Math.sin(th))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.004: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) elif math.sin(ky) <= 1e-110: tmp = ky * (math.sin(th) / math.sin(kx)) elif (math.sin(ky) <= 2e-74) or not (math.sin(ky) <= 1e-50): tmp = math.sin(th) else: tmp = 1.0 / math.fabs((math.sin(kx) / (ky * math.sin(th)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.004) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); elseif (sin(ky) <= 1e-110) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif ((sin(ky) <= 2e-74) || !(sin(ky) <= 1e-50)) tmp = sin(th); else tmp = Float64(1.0 / abs(Float64(sin(kx) / Float64(ky * sin(th))))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.004) tmp = sin(ky) * abs((sin(th) / sin(ky))); elseif (sin(ky) <= 1e-110) tmp = ky * (sin(th) / sin(kx)); elseif ((sin(ky) <= 2e-74) || ~((sin(ky) <= 1e-50))) tmp = sin(th); else tmp = 1.0 / abs((sin(kx) / (ky * sin(th)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.004], 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-110], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 2e-74], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 1e-50]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(1.0 / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.004:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-110}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-74} \lor \neg \left(\sin ky \leq 10^{-50}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left|\frac{\sin kx}{ky \cdot \sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0040000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.1%
sqrt-unprod23.2%
pow223.2%
Applied egg-rr23.2%
unpow223.2%
rem-sqrt-square35.9%
Simplified35.9%
if -0.0040000000000000001 < (sin.f64 ky) < 1.0000000000000001e-110Initial program 86.6%
unpow286.6%
sqr-neg86.6%
sin-neg86.6%
sin-neg86.6%
unpow286.6%
associate-*l/81.8%
associate-/l*86.6%
+-commutative86.6%
unpow286.6%
sin-neg86.6%
sin-neg86.6%
Simplified99.7%
Taylor expanded in ky around 0 52.8%
associate-/l*54.5%
Simplified54.5%
if 1.0000000000000001e-110 < (sin.f64 ky) < 1.99999999999999992e-74 or 1.00000000000000001e-50 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in kx around 0 60.0%
if 1.99999999999999992e-74 < (sin.f64 ky) < 1.00000000000000001e-50Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.1%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.6%
associate-*r/99.1%
clear-num99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 44.5%
add-sqr-sqrt28.9%
sqrt-unprod45.4%
pow245.4%
*-commutative45.4%
Applied egg-rr45.4%
unpow245.4%
rem-sqrt-square58.2%
*-commutative58.2%
Simplified58.2%
Final simplification51.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(fabs (+ 1.0 (- -1.0 (sin th))))
(if (or (<= (sin ky) 1e-110)
(and (not (<= (sin ky) 1e-71)) (<= (sin ky) 1e-50)))
(* ky (/ (sin th) (sin kx)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = fabs((1.0 + (-1.0 - sin(th))));
} else if ((sin(ky) <= 1e-110) || (!(sin(ky) <= 1e-71) && (sin(ky) <= 1e-50))) {
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.004d0)) then
tmp = abs((1.0d0 + ((-1.0d0) - sin(th))))
else if ((sin(ky) <= 1d-110) .or. (.not. (sin(ky) <= 1d-71)) .and. (sin(ky) <= 1d-50)) 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.004) {
tmp = Math.abs((1.0 + (-1.0 - Math.sin(th))));
} else if ((Math.sin(ky) <= 1e-110) || (!(Math.sin(ky) <= 1e-71) && (Math.sin(ky) <= 1e-50))) {
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.004: tmp = math.fabs((1.0 + (-1.0 - math.sin(th)))) elif (math.sin(ky) <= 1e-110) or (not (math.sin(ky) <= 1e-71) and (math.sin(ky) <= 1e-50)): 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.004) tmp = abs(Float64(1.0 + Float64(-1.0 - sin(th)))); elseif ((sin(ky) <= 1e-110) || (!(sin(ky) <= 1e-71) && (sin(ky) <= 1e-50))) 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.004) tmp = abs((1.0 + (-1.0 - sin(th)))); elseif ((sin(ky) <= 1e-110) || (~((sin(ky) <= 1e-71)) && (sin(ky) <= 1e-50))) 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.004], N[Abs[N[(1.0 + N[(-1.0 - N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 1e-110], And[N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 1e-71]], $MachinePrecision], LessEqual[N[Sin[ky], $MachinePrecision], 1e-50]]], 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.004:\\
\;\;\;\;\left|1 + \left(-1 - \sin th\right)\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-110} \lor \neg \left(\sin ky \leq 10^{-71}\right) \land \sin ky \leq 10^{-50}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0040000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
expm1-log1p-u2.6%
expm1-undefine3.3%
associate-*r/3.3%
*-commutative3.3%
associate-/l*3.3%
Applied egg-rr3.3%
expm1-define2.6%
*-inverses2.6%
*-rgt-identity2.6%
Simplified2.6%
expm1-log1p-u2.6%
add-sqr-sqrt1.5%
fabs-sqr1.5%
add-sqr-sqrt34.2%
expm1-log1p-u34.2%
expm1-undefine23.7%
fabs-sub23.7%
log1p-undefine23.7%
rem-exp-log23.7%
+-commutative23.7%
Applied egg-rr23.7%
if -0.0040000000000000001 < (sin.f64 ky) < 1.0000000000000001e-110 or 9.9999999999999992e-72 < (sin.f64 ky) < 1.00000000000000001e-50Initial program 87.4%
unpow287.4%
sqr-neg87.4%
sin-neg87.4%
sin-neg87.4%
unpow287.4%
associate-*l/82.9%
associate-/l*87.4%
+-commutative87.4%
unpow287.4%
sin-neg87.4%
sin-neg87.4%
Simplified99.7%
Taylor expanded in ky around 0 52.3%
associate-/l*53.9%
Simplified53.9%
if 1.0000000000000001e-110 < (sin.f64 ky) < 9.9999999999999992e-72 or 1.00000000000000001e-50 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in kx around 0 60.0%
Final simplification47.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(fabs (+ 1.0 (- -1.0 (sin th))))
(if (<= (sin ky) 1e-110)
(* ky (/ (sin th) (sin kx)))
(if (or (<= (sin ky) 1e-71) (not (<= (sin ky) 1e-50)))
(sin th)
(* (sin th) (/ ky (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = fabs((1.0 + (-1.0 - sin(th))));
} else if (sin(ky) <= 1e-110) {
tmp = ky * (sin(th) / sin(kx));
} else if ((sin(ky) <= 1e-71) || !(sin(ky) <= 1e-50)) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.004d0)) then
tmp = abs((1.0d0 + ((-1.0d0) - sin(th))))
else if (sin(ky) <= 1d-110) then
tmp = ky * (sin(th) / sin(kx))
else if ((sin(ky) <= 1d-71) .or. (.not. (sin(ky) <= 1d-50))) then
tmp = sin(th)
else
tmp = sin(th) * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.004) {
tmp = Math.abs((1.0 + (-1.0 - Math.sin(th))));
} else if (Math.sin(ky) <= 1e-110) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if ((Math.sin(ky) <= 1e-71) || !(Math.sin(ky) <= 1e-50)) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.004: tmp = math.fabs((1.0 + (-1.0 - math.sin(th)))) elif math.sin(ky) <= 1e-110: tmp = ky * (math.sin(th) / math.sin(kx)) elif (math.sin(ky) <= 1e-71) or not (math.sin(ky) <= 1e-50): tmp = math.sin(th) else: tmp = math.sin(th) * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.004) tmp = abs(Float64(1.0 + Float64(-1.0 - sin(th)))); elseif (sin(ky) <= 1e-110) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif ((sin(ky) <= 1e-71) || !(sin(ky) <= 1e-50)) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.004) tmp = abs((1.0 + (-1.0 - sin(th)))); elseif (sin(ky) <= 1e-110) tmp = ky * (sin(th) / sin(kx)); elseif ((sin(ky) <= 1e-71) || ~((sin(ky) <= 1e-50))) tmp = sin(th); else tmp = sin(th) * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.004], N[Abs[N[(1.0 + N[(-1.0 - N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-110], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 1e-71], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 1e-50]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.004:\\
\;\;\;\;\left|1 + \left(-1 - \sin th\right)\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-110}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-71} \lor \neg \left(\sin ky \leq 10^{-50}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0040000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
expm1-log1p-u2.6%
expm1-undefine3.3%
associate-*r/3.3%
*-commutative3.3%
associate-/l*3.3%
Applied egg-rr3.3%
expm1-define2.6%
*-inverses2.6%
*-rgt-identity2.6%
Simplified2.6%
expm1-log1p-u2.6%
add-sqr-sqrt1.5%
fabs-sqr1.5%
add-sqr-sqrt34.2%
expm1-log1p-u34.2%
expm1-undefine23.7%
fabs-sub23.7%
log1p-undefine23.7%
rem-exp-log23.7%
+-commutative23.7%
Applied egg-rr23.7%
if -0.0040000000000000001 < (sin.f64 ky) < 1.0000000000000001e-110Initial program 86.6%
unpow286.6%
sqr-neg86.6%
sin-neg86.6%
sin-neg86.6%
unpow286.6%
associate-*l/81.8%
associate-/l*86.6%
+-commutative86.6%
unpow286.6%
sin-neg86.6%
sin-neg86.6%
Simplified99.7%
Taylor expanded in ky around 0 52.8%
associate-/l*54.5%
Simplified54.5%
if 1.0000000000000001e-110 < (sin.f64 ky) < 9.9999999999999992e-72 or 1.00000000000000001e-50 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in kx around 0 60.0%
if 9.9999999999999992e-72 < (sin.f64 ky) < 1.00000000000000001e-50Initial program 99.6%
Taylor expanded in ky around 0 44.2%
Final simplification47.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(fabs (+ 1.0 (- -1.0 (sin th))))
(if (<= (sin ky) 1e-110)
(* ky (/ (sin th) (sin kx)))
(if (or (<= (sin ky) 1e-71) (not (<= (sin ky) 1e-50)))
(sin th)
(/ (sin th) (/ (sin kx) ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = fabs((1.0 + (-1.0 - sin(th))));
} else if (sin(ky) <= 1e-110) {
tmp = ky * (sin(th) / sin(kx));
} else if ((sin(ky) <= 1e-71) || !(sin(ky) <= 1e-50)) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / ky);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.004d0)) then
tmp = abs((1.0d0 + ((-1.0d0) - sin(th))))
else if (sin(ky) <= 1d-110) then
tmp = ky * (sin(th) / sin(kx))
else if ((sin(ky) <= 1d-71) .or. (.not. (sin(ky) <= 1d-50))) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.004) {
tmp = Math.abs((1.0 + (-1.0 - Math.sin(th))));
} else if (Math.sin(ky) <= 1e-110) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if ((Math.sin(ky) <= 1e-71) || !(Math.sin(ky) <= 1e-50)) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.004: tmp = math.fabs((1.0 + (-1.0 - math.sin(th)))) elif math.sin(ky) <= 1e-110: tmp = ky * (math.sin(th) / math.sin(kx)) elif (math.sin(ky) <= 1e-71) or not (math.sin(ky) <= 1e-50): tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.004) tmp = abs(Float64(1.0 + Float64(-1.0 - sin(th)))); elseif (sin(ky) <= 1e-110) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif ((sin(ky) <= 1e-71) || !(sin(ky) <= 1e-50)) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.004) tmp = abs((1.0 + (-1.0 - sin(th)))); elseif (sin(ky) <= 1e-110) tmp = ky * (sin(th) / sin(kx)); elseif ((sin(ky) <= 1e-71) || ~((sin(ky) <= 1e-50))) tmp = sin(th); else tmp = sin(th) / (sin(kx) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.004], N[Abs[N[(1.0 + N[(-1.0 - N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-110], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 1e-71], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 1e-50]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.004:\\
\;\;\;\;\left|1 + \left(-1 - \sin th\right)\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-110}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-71} \lor \neg \left(\sin ky \leq 10^{-50}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0040000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
expm1-log1p-u2.6%
expm1-undefine3.3%
associate-*r/3.3%
*-commutative3.3%
associate-/l*3.3%
Applied egg-rr3.3%
expm1-define2.6%
*-inverses2.6%
*-rgt-identity2.6%
Simplified2.6%
expm1-log1p-u2.6%
add-sqr-sqrt1.5%
fabs-sqr1.5%
add-sqr-sqrt34.2%
expm1-log1p-u34.2%
expm1-undefine23.7%
fabs-sub23.7%
log1p-undefine23.7%
rem-exp-log23.7%
+-commutative23.7%
Applied egg-rr23.7%
if -0.0040000000000000001 < (sin.f64 ky) < 1.0000000000000001e-110Initial program 86.6%
unpow286.6%
sqr-neg86.6%
sin-neg86.6%
sin-neg86.6%
unpow286.6%
associate-*l/81.8%
associate-/l*86.6%
+-commutative86.6%
unpow286.6%
sin-neg86.6%
sin-neg86.6%
Simplified99.7%
Taylor expanded in ky around 0 52.8%
associate-/l*54.5%
Simplified54.5%
if 1.0000000000000001e-110 < (sin.f64 ky) < 9.9999999999999992e-72 or 1.00000000000000001e-50 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in kx around 0 60.0%
if 9.9999999999999992e-72 < (sin.f64 ky) < 1.00000000000000001e-50Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 44.5%
Final simplification47.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.004)
(* (sin ky) (fabs (/ th (sin ky))))
(if (<= (sin ky) 1e-110)
(* ky (/ (sin th) (sin kx)))
(if (or (<= (sin ky) 1e-71) (not (<= (sin ky) 1e-50)))
(sin th)
(/ (sin th) (/ (sin kx) ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.004) {
tmp = sin(ky) * fabs((th / sin(ky)));
} else if (sin(ky) <= 1e-110) {
tmp = ky * (sin(th) / sin(kx));
} else if ((sin(ky) <= 1e-71) || !(sin(ky) <= 1e-50)) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / ky);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.004d0)) then
tmp = sin(ky) * abs((th / sin(ky)))
else if (sin(ky) <= 1d-110) then
tmp = ky * (sin(th) / sin(kx))
else if ((sin(ky) <= 1d-71) .or. (.not. (sin(ky) <= 1d-50))) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.004) {
tmp = Math.sin(ky) * Math.abs((th / Math.sin(ky)));
} else if (Math.sin(ky) <= 1e-110) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if ((Math.sin(ky) <= 1e-71) || !(Math.sin(ky) <= 1e-50)) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.004: tmp = math.sin(ky) * math.fabs((th / math.sin(ky))) elif math.sin(ky) <= 1e-110: tmp = ky * (math.sin(th) / math.sin(kx)) elif (math.sin(ky) <= 1e-71) or not (math.sin(ky) <= 1e-50): tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.004) tmp = Float64(sin(ky) * abs(Float64(th / sin(ky)))); elseif (sin(ky) <= 1e-110) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif ((sin(ky) <= 1e-71) || !(sin(ky) <= 1e-50)) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.004) tmp = sin(ky) * abs((th / sin(ky))); elseif (sin(ky) <= 1e-110) tmp = ky * (sin(th) / sin(kx)); elseif ((sin(ky) <= 1e-71) || ~((sin(ky) <= 1e-50))) tmp = sin(th); else tmp = sin(th) / (sin(kx) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.004], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-110], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[Sin[ky], $MachinePrecision], 1e-71], N[Not[LessEqual[N[Sin[ky], $MachinePrecision], 1e-50]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.004:\\
\;\;\;\;\sin ky \cdot \left|\frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 10^{-110}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-71} \lor \neg \left(\sin ky \leq 10^{-50}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0040000000000000001Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.6%
Taylor expanded in kx around 0 2.6%
add-sqr-sqrt1.1%
sqrt-unprod23.2%
pow223.2%
Applied egg-rr23.2%
unpow223.2%
rem-sqrt-square35.9%
Simplified35.9%
Taylor expanded in th around 0 22.7%
if -0.0040000000000000001 < (sin.f64 ky) < 1.0000000000000001e-110Initial program 86.6%
unpow286.6%
sqr-neg86.6%
sin-neg86.6%
sin-neg86.6%
unpow286.6%
associate-*l/81.8%
associate-/l*86.6%
+-commutative86.6%
unpow286.6%
sin-neg86.6%
sin-neg86.6%
Simplified99.7%
Taylor expanded in ky around 0 52.8%
associate-/l*54.5%
Simplified54.5%
if 1.0000000000000001e-110 < (sin.f64 ky) < 9.9999999999999992e-72 or 1.00000000000000001e-50 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
+-commutative99.7%
unpow299.7%
sin-neg99.7%
sin-neg99.7%
Simplified99.7%
Taylor expanded in kx around 0 60.0%
if 9.9999999999999992e-72 < (sin.f64 ky) < 1.00000000000000001e-50Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-undefine99.6%
Applied egg-rr99.6%
clear-num99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in ky around 0 44.5%
Final simplification47.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.005)
(/ (sin ky) (fabs (/ (sin kx) (sin th))))
(if (<= (sin kx) 1e-48)
(* (sin ky) (fabs (/ (sin th) (sin ky))))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.005) {
tmp = sin(ky) / fabs((sin(kx) / sin(th)));
} else if (sin(kx) <= 1e-48) {
tmp = sin(ky) * fabs((sin(th) / sin(ky)));
} else {
tmp = sin(ky) * (sin(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) <= (-0.005d0)) then
tmp = sin(ky) / abs((sin(kx) / sin(th)))
else if (sin(kx) <= 1d-48) then
tmp = sin(ky) * abs((sin(th) / sin(ky)))
else
tmp = sin(ky) * (sin(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) <= -0.005) {
tmp = Math.sin(ky) / Math.abs((Math.sin(kx) / Math.sin(th)));
} else if (Math.sin(kx) <= 1e-48) {
tmp = Math.sin(ky) * Math.abs((Math.sin(th) / Math.sin(ky)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.005: tmp = math.sin(ky) / math.fabs((math.sin(kx) / math.sin(th))) elif math.sin(kx) <= 1e-48: tmp = math.sin(ky) * math.fabs((math.sin(th) / math.sin(ky))) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.005) tmp = Float64(sin(ky) / abs(Float64(sin(kx) / sin(th)))); elseif (sin(kx) <= 1e-48) tmp = Float64(sin(ky) * abs(Float64(sin(th) / sin(ky)))); else tmp = Float64(sin(ky) * Float64(sin(th) / 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(kx) / sin(th))); elseif (sin(kx) <= 1e-48) tmp = sin(ky) * abs((sin(th) / sin(ky))); else tmp = sin(ky) * (sin(th) / 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[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-48], N[(N[Sin[ky], $MachinePrecision] * N[Abs[N[(N[Sin[th], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\mathbf{elif}\;\sin kx \leq 10^{-48}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin ky}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\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.3%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.4%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 19.9%
add-sqr-sqrt9.8%
sqrt-unprod40.8%
pow240.8%
Applied egg-rr40.8%
unpow240.8%
rem-sqrt-square41.5%
Simplified41.5%
if -0.0050000000000000001 < (sin.f64 kx) < 9.9999999999999997e-49Initial program 88.5%
unpow288.5%
sqr-neg88.5%
sin-neg88.5%
sin-neg88.5%
unpow288.5%
associate-*l/84.5%
associate-/l*88.4%
+-commutative88.4%
unpow288.4%
sin-neg88.4%
sin-neg88.4%
Simplified99.8%
Taylor expanded in kx around 0 30.8%
add-sqr-sqrt12.7%
sqrt-unprod24.4%
pow224.4%
Applied egg-rr24.4%
unpow224.4%
rem-sqrt-square38.2%
Simplified38.2%
if 9.9999999999999997e-49 < (sin.f64 kx) Initial program 99.4%
unpow299.4%
sqr-neg99.4%
sin-neg99.4%
sin-neg99.4%
unpow299.4%
associate-*l/99.2%
associate-/l*99.5%
+-commutative99.5%
unpow299.5%
sin-neg99.5%
sin-neg99.5%
Simplified99.5%
Taylor expanded in ky around 0 65.3%
Final simplification47.5%
(FPCore (kx ky th) :precision binary64 (if (<= th 0.0033) (/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)) (/ 1.0 (/ (hypot (sin ky) (sin kx)) (* ky (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0033) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 0.0033) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = 1.0 / (Math.hypot(Math.sin(ky), Math.sin(kx)) / (ky * Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 0.0033: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = 1.0 / (math.hypot(math.sin(ky), math.sin(kx)) / (ky * math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 0.0033) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(1.0 / Float64(hypot(sin(ky), sin(kx)) / Float64(ky * sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 0.0033) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = 1.0 / (hypot(sin(ky), sin(kx)) / (ky * sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 0.0033], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 0.0033:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky \cdot \sin th}}\\
\end{array}
\end{array}
if th < 0.0033Initial program 94.6%
unpow294.6%
sqr-neg94.6%
sin-neg94.6%
sin-neg94.6%
unpow294.6%
associate-*l/91.9%
associate-/l*94.7%
+-commutative94.7%
unpow294.7%
sin-neg94.7%
sin-neg94.7%
Simplified99.7%
clear-num99.5%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in th around 0 64.0%
associate-*l/64.5%
+-commutative64.5%
unpow264.5%
unpow264.5%
hypot-undefine68.0%
*-lft-identity68.0%
hypot-undefine64.5%
unpow264.5%
unpow264.5%
+-commutative64.5%
unpow264.5%
unpow264.5%
hypot-define68.0%
Simplified68.0%
if 0.0033 < th Initial program 91.9%
unpow291.9%
sqr-neg91.9%
sin-neg91.9%
sin-neg91.9%
unpow291.9%
associate-*l/91.8%
associate-/l*91.9%
+-commutative91.9%
unpow291.9%
sin-neg91.9%
sin-neg91.9%
Simplified99.6%
associate-*r/99.6%
clear-num99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 49.1%
Final simplification63.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.75e-129) (* ky (/ (sin th) kx)) (if (or (<= ky 4.8e+104) (not (<= ky 3.5e+191))) (sin th) (fabs (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.75e-129) {
tmp = ky * (sin(th) / kx);
} else if ((ky <= 4.8e+104) || !(ky <= 3.5e+191)) {
tmp = sin(th);
} else {
tmp = fabs(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 <= 2.75d-129) then
tmp = ky * (sin(th) / kx)
else if ((ky <= 4.8d+104) .or. (.not. (ky <= 3.5d+191))) then
tmp = sin(th)
else
tmp = abs(sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.75e-129) {
tmp = ky * (Math.sin(th) / kx);
} else if ((ky <= 4.8e+104) || !(ky <= 3.5e+191)) {
tmp = Math.sin(th);
} else {
tmp = Math.abs(Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.75e-129: tmp = ky * (math.sin(th) / kx) elif (ky <= 4.8e+104) or not (ky <= 3.5e+191): tmp = math.sin(th) else: tmp = math.fabs(math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.75e-129) tmp = Float64(ky * Float64(sin(th) / kx)); elseif ((ky <= 4.8e+104) || !(ky <= 3.5e+191)) tmp = sin(th); else tmp = abs(sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.75e-129) tmp = ky * (sin(th) / kx); elseif ((ky <= 4.8e+104) || ~((ky <= 3.5e+191))) tmp = sin(th); else tmp = abs(sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.75e-129], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[ky, 4.8e+104], N[Not[LessEqual[ky, 3.5e+191]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.75 \cdot 10^{-129}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;ky \leq 4.8 \cdot 10^{+104} \lor \neg \left(ky \leq 3.5 \cdot 10^{+191}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin th\right|\\
\end{array}
\end{array}
if ky < 2.75000000000000012e-129Initial program 91.4%
unpow291.4%
sqr-neg91.4%
sin-neg91.4%
sin-neg91.4%
unpow291.4%
associate-*l/88.4%
associate-/l*91.4%
+-commutative91.4%
unpow291.4%
sin-neg91.4%
sin-neg91.4%
Simplified99.6%
associate-*r/94.4%
clear-num94.1%
Applied egg-rr94.1%
Taylor expanded in ky around 0 32.4%
Taylor expanded in kx around 0 18.2%
associate-/l*19.2%
Simplified19.2%
if 2.75000000000000012e-129 < ky < 4.8e104 or 3.4999999999999997e191 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.8%
+-commutative99.8%
unpow299.8%
sin-neg99.8%
sin-neg99.8%
Simplified99.7%
Taylor expanded in kx around 0 28.6%
if 4.8e104 < ky < 3.4999999999999997e191Initial program 99.9%
unpow299.9%
sqr-neg99.9%
sin-neg99.9%
sin-neg99.9%
unpow299.9%
associate-*l/99.8%
associate-/l*99.9%
+-commutative99.9%
unpow299.9%
sin-neg99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in kx around 0 24.6%
add-sqr-sqrt7.2%
sqrt-unprod37.0%
pow237.0%
associate-*r/37.0%
*-commutative37.0%
associate-/l*37.1%
Applied egg-rr37.1%
unpow237.1%
rem-sqrt-square43.3%
*-inverses43.3%
*-rgt-identity43.3%
Simplified43.3%
Final simplification23.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky 9.2e-111) (* ky (/ th (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 9.2e-111) {
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 <= 9.2d-111) 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 <= 9.2e-111) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 9.2e-111: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 9.2e-111) 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 <= 9.2e-111) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 9.2e-111], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 9.2 \cdot 10^{-111}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 9.2e-111Initial program 91.6%
unpow291.6%
sqr-neg91.6%
sin-neg91.6%
sin-neg91.6%
unpow291.6%
associate-*l/88.7%
associate-/l*91.6%
+-commutative91.6%
unpow291.6%
sin-neg91.6%
sin-neg91.6%
Simplified99.6%
associate-*r/94.5%
clear-num94.2%
Applied egg-rr94.2%
Taylor expanded in ky around 0 33.3%
Taylor expanded in th around 0 19.9%
associate-/l*20.9%
Simplified20.9%
if 9.2e-111 < ky Initial program 99.8%
unpow299.8%
sqr-neg99.8%
sin-neg99.8%
sin-neg99.8%
unpow299.8%
associate-*l/99.7%
associate-/l*99.8%
+-commutative99.8%
unpow299.8%
sin-neg99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in kx around 0 29.1%
Final simplification23.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 3.2e-129) (* ky (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 3.2e-129) {
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.2d-129) 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.2e-129) {
tmp = ky * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 3.2e-129: tmp = ky * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 3.2e-129) 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.2e-129) tmp = ky * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 3.2e-129], 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.2 \cdot 10^{-129}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 3.2000000000000003e-129Initial program 91.4%
unpow291.4%
sqr-neg91.4%
sin-neg91.4%
sin-neg91.4%
unpow291.4%
associate-*l/88.4%
associate-/l*91.4%
+-commutative91.4%
unpow291.4%
sin-neg91.4%
sin-neg91.4%
Simplified99.6%
associate-*r/94.4%
clear-num94.1%
Applied egg-rr94.1%
Taylor expanded in ky around 0 32.4%
Taylor expanded in kx around 0 18.2%
associate-/l*19.2%
Simplified19.2%
if 3.2000000000000003e-129 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.7%
associate-/l*99.8%
+-commutative99.8%
unpow299.8%
sin-neg99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in kx around 0 27.9%
Final simplification21.9%
(FPCore (kx ky th) :precision binary64 (if (<= kx 4e-7) (sin th) (+ (+ th 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4e-7) {
tmp = sin(th);
} else {
tmp = (th + 1.0) + -1.0;
}
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 <= 4d-7) then
tmp = sin(th)
else
tmp = (th + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 4e-7) {
tmp = Math.sin(th);
} else {
tmp = (th + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 4e-7: tmp = math.sin(th) else: tmp = (th + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 4e-7) tmp = sin(th); else tmp = Float64(Float64(th + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 4e-7) tmp = sin(th); else tmp = (th + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 4e-7], N[Sin[th], $MachinePrecision], N[(N[(th + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\left(th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 3.9999999999999998e-7Initial program 92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
associate-*l/89.7%
associate-/l*92.3%
+-commutative92.3%
unpow292.3%
sin-neg92.3%
sin-neg92.3%
Simplified99.7%
Taylor expanded in kx around 0 24.0%
if 3.9999999999999998e-7 < kx Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.1%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.5%
Taylor expanded in kx around 0 8.0%
expm1-log1p-u8.0%
expm1-undefine18.3%
associate-*r/18.3%
*-commutative18.3%
associate-/l*18.3%
Applied egg-rr18.3%
expm1-define8.0%
*-inverses8.0%
*-rgt-identity8.0%
Simplified8.0%
expm1-undefine18.3%
log1p-undefine18.3%
rem-exp-log18.3%
+-commutative18.3%
Applied egg-rr18.3%
Taylor expanded in th around 0 16.5%
+-commutative16.5%
Simplified16.5%
Final simplification22.2%
(FPCore (kx ky th) :precision binary64 (if (<= kx 8.8e-10) th (+ (+ th 1.0) -1.0)))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.8e-10) {
tmp = th;
} else {
tmp = (th + 1.0) + -1.0;
}
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 <= 8.8d-10) then
tmp = th
else
tmp = (th + 1.0d0) + (-1.0d0)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 8.8e-10) {
tmp = th;
} else {
tmp = (th + 1.0) + -1.0;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 8.8e-10: tmp = th else: tmp = (th + 1.0) + -1.0 return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 8.8e-10) tmp = th; else tmp = Float64(Float64(th + 1.0) + -1.0); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 8.8e-10) tmp = th; else tmp = (th + 1.0) + -1.0; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 8.8e-10], th, N[(N[(th + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 8.8 \cdot 10^{-10}:\\
\;\;\;\;th\\
\mathbf{else}:\\
\;\;\;\;\left(th + 1\right) + -1\\
\end{array}
\end{array}
if kx < 8.7999999999999996e-10Initial program 92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
associate-*l/89.7%
associate-/l*92.3%
+-commutative92.3%
unpow292.3%
sin-neg92.3%
sin-neg92.3%
Simplified99.7%
Taylor expanded in kx around 0 23.9%
Taylor expanded in th around 0 15.7%
if 8.7999999999999996e-10 < kx Initial program 99.3%
unpow299.3%
sqr-neg99.3%
sin-neg99.3%
sin-neg99.3%
unpow299.3%
associate-*l/99.1%
associate-/l*99.6%
+-commutative99.6%
unpow299.6%
sin-neg99.6%
sin-neg99.6%
Simplified99.5%
Taylor expanded in kx around 0 8.0%
expm1-log1p-u8.0%
expm1-undefine18.3%
associate-*r/18.3%
*-commutative18.3%
associate-/l*18.3%
Applied egg-rr18.3%
expm1-define8.0%
*-inverses8.0%
*-rgt-identity8.0%
Simplified8.0%
expm1-undefine18.3%
log1p-undefine18.3%
rem-exp-log18.3%
+-commutative18.3%
Applied egg-rr18.3%
Taylor expanded in th around 0 16.5%
+-commutative16.5%
Simplified16.5%
Final simplification15.9%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.0%
unpow294.0%
sqr-neg94.0%
sin-neg94.0%
sin-neg94.0%
unpow294.0%
associate-*l/91.9%
associate-/l*94.0%
+-commutative94.0%
unpow294.0%
sin-neg94.0%
sin-neg94.0%
Simplified99.7%
Taylor expanded in kx around 0 20.2%
Taylor expanded in th around 0 13.5%
Final simplification13.5%
herbie shell --seed 2024115
(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)))