
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (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.6%
associate-*l/91.6%
*-commutative91.6%
associate-*l/94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -5e-52)
(* (sin ky) (* th (fabs (/ 1.0 (sin ky)))))
(if (<= (sin ky) 2e-301)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) 4e-8)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-52) {
tmp = sin(ky) * (th * fabs((1.0 / sin(ky))));
} else if (sin(ky) <= 2e-301) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 4e-8) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-5d-52)) then
tmp = sin(ky) * (th * abs((1.0d0 / sin(ky))))
else if (sin(ky) <= 2d-301) then
tmp = ky * (sin(th) / sin(kx))
else if (sin(ky) <= 4d-8) then
tmp = sin(th) * abs((sin(ky) / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-52) {
tmp = Math.sin(ky) * (th * Math.abs((1.0 / Math.sin(ky))));
} else if (Math.sin(ky) <= 2e-301) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 4e-8) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-52: tmp = math.sin(ky) * (th * math.fabs((1.0 / math.sin(ky)))) elif math.sin(ky) <= 2e-301: tmp = ky * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 4e-8: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-52) tmp = Float64(sin(ky) * Float64(th * abs(Float64(1.0 / sin(ky))))); elseif (sin(ky) <= 2e-301) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 4e-8) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-52) tmp = sin(ky) * (th * abs((1.0 / sin(ky)))); elseif (sin(ky) <= 2e-301) tmp = ky * (sin(th) / sin(kx)); elseif (sin(ky) <= 4e-8) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-52], N[(N[Sin[ky], $MachinePrecision] * N[(th * N[Abs[N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-301], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-8], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-52}:\\
\;\;\;\;\sin ky \cdot \left(th \cdot \left|\frac{1}{\sin ky}\right|\right)\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-301}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5e-52Initial program 99.6%
associate-*l/96.1%
*-commutative96.1%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 43.6%
*-commutative43.6%
+-commutative43.6%
Simplified43.6%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt0.0%
sqrt-unprod31.2%
inv-pow31.2%
inv-pow31.2%
pow-prod-up31.2%
metadata-eval31.2%
Applied egg-rr31.2%
metadata-eval31.2%
pow-sqr31.2%
unpow-131.2%
unpow-131.2%
rem-sqrt-square31.2%
Simplified31.2%
if -5e-52 < (sin.f64 ky) < 2.00000000000000013e-301Initial program 83.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.7%
hypot-udef83.7%
unpow283.7%
unpow283.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-def99.7%
Applied egg-rr99.7%
frac-2neg99.7%
div-inv99.7%
distribute-neg-frac99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 61.1%
*-lft-identity61.1%
times-frac64.7%
/-rgt-identity64.7%
Simplified64.7%
if 2.00000000000000013e-301 < (sin.f64 ky) < 4.0000000000000001e-8Initial program 93.1%
Taylor expanded in ky around 0 44.2%
add-sqr-sqrt34.6%
sqrt-unprod57.4%
pow257.4%
Applied egg-rr57.4%
unpow257.4%
rem-sqrt-square73.2%
Simplified73.2%
if 4.0000000000000001e-8 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.3%
Final simplification56.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.019)
(fabs (* (sin ky) (/ th (sin ky))))
(if (<= (sin ky) 2e-301)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) 4e-8) (* (sin th) (fabs (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.019) {
tmp = fabs((sin(ky) * (th / sin(ky))));
} else if (sin(ky) <= 2e-301) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 4e-8) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.019d0)) then
tmp = abs((sin(ky) * (th / sin(ky))))
else if (sin(ky) <= 2d-301) then
tmp = ky * (sin(th) / sin(kx))
else if (sin(ky) <= 4d-8) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.019) {
tmp = Math.abs((Math.sin(ky) * (th / Math.sin(ky))));
} else if (Math.sin(ky) <= 2e-301) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 4e-8) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.019: tmp = math.fabs((math.sin(ky) * (th / math.sin(ky)))) elif math.sin(ky) <= 2e-301: tmp = ky * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 4e-8: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.019) tmp = abs(Float64(sin(ky) * Float64(th / sin(ky)))); elseif (sin(ky) <= 2e-301) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 4e-8) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.019) tmp = abs((sin(ky) * (th / sin(ky)))); elseif (sin(ky) <= 2e-301) tmp = ky * (sin(th) / sin(kx)); elseif (sin(ky) <= 4e-8) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.019], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-301], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-8], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.019:\\
\;\;\;\;\left|\sin ky \cdot \frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-301}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0189999999999999995Initial program 99.7%
associate-*l/99.5%
*-commutative99.5%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 41.6%
*-commutative41.6%
+-commutative41.6%
Simplified41.6%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.2%
sqrt-unprod17.2%
pow217.2%
*-commutative17.2%
associate-*l/17.3%
*-un-lft-identity17.3%
Applied egg-rr17.3%
unpow217.3%
rem-sqrt-square23.2%
Simplified23.2%
if -0.0189999999999999995 < (sin.f64 ky) < 2.00000000000000013e-301Initial program 86.2%
+-commutative86.2%
unpow286.2%
unpow286.2%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef86.2%
unpow286.2%
unpow286.2%
+-commutative86.2%
unpow286.2%
unpow286.2%
hypot-def99.7%
Applied egg-rr99.7%
frac-2neg99.7%
div-inv99.6%
distribute-neg-frac99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 55.4%
*-lft-identity55.4%
times-frac58.2%
/-rgt-identity58.2%
Simplified58.2%
if 2.00000000000000013e-301 < (sin.f64 ky) < 4.0000000000000001e-8Initial program 93.1%
Taylor expanded in ky around 0 44.2%
add-sqr-sqrt34.6%
sqrt-unprod57.4%
pow257.4%
Applied egg-rr57.4%
unpow257.4%
rem-sqrt-square73.2%
Simplified73.2%
Taylor expanded in ky around 0 73.2%
if 4.0000000000000001e-8 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.3%
Final simplification53.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.07)
(fabs (* (sin ky) (/ th (sin ky))))
(if (<= (sin ky) -1e-297)
(* (sin th) (/ (sin ky) (sin kx)))
(if (<= (sin ky) 4e-8) (* (sin th) (fabs (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.07) {
tmp = fabs((sin(ky) * (th / sin(ky))));
} else if (sin(ky) <= -1e-297) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 4e-8) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.07d0)) then
tmp = abs((sin(ky) * (th / sin(ky))))
else if (sin(ky) <= (-1d-297)) then
tmp = sin(th) * (sin(ky) / sin(kx))
else if (sin(ky) <= 4d-8) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.07) {
tmp = Math.abs((Math.sin(ky) * (th / Math.sin(ky))));
} else if (Math.sin(ky) <= -1e-297) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(ky) <= 4e-8) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.07: tmp = math.fabs((math.sin(ky) * (th / math.sin(ky)))) elif math.sin(ky) <= -1e-297: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(ky) <= 4e-8: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.07) tmp = abs(Float64(sin(ky) * Float64(th / sin(ky)))); elseif (sin(ky) <= -1e-297) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 4e-8) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.07) tmp = abs((sin(ky) * (th / sin(ky)))); elseif (sin(ky) <= -1e-297) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(ky) <= 4e-8) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.07], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-297], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-8], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.07:\\
\;\;\;\;\left|\sin ky \cdot \frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-297}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.070000000000000007Initial program 99.7%
associate-*l/99.5%
*-commutative99.5%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 43.3%
*-commutative43.3%
+-commutative43.3%
Simplified43.3%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.2%
sqrt-unprod17.9%
pow217.9%
*-commutative17.9%
associate-*l/17.9%
*-un-lft-identity17.9%
Applied egg-rr17.9%
unpow217.9%
rem-sqrt-square24.1%
Simplified24.1%
if -0.070000000000000007 < (sin.f64 ky) < -1.00000000000000004e-297Initial program 87.9%
Taylor expanded in ky around 0 54.4%
if -1.00000000000000004e-297 < (sin.f64 ky) < 4.0000000000000001e-8Initial program 90.9%
Taylor expanded in ky around 0 48.2%
add-sqr-sqrt38.2%
sqrt-unprod58.1%
pow258.1%
Applied egg-rr58.1%
unpow258.1%
rem-sqrt-square76.1%
Simplified76.1%
Taylor expanded in ky around 0 76.1%
if 4.0000000000000001e-8 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.3%
Final simplification54.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.07)
(fabs (* (sin ky) (/ th (sin ky))))
(if (<= (sin ky) 2e-301)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 4e-8) (* (sin th) (fabs (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.07) {
tmp = fabs((sin(ky) * (th / sin(ky))));
} else if (sin(ky) <= 2e-301) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 4e-8) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.07d0)) then
tmp = abs((sin(ky) * (th / sin(ky))))
else if (sin(ky) <= 2d-301) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(ky) <= 4d-8) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.07) {
tmp = Math.abs((Math.sin(ky) * (th / Math.sin(ky))));
} else if (Math.sin(ky) <= 2e-301) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 4e-8) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.07: tmp = math.fabs((math.sin(ky) * (th / math.sin(ky)))) elif math.sin(ky) <= 2e-301: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 4e-8: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.07) tmp = abs(Float64(sin(ky) * Float64(th / sin(ky)))); elseif (sin(ky) <= 2e-301) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 4e-8) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.07) tmp = abs((sin(ky) * (th / sin(ky)))); elseif (sin(ky) <= 2e-301) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 4e-8) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.07], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-301], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-8], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.07:\\
\;\;\;\;\left|\sin ky \cdot \frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-301}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.070000000000000007Initial program 99.7%
associate-*l/99.5%
*-commutative99.5%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 43.3%
*-commutative43.3%
+-commutative43.3%
Simplified43.3%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.2%
sqrt-unprod17.9%
pow217.9%
*-commutative17.9%
associate-*l/17.9%
*-un-lft-identity17.9%
Applied egg-rr17.9%
unpow217.9%
rem-sqrt-square24.1%
Simplified24.1%
if -0.070000000000000007 < (sin.f64 ky) < 2.00000000000000013e-301Initial program 86.7%
associate-*l/79.4%
*-commutative79.4%
associate-*l/86.8%
+-commutative86.8%
unpow286.8%
unpow286.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 56.6%
if 2.00000000000000013e-301 < (sin.f64 ky) < 4.0000000000000001e-8Initial program 93.1%
Taylor expanded in ky around 0 44.2%
add-sqr-sqrt34.6%
sqrt-unprod57.4%
pow257.4%
Applied egg-rr57.4%
unpow257.4%
rem-sqrt-square73.2%
Simplified73.2%
Taylor expanded in ky around 0 73.2%
if 4.0000000000000001e-8 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.3%
Final simplification53.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -5e-52)
(* (sin ky) (* th (fabs (/ 1.0 (sin ky)))))
(if (<= (sin ky) 2e-301)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) 4e-8) (* (sin th) (fabs (/ ky (sin kx)))) (sin th)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-52) {
tmp = sin(ky) * (th * fabs((1.0 / sin(ky))));
} else if (sin(ky) <= 2e-301) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= 4e-8) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-5d-52)) then
tmp = sin(ky) * (th * abs((1.0d0 / sin(ky))))
else if (sin(ky) <= 2d-301) then
tmp = ky * (sin(th) / sin(kx))
else if (sin(ky) <= 4d-8) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-52) {
tmp = Math.sin(ky) * (th * Math.abs((1.0 / Math.sin(ky))));
} else if (Math.sin(ky) <= 2e-301) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 4e-8) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-52: tmp = math.sin(ky) * (th * math.fabs((1.0 / math.sin(ky)))) elif math.sin(ky) <= 2e-301: tmp = ky * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 4e-8: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-52) tmp = Float64(sin(ky) * Float64(th * abs(Float64(1.0 / sin(ky))))); elseif (sin(ky) <= 2e-301) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 4e-8) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-52) tmp = sin(ky) * (th * abs((1.0 / sin(ky)))); elseif (sin(ky) <= 2e-301) tmp = ky * (sin(th) / sin(kx)); elseif (sin(ky) <= 4e-8) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-52], N[(N[Sin[ky], $MachinePrecision] * N[(th * N[Abs[N[(1.0 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-301], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-8], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-52}:\\
\;\;\;\;\sin ky \cdot \left(th \cdot \left|\frac{1}{\sin ky}\right|\right)\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-301}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5e-52Initial program 99.6%
associate-*l/96.1%
*-commutative96.1%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 43.6%
*-commutative43.6%
+-commutative43.6%
Simplified43.6%
Taylor expanded in kx around 0 3.2%
add-sqr-sqrt0.0%
sqrt-unprod31.2%
inv-pow31.2%
inv-pow31.2%
pow-prod-up31.2%
metadata-eval31.2%
Applied egg-rr31.2%
metadata-eval31.2%
pow-sqr31.2%
unpow-131.2%
unpow-131.2%
rem-sqrt-square31.2%
Simplified31.2%
if -5e-52 < (sin.f64 ky) < 2.00000000000000013e-301Initial program 83.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.7%
hypot-udef83.7%
unpow283.7%
unpow283.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-def99.7%
Applied egg-rr99.7%
frac-2neg99.7%
div-inv99.7%
distribute-neg-frac99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 61.1%
*-lft-identity61.1%
times-frac64.7%
/-rgt-identity64.7%
Simplified64.7%
if 2.00000000000000013e-301 < (sin.f64 ky) < 4.0000000000000001e-8Initial program 93.1%
Taylor expanded in ky around 0 44.2%
add-sqr-sqrt34.6%
sqrt-unprod57.4%
pow257.4%
Applied egg-rr57.4%
unpow257.4%
rem-sqrt-square73.2%
Simplified73.2%
Taylor expanded in ky around 0 73.2%
if 4.0000000000000001e-8 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 63.3%
Final simplification56.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.002)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin th) 1e-15)
(* th (/ (sin ky) (hypot (sin kx) (sin ky))))
(/ (sin ky) (fabs (/ (sin kx) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.002) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(th) <= 1e-15) {
tmp = th * (sin(ky) / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(ky) / fabs((sin(kx) / sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.002) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(th) <= 1e-15) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(ky) / Math.abs((Math.sin(kx) / Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.002: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(th) <= 1e-15: tmp = th * (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(ky) / math.fabs((math.sin(kx) / math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.002) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(th) <= 1e-15) tmp = Float64(th * Float64(sin(ky) / hypot(sin(kx), sin(ky)))); else tmp = Float64(sin(ky) / abs(Float64(sin(kx) / sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.002) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(th) <= 1e-15) tmp = th * (sin(ky) / hypot(sin(kx), sin(ky))); else tmp = sin(ky) / abs((sin(kx) / sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.002], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 1e-15], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.002:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin th \leq 10^{-15}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 th) < -2e-3Initial program 92.3%
associate-*l/92.3%
*-commutative92.3%
associate-*l/92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 21.0%
if -2e-3 < (sin.f64 th) < 1.0000000000000001e-15Initial program 96.0%
associate-*l/89.6%
*-commutative89.6%
associate-*l/96.0%
+-commutative96.0%
unpow296.0%
unpow296.0%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 95.4%
*-commutative95.4%
+-commutative95.4%
Simplified95.4%
expm1-log1p-u95.3%
expm1-udef25.3%
Applied egg-rr25.5%
expm1-def99.7%
expm1-log1p99.7%
Simplified99.7%
if 1.0000000000000001e-15 < (sin.f64 th) Initial program 95.0%
Taylor expanded in ky around 0 23.0%
associate-*l/23.1%
associate-/l*23.0%
Applied egg-rr23.0%
add-sqr-sqrt21.8%
sqrt-unprod38.9%
pow238.9%
Applied egg-rr38.9%
unpow238.9%
rem-sqrt-square39.5%
Simplified39.5%
Final simplification61.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.002)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin th) 1e-15)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(/ (sin ky) (fabs (/ (sin kx) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.002) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(th) <= 1e-15) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(ky) / fabs((sin(kx) / sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.002) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(th) <= 1e-15) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(ky) / Math.abs((Math.sin(kx) / Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.002: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(th) <= 1e-15: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(ky) / math.fabs((math.sin(kx) / math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.002) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(th) <= 1e-15) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(ky) / abs(Float64(sin(kx) / sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.002) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(th) <= 1e-15) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(ky) / abs((sin(kx) / sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.002], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 1e-15], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.002:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin th \leq 10^{-15}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 th) < -2e-3Initial program 92.3%
associate-*l/92.3%
*-commutative92.3%
associate-*l/92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 21.0%
if -2e-3 < (sin.f64 th) < 1.0000000000000001e-15Initial program 96.0%
associate-*l/89.6%
*-commutative89.6%
associate-*l/96.0%
+-commutative96.0%
unpow296.0%
unpow296.0%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 95.4%
*-commutative95.4%
+-commutative95.4%
Simplified95.4%
add-log-exp25.4%
*-commutative25.4%
exp-prod25.4%
*-commutative25.4%
sqrt-div25.4%
metadata-eval25.4%
+-commutative25.4%
unpow225.4%
unpow225.4%
hypot-udef25.4%
un-div-inv25.4%
Applied egg-rr25.4%
log-pow68.8%
hypot-def68.5%
unpow268.5%
unpow268.5%
+-commutative68.5%
unpow268.5%
unpow268.5%
hypot-def68.8%
rem-log-exp99.7%
Simplified99.7%
if 1.0000000000000001e-15 < (sin.f64 th) Initial program 95.0%
Taylor expanded in ky around 0 23.0%
associate-*l/23.1%
associate-/l*23.0%
Applied egg-rr23.0%
add-sqr-sqrt21.8%
sqrt-unprod38.9%
pow238.9%
Applied egg-rr38.9%
unpow238.9%
rem-sqrt-square39.5%
Simplified39.5%
Final simplification61.9%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.002)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin th) 1e-15)
(/ th (/ (hypot (sin ky) (sin kx)) (sin ky)))
(/ (sin ky) (fabs (/ (sin kx) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.002) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(th) <= 1e-15) {
tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky));
} else {
tmp = sin(ky) / fabs((sin(kx) / sin(th)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.002) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(th) <= 1e-15) {
tmp = th / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
} else {
tmp = Math.sin(ky) / Math.abs((Math.sin(kx) / Math.sin(th)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.002: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(th) <= 1e-15: tmp = th / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky)) else: tmp = math.sin(ky) / math.fabs((math.sin(kx) / math.sin(th))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.002) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(th) <= 1e-15) tmp = Float64(th / Float64(hypot(sin(ky), sin(kx)) / sin(ky))); else tmp = Float64(sin(ky) / abs(Float64(sin(kx) / sin(th)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.002) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(th) <= 1e-15) tmp = th / (hypot(sin(ky), sin(kx)) / sin(ky)); else tmp = sin(ky) / abs((sin(kx) / sin(th))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.002], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 1e-15], N[(th / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.002:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin th \leq 10^{-15}:\\
\;\;\;\;\frac{th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\end{array}
\end{array}
if (sin.f64 th) < -2e-3Initial program 92.3%
associate-*l/92.3%
*-commutative92.3%
associate-*l/92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 21.0%
if -2e-3 < (sin.f64 th) < 1.0000000000000001e-15Initial program 96.0%
associate-*l/89.6%
*-commutative89.6%
associate-*l/96.0%
+-commutative96.0%
unpow296.0%
unpow296.0%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 95.4%
*-commutative95.4%
+-commutative95.4%
Simplified95.4%
expm1-log1p-u95.3%
expm1-udef25.3%
Applied egg-rr25.5%
expm1-def99.7%
expm1-log1p99.7%
associate-*r/89.7%
associate-/l*99.7%
hypot-def96.0%
unpow296.0%
unpow296.0%
+-commutative96.0%
unpow296.0%
unpow296.0%
hypot-def99.7%
Simplified99.7%
if 1.0000000000000001e-15 < (sin.f64 th) Initial program 95.0%
Taylor expanded in ky around 0 23.0%
associate-*l/23.1%
associate-/l*23.0%
Applied egg-rr23.0%
add-sqr-sqrt21.8%
sqrt-unprod38.9%
pow238.9%
Applied egg-rr38.9%
unpow238.9%
rem-sqrt-square39.5%
Simplified39.5%
Final simplification61.9%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.019) (fabs (* (sin ky) (/ th (sin ky)))) (if (<= (sin ky) 2e-149) (* ky (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.019) {
tmp = fabs((sin(ky) * (th / sin(ky))));
} else if (sin(ky) <= 2e-149) {
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.019d0)) then
tmp = abs((sin(ky) * (th / sin(ky))))
else if (sin(ky) <= 2d-149) 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.019) {
tmp = Math.abs((Math.sin(ky) * (th / Math.sin(ky))));
} else if (Math.sin(ky) <= 2e-149) {
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.019: tmp = math.fabs((math.sin(ky) * (th / math.sin(ky)))) elif math.sin(ky) <= 2e-149: 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.019) tmp = abs(Float64(sin(ky) * Float64(th / sin(ky)))); elseif (sin(ky) <= 2e-149) 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.019) tmp = abs((sin(ky) * (th / sin(ky)))); elseif (sin(ky) <= 2e-149) 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.019], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-149], 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.019:\\
\;\;\;\;\left|\sin ky \cdot \frac{th}{\sin ky}\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-149}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0189999999999999995Initial program 99.7%
associate-*l/99.5%
*-commutative99.5%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 41.6%
*-commutative41.6%
+-commutative41.6%
Simplified41.6%
Taylor expanded in kx around 0 2.9%
add-sqr-sqrt1.2%
sqrt-unprod17.2%
pow217.2%
*-commutative17.2%
associate-*l/17.3%
*-un-lft-identity17.3%
Applied egg-rr17.3%
unpow217.3%
rem-sqrt-square23.2%
Simplified23.2%
if -0.0189999999999999995 < (sin.f64 ky) < 1.99999999999999996e-149Initial program 86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.6%
hypot-udef86.0%
unpow286.0%
unpow286.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.6%
Applied egg-rr99.6%
frac-2neg99.6%
div-inv99.6%
distribute-neg-frac99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 58.7%
*-lft-identity58.7%
times-frac60.8%
/-rgt-identity60.8%
Simplified60.8%
if 1.99999999999999996e-149 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 57.7%
Final simplification49.9%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-149) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-149) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-149) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-149) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-149: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-149) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-149) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-149], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-149}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.99999999999999996e-149Initial program 91.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
hypot-udef91.6%
unpow291.6%
unpow291.6%
+-commutative91.6%
unpow291.6%
unpow291.6%
hypot-def99.7%
Applied egg-rr99.7%
frac-2neg99.7%
div-inv99.6%
distribute-neg-frac99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 35.6%
*-lft-identity35.6%
times-frac36.8%
/-rgt-identity36.8%
Simplified36.8%
if 1.99999999999999996e-149 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 57.7%
Final simplification44.7%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -0.018) (not (<= ky 3.7e-149))) (sin th) (* ky (/ th (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -0.018) || !(ky <= 3.7e-149)) {
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 ((ky <= (-0.018d0)) .or. (.not. (ky <= 3.7d-149))) 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 ((ky <= -0.018) || !(ky <= 3.7e-149)) {
tmp = Math.sin(th);
} else {
tmp = ky * (th / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -0.018) or not (ky <= 3.7e-149): tmp = math.sin(th) else: tmp = ky * (th / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -0.018) || !(ky <= 3.7e-149)) 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 ((ky <= -0.018) || ~((ky <= 3.7e-149))) tmp = sin(th); else tmp = ky * (th / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -0.018], N[Not[LessEqual[ky, 3.7e-149]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.018 \lor \neg \left(ky \leq 3.7 \cdot 10^{-149}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\end{array}
\end{array}
if ky < -0.0179999999999999986 or 3.6999999999999999e-149 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 34.7%
if -0.0179999999999999986 < ky < 3.6999999999999999e-149Initial program 85.7%
associate-*l/79.3%
*-commutative79.3%
associate-*l/85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 50.4%
*-commutative50.4%
+-commutative50.4%
Simplified50.4%
Taylor expanded in ky around 0 37.6%
associate-/l*39.6%
Simplified39.6%
Taylor expanded in ky around 0 37.6%
associate-*r/39.6%
Simplified39.6%
Final simplification36.5%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -0.018) (not (<= ky 5.6e-149))) (sin th) (* th (/ ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -0.018) || !(ky <= 5.6e-149)) {
tmp = sin(th);
} else {
tmp = th * (ky / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-0.018d0)) .or. (.not. (ky <= 5.6d-149))) then
tmp = sin(th)
else
tmp = th * (ky / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -0.018) || !(ky <= 5.6e-149)) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -0.018) or not (ky <= 5.6e-149): tmp = math.sin(th) else: tmp = th * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -0.018) || !(ky <= 5.6e-149)) tmp = sin(th); else tmp = Float64(th * Float64(ky / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -0.018) || ~((ky <= 5.6e-149))) tmp = sin(th); else tmp = th * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -0.018], N[Not[LessEqual[ky, 5.6e-149]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(th * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -0.018 \lor \neg \left(ky \leq 5.6 \cdot 10^{-149}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if ky < -0.0179999999999999986 or 5.5999999999999997e-149 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 34.7%
if -0.0179999999999999986 < ky < 5.5999999999999997e-149Initial program 85.7%
associate-*l/79.3%
*-commutative79.3%
associate-*l/85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 50.4%
*-commutative50.4%
+-commutative50.4%
Simplified50.4%
Taylor expanded in ky around 0 37.6%
associate-/l*39.6%
Simplified39.6%
associate-/r/39.7%
Applied egg-rr39.7%
Final simplification36.5%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -1.56e-19) (not (<= ky 2.1e-149))) (sin th) (* th (/ ky kx))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1.56e-19) || !(ky <= 2.1e-149)) {
tmp = sin(th);
} else {
tmp = th * (ky / kx);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-1.56d-19)) .or. (.not. (ky <= 2.1d-149))) then
tmp = sin(th)
else
tmp = th * (ky / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1.56e-19) || !(ky <= 2.1e-149)) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -1.56e-19) or not (ky <= 2.1e-149): tmp = math.sin(th) else: tmp = th * (ky / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -1.56e-19) || !(ky <= 2.1e-149)) tmp = sin(th); else tmp = Float64(th * Float64(ky / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -1.56e-19) || ~((ky <= 2.1e-149))) tmp = sin(th); else tmp = th * (ky / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -1.56e-19], N[Not[LessEqual[ky, 2.1e-149]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.56 \cdot 10^{-19} \lor \neg \left(ky \leq 2.1 \cdot 10^{-149}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\end{array}
\end{array}
if ky < -1.56000000000000003e-19 or 2.10000000000000011e-149 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 34.3%
if -1.56000000000000003e-19 < ky < 2.10000000000000011e-149Initial program 85.4%
associate-*l/78.9%
*-commutative78.9%
associate-*l/85.4%
+-commutative85.4%
unpow285.4%
unpow285.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 51.5%
*-commutative51.5%
+-commutative51.5%
Simplified51.5%
Taylor expanded in ky around 0 38.3%
associate-/l*40.4%
Simplified40.4%
Taylor expanded in kx around 0 34.8%
associate-/r/34.9%
Applied egg-rr34.9%
Final simplification34.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky -7e-20) th (if (<= ky 9.5e-89) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -7e-20) {
tmp = th;
} else if (ky <= 9.5e-89) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-7d-20)) then
tmp = th
else if (ky <= 9.5d-89) then
tmp = th * (ky / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -7e-20) {
tmp = th;
} else if (ky <= 9.5e-89) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -7e-20: tmp = th elif ky <= 9.5e-89: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -7e-20) tmp = th; elseif (ky <= 9.5e-89) tmp = Float64(th * Float64(ky / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -7e-20) tmp = th; elseif (ky <= 9.5e-89) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -7e-20], th, If[LessEqual[ky, 9.5e-89], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -7 \cdot 10^{-20}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 9.5 \cdot 10^{-89}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -7.00000000000000007e-20 or 9.50000000000000028e-89 < ky Initial program 99.7%
associate-*l/99.1%
*-commutative99.1%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 44.5%
*-commutative44.5%
+-commutative44.5%
Simplified44.5%
Taylor expanded in kx around 0 16.9%
if -7.00000000000000007e-20 < ky < 9.50000000000000028e-89Initial program 86.8%
associate-*l/80.0%
*-commutative80.0%
associate-*l/86.9%
+-commutative86.9%
unpow286.9%
unpow286.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 49.7%
*-commutative49.7%
+-commutative49.7%
Simplified49.7%
Taylor expanded in ky around 0 35.7%
associate-/l*37.6%
Simplified37.6%
Taylor expanded in kx around 0 32.8%
associate-/r/32.9%
Applied egg-rr32.9%
Final simplification23.2%
(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.6%
associate-*l/91.6%
*-commutative91.6%
associate-*l/94.6%
+-commutative94.6%
unpow294.6%
unpow294.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 46.5%
*-commutative46.5%
+-commutative46.5%
Simplified46.5%
Taylor expanded in kx around 0 13.1%
Final simplification13.1%
herbie shell --seed 2023310
(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)))