
(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 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.12)
(/ (/ (sin ky) t_1) (+ (/ 1.0 th) (* th 0.16666666666666666)))
(if (<= (sin ky) 0.01)
(/ (/ (sin th) t_1) (+ (* ky 0.16666666666666666) (/ 1.0 ky)))
(sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.12) {
tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (sin(ky) <= 0.01) {
tmp = (sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.12) {
tmp = (Math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (Math.sin(ky) <= 0.01) {
tmp = (Math.sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.12: tmp = (math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)) elif math.sin(ky) <= 0.01: tmp = (math.sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.12) tmp = Float64(Float64(sin(ky) / t_1) / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); elseif (sin(ky) <= 0.01) tmp = Float64(Float64(sin(th) / t_1) / Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.12) tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)); elseif (sin(ky) <= 0.01) tmp = (sin(th) / t_1) / ((ky * 0.16666666666666666) + (1.0 / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.12], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.01], N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.12:\\
\;\;\;\;\frac{\frac{\sin ky}{t_1}}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{elif}\;\sin ky \leq 0.01:\\
\;\;\;\;\frac{\frac{\sin th}{t_1}}{ky \cdot 0.16666666666666666 + \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.12Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
associate-/r/99.7%
div-inv99.4%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 57.5%
*-commutative57.5%
Simplified57.5%
if -0.12 < (sin.f64 ky) < 0.0100000000000000002Initial program 86.9%
+-commutative86.9%
unpow286.9%
unpow286.9%
hypot-def99.7%
Simplified99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
associate-*l/99.7%
*-un-lft-identity99.7%
div-inv99.6%
associate-/r*99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 96.0%
if 0.0100000000000000002 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 57.8%
Final simplification75.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.12)
(* (/ (sin ky) t_1) th)
(if (<= (sin ky) 0.01) (/ (/ (sin th) t_1) (/ 1.0 ky)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.12) {
tmp = (sin(ky) / t_1) * th;
} else if (sin(ky) <= 0.01) {
tmp = (sin(th) / t_1) / (1.0 / ky);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.12) {
tmp = (Math.sin(ky) / t_1) * th;
} else if (Math.sin(ky) <= 0.01) {
tmp = (Math.sin(th) / t_1) / (1.0 / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.12: tmp = (math.sin(ky) / t_1) * th elif math.sin(ky) <= 0.01: tmp = (math.sin(th) / t_1) / (1.0 / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.12) tmp = Float64(Float64(sin(ky) / t_1) * th); elseif (sin(ky) <= 0.01) tmp = Float64(Float64(sin(th) / t_1) / Float64(1.0 / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.12) tmp = (sin(ky) / t_1) * th; elseif (sin(ky) <= 0.01) tmp = (sin(th) / t_1) / (1.0 / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.12], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.01], N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(1.0 / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.12:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;\sin ky \leq 0.01:\\
\;\;\;\;\frac{\frac{\sin th}{t_1}}{\frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.12Initial program 99.7%
associate-/r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 57.1%
associate-*r/57.3%
unpow257.3%
unpow257.3%
hypot-def57.2%
*-rgt-identity57.2%
hypot-def57.3%
unpow257.3%
unpow257.3%
+-commutative57.3%
unpow257.3%
unpow257.3%
hypot-def57.2%
Simplified57.2%
associate-/r/57.3%
hypot-udef57.3%
+-commutative57.3%
hypot-udef57.3%
Applied egg-rr57.3%
if -0.12 < (sin.f64 ky) < 0.0100000000000000002Initial program 86.9%
+-commutative86.9%
unpow286.9%
unpow286.9%
hypot-def99.7%
Simplified99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
associate-*l/99.7%
*-un-lft-identity99.7%
div-inv99.6%
associate-/r*99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 95.7%
if 0.0100000000000000002 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 57.8%
Final simplification75.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.005)
(/ (/ (sin ky) t_1) (+ (/ 1.0 th) (* th 0.16666666666666666)))
(if (<= (sin ky) 0.01) (/ (/ (sin th) t_1) (/ 1.0 ky)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.005) {
tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (sin(ky) <= 0.01) {
tmp = (sin(th) / t_1) / (1.0 / ky);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.005) {
tmp = (Math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (Math.sin(ky) <= 0.01) {
tmp = (Math.sin(th) / t_1) / (1.0 / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.005: tmp = (math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)) elif math.sin(ky) <= 0.01: tmp = (math.sin(th) / t_1) / (1.0 / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.005) tmp = Float64(Float64(sin(ky) / t_1) / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); elseif (sin(ky) <= 0.01) tmp = Float64(Float64(sin(th) / t_1) / Float64(1.0 / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.005) tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)); elseif (sin(ky) <= 0.01) tmp = (sin(th) / t_1) / (1.0 / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.005], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.01], N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(1.0 / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.005:\\
\;\;\;\;\frac{\frac{\sin ky}{t_1}}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{elif}\;\sin ky \leq 0.01:\\
\;\;\;\;\frac{\frac{\sin th}{t_1}}{\frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0050000000000000001Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
associate-/r/99.7%
div-inv99.4%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in th around 0 54.4%
*-commutative54.4%
Simplified54.4%
if -0.0050000000000000001 < (sin.f64 ky) < 0.0100000000000000002Initial program 86.5%
+-commutative86.5%
unpow286.5%
unpow286.5%
hypot-def99.7%
Simplified99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
associate-*l/99.7%
*-un-lft-identity99.7%
div-inv99.6%
associate-/r*99.4%
Applied egg-rr99.4%
Taylor expanded in ky around 0 99.0%
if 0.0100000000000000002 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 57.8%
Final simplification75.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.12)
(* (/ (sin ky) t_1) th)
(if (<= (sin ky) 0.01) (/ (* ky (sin th)) t_1) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.12) {
tmp = (sin(ky) / t_1) * th;
} else if (sin(ky) <= 0.01) {
tmp = (ky * sin(th)) / t_1;
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.12) {
tmp = (Math.sin(ky) / t_1) * th;
} else if (Math.sin(ky) <= 0.01) {
tmp = (ky * Math.sin(th)) / t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.12: tmp = (math.sin(ky) / t_1) * th elif math.sin(ky) <= 0.01: tmp = (ky * math.sin(th)) / t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.12) tmp = Float64(Float64(sin(ky) / t_1) * th); elseif (sin(ky) <= 0.01) tmp = Float64(Float64(ky * sin(th)) / t_1); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.12) tmp = (sin(ky) / t_1) * th; elseif (sin(ky) <= 0.01) tmp = (ky * sin(th)) / t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.12], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.01], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.12:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;\sin ky \leq 0.01:\\
\;\;\;\;\frac{ky \cdot \sin th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.12Initial program 99.7%
associate-/r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 57.1%
associate-*r/57.3%
unpow257.3%
unpow257.3%
hypot-def57.2%
*-rgt-identity57.2%
hypot-def57.3%
unpow257.3%
unpow257.3%
+-commutative57.3%
unpow257.3%
unpow257.3%
hypot-def57.2%
Simplified57.2%
associate-/r/57.3%
hypot-udef57.3%
+-commutative57.3%
hypot-udef57.3%
Applied egg-rr57.3%
if -0.12 < (sin.f64 ky) < 0.0100000000000000002Initial program 86.9%
associate-*l/83.8%
+-commutative83.8%
unpow283.8%
unpow283.8%
hypot-def94.6%
Simplified94.6%
Taylor expanded in ky around 0 90.9%
if 0.0100000000000000002 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 57.8%
Final simplification72.9%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 93.8%
associate-*l/92.3%
associate-*r/93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= th -0.012)
(/ (* (sin ky) (sin th)) (sin kx))
(if (<= th 0.19)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= -0.012) {
tmp = (sin(ky) * sin(th)) / sin(kx);
} else if (th <= 0.19) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= -0.012) {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(kx);
} else if (th <= 0.19) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= -0.012: tmp = (math.sin(ky) * math.sin(th)) / math.sin(kx) elif th <= 0.19: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= -0.012) tmp = Float64(Float64(sin(ky) * sin(th)) / sin(kx)); elseif (th <= 0.19) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); 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 (th <= -0.012) tmp = (sin(ky) * sin(th)) / sin(kx); elseif (th <= 0.19) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, -0.012], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 0.19], 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[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq -0.012:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin kx}\\
\mathbf{elif}\;th \leq 0.19:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if th < -0.012Initial program 87.9%
associate-*l/87.8%
+-commutative87.8%
unpow287.8%
unpow287.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 21.3%
if -0.012 < th < 0.19Initial program 96.9%
associate-/r/96.8%
+-commutative96.8%
unpow296.8%
unpow296.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 95.4%
associate-*r/95.6%
unpow295.6%
unpow295.6%
hypot-def98.5%
*-rgt-identity98.5%
hypot-def95.6%
unpow295.6%
unpow295.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def98.5%
Simplified98.5%
clear-num97.9%
associate-/r/98.4%
clear-num98.5%
hypot-udef95.6%
+-commutative95.6%
hypot-udef98.5%
Applied egg-rr98.5%
if 0.19 < th Initial program 94.9%
associate-*l/94.7%
associate-*r/94.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 16.7%
Final simplification57.0%
(FPCore (kx ky th)
:precision binary64
(if (<= th -0.0058)
(/ (* (sin ky) (sin th)) (sin kx))
(if (<= th 0.05)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= -0.0058) {
tmp = (sin(ky) * sin(th)) / sin(kx);
} else if (th <= 0.05) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= -0.0058) {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(kx);
} else if (th <= 0.05) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= -0.0058: tmp = (math.sin(ky) * math.sin(th)) / math.sin(kx) elif th <= 0.05: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= -0.0058) tmp = Float64(Float64(sin(ky) * sin(th)) / sin(kx)); elseif (th <= 0.05) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); 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 (th <= -0.0058) tmp = (sin(ky) * sin(th)) / sin(kx); elseif (th <= 0.05) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, -0.0058], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 0.05], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $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}\;th \leq -0.0058:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin kx}\\
\mathbf{elif}\;th \leq 0.05:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if th < -0.0058Initial program 87.9%
associate-*l/87.8%
+-commutative87.8%
unpow287.8%
unpow287.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 21.3%
if -0.0058 < th < 0.050000000000000003Initial program 96.9%
associate-/r/96.8%
+-commutative96.8%
unpow296.8%
unpow296.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 95.4%
associate-*r/95.6%
unpow295.6%
unpow295.6%
hypot-def98.5%
*-rgt-identity98.5%
hypot-def95.6%
unpow295.6%
unpow295.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def98.5%
Simplified98.5%
associate-/r/98.6%
hypot-udef95.7%
+-commutative95.7%
hypot-udef98.6%
Applied egg-rr98.6%
if 0.050000000000000003 < th Initial program 94.9%
associate-*l/94.7%
associate-*r/94.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 16.7%
Final simplification57.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-99) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-99) {
tmp = sin(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) <= 1d-99) then
tmp = sin(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) <= 1e-99) {
tmp = Math.sin(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) <= 1e-99: tmp = math.sin(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) <= 1e-99) tmp = Float64(sin(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) <= 1e-99) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-99], N[(N[Sin[ky], $MachinePrecision] * 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 10^{-99}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-99Initial program 91.0%
associate-*l/88.9%
associate-*r/91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 32.2%
if 1e-99 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 56.4%
Final simplification40.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-99) (* (sin ky) (/ (sin th) (sin kx))) (/ (* (sin ky) (sin th)) (sin ky))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-99) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = (sin(ky) * sin(th)) / sin(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) <= 1d-99) then
tmp = sin(ky) * (sin(th) / sin(kx))
else
tmp = (sin(ky) * sin(th)) / sin(ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-99) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-99: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = (math.sin(ky) * math.sin(th)) / math.sin(ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-99) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-99) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = (sin(ky) * sin(th)) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-99], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-99}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-99Initial program 91.0%
associate-*l/88.9%
associate-*r/91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 32.2%
if 1e-99 < (sin.f64 ky) Initial program 99.7%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 57.3%
Final simplification40.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-99) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-99) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-99) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-99) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-99: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-99) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-99) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-99], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-99}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-99Initial program 91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 30.8%
if 1e-99 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 56.4%
Final simplification39.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-99) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-99) {
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) <= 1d-99) 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) <= 1e-99) {
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) <= 1e-99: 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) <= 1e-99) 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) <= 1e-99) 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], 1e-99], 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 10^{-99}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-99Initial program 91.0%
+-commutative91.0%
unpow291.0%
unpow291.0%
hypot-def99.7%
Simplified99.7%
associate-/r/99.7%
div-inv99.4%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 30.1%
associate-/l*30.8%
associate-/r/30.8%
Simplified30.8%
if 1e-99 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 56.4%
Final simplification39.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-132) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-132) {
tmp = sin(th) * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-132) then
tmp = sin(th) * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-132) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-132: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-132) tmp = Float64(sin(th) * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-132) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-132], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-132}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2e-132Initial program 90.6%
+-commutative90.6%
unpow290.6%
unpow290.6%
hypot-def99.7%
Simplified99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
Simplified99.6%
Taylor expanded in ky around 0 30.3%
Taylor expanded in kx around 0 23.1%
if 2e-132 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 55.0%
Final simplification34.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky -3.1) (sin th) (if (<= ky 1.05e-209) (/ th (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -3.1) {
tmp = sin(th);
} else if (ky <= 1.05e-209) {
tmp = th / (kx / ky);
} 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.1d0)) then
tmp = sin(th)
else if (ky <= 1.05d-209) then
tmp = th / (kx / ky)
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.1) {
tmp = Math.sin(th);
} else if (ky <= 1.05e-209) {
tmp = th / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -3.1: tmp = math.sin(th) elif ky <= 1.05e-209: tmp = th / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -3.1) tmp = sin(th); elseif (ky <= 1.05e-209) tmp = Float64(th / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -3.1) tmp = sin(th); elseif (ky <= 1.05e-209) tmp = th / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -3.1], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.05e-209], N[(th / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.1:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.05 \cdot 10^{-209}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -3.10000000000000009 or 1.04999999999999998e-209 < ky Initial program 96.9%
+-commutative96.9%
unpow296.9%
unpow296.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 31.7%
if -3.10000000000000009 < ky < 1.04999999999999998e-209Initial program 87.2%
associate-/r/87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 47.5%
associate-*r/47.6%
unpow247.6%
unpow247.6%
hypot-def50.7%
*-rgt-identity50.7%
hypot-def47.6%
unpow247.6%
unpow247.6%
+-commutative47.6%
unpow247.6%
unpow247.6%
hypot-def50.7%
Simplified50.7%
Taylor expanded in ky around 0 35.5%
associate-/l*37.0%
Simplified37.0%
Taylor expanded in kx around 0 30.6%
associate-/l*32.2%
Simplified32.2%
Final simplification31.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky -3.5e-20) th (if (<= ky 1e-21) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -3.5e-20) {
tmp = th;
} else if (ky <= 1e-21) {
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 <= (-3.5d-20)) then
tmp = th
else if (ky <= 1d-21) 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 <= -3.5e-20) {
tmp = th;
} else if (ky <= 1e-21) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -3.5e-20: tmp = th elif ky <= 1e-21: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -3.5e-20) tmp = th; elseif (ky <= 1e-21) 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 <= -3.5e-20) tmp = th; elseif (ky <= 1e-21) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -3.5e-20], th, If[LessEqual[ky, 1e-21], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.5 \cdot 10^{-20}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 10^{-21}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -3.50000000000000003e-20 or 9.99999999999999908e-22 < ky Initial program 99.7%
associate-/r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 50.7%
associate-*r/50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
*-rgt-identity50.8%
hypot-def50.8%
unpow250.8%
unpow250.8%
+-commutative50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
Simplified50.8%
Taylor expanded in kx around 0 15.6%
if -3.50000000000000003e-20 < ky < 9.99999999999999908e-22Initial program 86.0%
associate-/r/86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 42.9%
associate-*r/43.0%
unpow243.0%
unpow243.0%
hypot-def46.2%
*-rgt-identity46.2%
hypot-def43.0%
unpow243.0%
unpow243.0%
+-commutative43.0%
unpow243.0%
unpow243.0%
hypot-def46.2%
Simplified46.2%
Taylor expanded in ky around 0 32.6%
associate-/l*33.7%
Simplified33.7%
Taylor expanded in kx around 0 28.4%
associate-/r/28.5%
Applied egg-rr28.5%
Final simplification21.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1e-19) th (if (<= ky 8.2e-22) (* ky (/ th kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1e-19) {
tmp = th;
} else if (ky <= 8.2e-22) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-1d-19)) then
tmp = th
else if (ky <= 8.2d-22) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1e-19) {
tmp = th;
} else if (ky <= 8.2e-22) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1e-19: tmp = th elif ky <= 8.2e-22: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1e-19) tmp = th; elseif (ky <= 8.2e-22) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1e-19) tmp = th; elseif (ky <= 8.2e-22) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1e-19], th, If[LessEqual[ky, 8.2e-22], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1 \cdot 10^{-19}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 8.2 \cdot 10^{-22}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -9.9999999999999998e-20 or 8.1999999999999999e-22 < ky Initial program 99.7%
associate-/r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 50.7%
associate-*r/50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
*-rgt-identity50.8%
hypot-def50.8%
unpow250.8%
unpow250.8%
+-commutative50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
Simplified50.8%
Taylor expanded in kx around 0 15.6%
if -9.9999999999999998e-20 < ky < 8.1999999999999999e-22Initial program 86.0%
associate-/r/86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 42.9%
associate-*r/43.0%
unpow243.0%
unpow243.0%
hypot-def46.2%
*-rgt-identity46.2%
hypot-def43.0%
unpow243.0%
unpow243.0%
+-commutative43.0%
unpow243.0%
unpow243.0%
hypot-def46.2%
Simplified46.2%
Taylor expanded in ky around 0 32.6%
associate-/l*33.7%
Simplified33.7%
Taylor expanded in kx around 0 28.4%
clear-num28.1%
associate-/r/28.4%
clear-num28.4%
Applied egg-rr28.4%
Final simplification21.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -4.4e-18) th (if (<= ky 8.2e-22) (/ ky (/ kx th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -4.4e-18) {
tmp = th;
} else if (ky <= 8.2e-22) {
tmp = ky / (kx / th);
} 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 <= (-4.4d-18)) then
tmp = th
else if (ky <= 8.2d-22) then
tmp = ky / (kx / th)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -4.4e-18) {
tmp = th;
} else if (ky <= 8.2e-22) {
tmp = ky / (kx / th);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -4.4e-18: tmp = th elif ky <= 8.2e-22: tmp = ky / (kx / th) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -4.4e-18) tmp = th; elseif (ky <= 8.2e-22) tmp = Float64(ky / Float64(kx / th)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -4.4e-18) tmp = th; elseif (ky <= 8.2e-22) tmp = ky / (kx / th); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -4.4e-18], th, If[LessEqual[ky, 8.2e-22], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -4.4 \cdot 10^{-18}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 8.2 \cdot 10^{-22}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -4.3999999999999997e-18 or 8.1999999999999999e-22 < ky Initial program 99.7%
associate-/r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 50.7%
associate-*r/50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
*-rgt-identity50.8%
hypot-def50.8%
unpow250.8%
unpow250.8%
+-commutative50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
Simplified50.8%
Taylor expanded in kx around 0 15.6%
if -4.3999999999999997e-18 < ky < 8.1999999999999999e-22Initial program 86.0%
associate-/r/86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 42.9%
associate-*r/43.0%
unpow243.0%
unpow243.0%
hypot-def46.2%
*-rgt-identity46.2%
hypot-def43.0%
unpow243.0%
unpow243.0%
+-commutative43.0%
unpow243.0%
unpow243.0%
hypot-def46.2%
Simplified46.2%
Taylor expanded in ky around 0 32.6%
associate-/l*33.7%
Simplified33.7%
Taylor expanded in kx around 0 28.4%
Final simplification21.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -4.4e-18) th (if (<= ky 8.2e-22) (/ th (/ kx ky)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -4.4e-18) {
tmp = th;
} else if (ky <= 8.2e-22) {
tmp = th / (kx / ky);
} 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 <= (-4.4d-18)) then
tmp = th
else if (ky <= 8.2d-22) then
tmp = th / (kx / ky)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -4.4e-18) {
tmp = th;
} else if (ky <= 8.2e-22) {
tmp = th / (kx / ky);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -4.4e-18: tmp = th elif ky <= 8.2e-22: tmp = th / (kx / ky) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -4.4e-18) tmp = th; elseif (ky <= 8.2e-22) tmp = Float64(th / Float64(kx / ky)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -4.4e-18) tmp = th; elseif (ky <= 8.2e-22) tmp = th / (kx / ky); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -4.4e-18], th, If[LessEqual[ky, 8.2e-22], N[(th / N[(kx / ky), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -4.4 \cdot 10^{-18}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 8.2 \cdot 10^{-22}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -4.3999999999999997e-18 or 8.1999999999999999e-22 < ky Initial program 99.7%
associate-/r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 50.7%
associate-*r/50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
*-rgt-identity50.8%
hypot-def50.8%
unpow250.8%
unpow250.8%
+-commutative50.8%
unpow250.8%
unpow250.8%
hypot-def50.8%
Simplified50.8%
Taylor expanded in kx around 0 15.6%
if -4.3999999999999997e-18 < ky < 8.1999999999999999e-22Initial program 86.0%
associate-/r/86.0%
+-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 42.9%
associate-*r/43.0%
unpow243.0%
unpow243.0%
hypot-def46.2%
*-rgt-identity46.2%
hypot-def43.0%
unpow243.0%
unpow243.0%
+-commutative43.0%
unpow243.0%
unpow243.0%
hypot-def46.2%
Simplified46.2%
Taylor expanded in ky around 0 32.6%
associate-/l*33.7%
Simplified33.7%
Taylor expanded in kx around 0 27.3%
associate-/l*28.5%
Simplified28.5%
Final simplification21.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 93.8%
associate-/r/93.7%
+-commutative93.7%
unpow293.7%
unpow293.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 47.4%
associate-*r/47.4%
unpow247.4%
unpow247.4%
hypot-def48.8%
*-rgt-identity48.8%
hypot-def47.4%
unpow247.4%
unpow247.4%
+-commutative47.4%
unpow247.4%
unpow247.4%
hypot-def48.8%
Simplified48.8%
Taylor expanded in kx around 0 11.3%
Final simplification11.3%
herbie shell --seed 2023229
(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)))