
(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) (/ (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 95.2%
associate-*l/91.7%
*-commutative91.7%
associate-*l/95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(/
(sin ky)
(*
(hypot (sin kx) (sin ky))
(+ (/ 1.0 th) (* th 0.16666666666666666))))))
(if (<= (sin ky) -0.02)
t_1
(if (<= (sin ky) 1.2e-14)
(/ (sin th) (* (hypot (sin ky) (sin kx)) (/ 1.0 ky)))
(if (<= (sin ky) 0.91) (sin th) t_1)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
double tmp;
if (sin(ky) <= -0.02) {
tmp = t_1;
} else if (sin(ky) <= 1.2e-14) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) * (1.0 / ky));
} else if (sin(ky) <= 0.91) {
tmp = sin(th);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = t_1;
} else if (Math.sin(ky) <= 1.2e-14) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) * (1.0 / ky));
} else if (Math.sin(ky) <= 0.91) {
tmp = Math.sin(th);
} else {
tmp = t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))) tmp = 0 if math.sin(ky) <= -0.02: tmp = t_1 elif math.sin(ky) <= 1.2e-14: tmp = math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) * (1.0 / ky)) elif math.sin(ky) <= 0.91: tmp = math.sin(th) else: tmp = t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))) tmp = 0.0 if (sin(ky) <= -0.02) tmp = t_1; elseif (sin(ky) <= 1.2e-14) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) * Float64(1.0 / ky))); elseif (sin(ky) <= 0.91) tmp = sin(th); else tmp = t_1; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))); tmp = 0.0; if (sin(ky) <= -0.02) tmp = t_1; elseif (sin(ky) <= 1.2e-14) tmp = sin(th) / (hypot(sin(ky), sin(kx)) * (1.0 / ky)); elseif (sin(ky) <= 0.91) tmp = sin(th); else tmp = t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 1.2e-14], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] * N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.91], N[Sin[th], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 1.2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right) \cdot \frac{1}{ky}}\\
\mathbf{elif}\;\sin ky \leq 0.91:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004 or 0.910000000000000031 < (sin.f64 ky) Initial program 99.6%
*-commutative99.6%
clear-num99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-udef99.5%
un-div-inv99.5%
Applied egg-rr99.5%
expm1-log1p-u99.4%
expm1-udef50.0%
associate-/r/50.0%
*-commutative50.0%
Applied egg-rr50.0%
expm1-def99.4%
expm1-log1p99.5%
associate-*r/99.6%
associate-*l/99.6%
associate-/r/99.5%
hypot-def99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 53.9%
+-commutative53.9%
+-commutative53.9%
unpow253.9%
unpow253.9%
hypot-def53.9%
associate-*r*53.9%
+-commutative53.9%
unpow253.9%
unpow253.9%
hypot-def53.9%
distribute-rgt-out53.9%
Simplified53.9%
if -0.0200000000000000004 < (sin.f64 ky) < 1.2e-14Initial program 90.7%
*-commutative90.7%
clear-num90.6%
+-commutative90.6%
unpow290.6%
unpow290.6%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
hypot-def90.7%
unpow290.7%
unpow290.7%
+-commutative90.7%
unpow290.7%
unpow290.7%
hypot-def99.6%
Simplified99.6%
clear-num99.7%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
if 1.2e-14 < (sin.f64 ky) < 0.910000000000000031Initial program 99.7%
Taylor expanded in kx around 0 62.7%
Final simplification78.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.8)
(sin th)
(if (<= (sin th) -0.04)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin th) 0.05)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(/ (sin th) (/ (sin kx) (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.8) {
tmp = sin(th);
} else if (sin(th) <= -0.04) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(th) <= 0.05) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.8) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= -0.04) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(th) <= 0.05) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.8: tmp = math.sin(th) elif math.sin(th) <= -0.04: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(th) <= 0.05: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.8) tmp = sin(th); elseif (sin(th) <= -0.04) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(th) <= 0.05) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.8) tmp = sin(th); elseif (sin(th) <= -0.04) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(th) <= 0.05) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.8], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.04], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.05], 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[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.8:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq -0.04:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin th \leq 0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.80000000000000004Initial program 93.4%
Taylor expanded in kx around 0 48.3%
if -0.80000000000000004 < (sin.f64 th) < -0.0400000000000000008Initial program 96.5%
associate-*l/96.8%
*-commutative96.8%
associate-*l/96.8%
+-commutative96.8%
unpow296.8%
unpow296.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 26.4%
if -0.0400000000000000008 < (sin.f64 th) < 0.050000000000000003Initial program 95.9%
associate-*l/89.9%
*-commutative89.9%
associate-*l/95.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 93.8%
+-commutative93.8%
Simplified93.8%
expm1-log1p-u91.5%
expm1-udef25.3%
sqrt-div25.3%
metadata-eval25.3%
+-commutative25.3%
unpow225.3%
unpow225.3%
hypot-udef27.8%
un-div-inv27.8%
Applied egg-rr27.8%
expm1-def94.7%
expm1-log1p97.8%
hypot-def94.0%
unpow294.0%
unpow294.0%
+-commutative94.0%
unpow294.0%
unpow294.0%
hypot-def97.8%
Simplified97.8%
if 0.050000000000000003 < (sin.f64 th) Initial program 93.1%
*-commutative93.1%
clear-num93.0%
+-commutative93.0%
unpow293.0%
unpow293.0%
hypot-udef99.3%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 23.1%
Final simplification70.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.8)
(sin th)
(if (<= (sin th) -0.04)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin th) 0.05)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(/ (sin th) (/ (sin kx) (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.8) {
tmp = sin(th);
} else if (sin(th) <= -0.04) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(th) <= 0.05) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = sin(th) / (sin(kx) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.8) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= -0.04) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(th) <= 0.05) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.8: tmp = math.sin(th) elif math.sin(th) <= -0.04: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(th) <= 0.05: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.8) tmp = sin(th); elseif (sin(th) <= -0.04) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(th) <= 0.05) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.8) tmp = sin(th); elseif (sin(th) <= -0.04) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(th) <= 0.05) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.8], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], -0.04], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.05], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.8:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq -0.04:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin th \leq 0.05:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.80000000000000004Initial program 93.4%
Taylor expanded in kx around 0 48.3%
if -0.80000000000000004 < (sin.f64 th) < -0.0400000000000000008Initial program 96.5%
associate-*l/96.8%
*-commutative96.8%
associate-*l/96.8%
+-commutative96.8%
unpow296.8%
unpow296.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 26.4%
if -0.0400000000000000008 < (sin.f64 th) < 0.050000000000000003Initial program 95.9%
*-commutative95.9%
clear-num95.8%
+-commutative95.8%
unpow295.8%
unpow295.8%
hypot-udef99.7%
un-div-inv99.7%
Applied egg-rr99.7%
expm1-log1p-u99.7%
expm1-udef21.3%
associate-/r/21.3%
*-commutative21.3%
Applied egg-rr21.3%
expm1-def99.7%
expm1-log1p99.7%
associate-*r/90.7%
associate-*l/99.7%
associate-/r/99.7%
hypot-def95.9%
unpow295.9%
unpow295.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 93.8%
associate-*l/94.0%
+-commutative94.0%
unpow294.0%
unpow294.0%
hypot-def97.9%
*-lft-identity97.9%
hypot-def94.0%
unpow294.0%
unpow294.0%
+-commutative94.0%
unpow294.0%
unpow294.0%
hypot-def97.9%
Simplified97.9%
if 0.050000000000000003 < (sin.f64 th) Initial program 93.1%
*-commutative93.1%
clear-num93.0%
+-commutative93.0%
unpow293.0%
unpow293.0%
hypot-udef99.3%
un-div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 23.1%
Final simplification70.1%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.02)
(/ th (/ t_1 (sin ky)))
(if (<= (sin ky) 1.2e-14)
(/ (sin th) (* t_1 (/ 1.0 ky)))
(if (<= (sin ky) 0.91)
(sin th)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.02) {
tmp = th / (t_1 / sin(ky));
} else if (sin(ky) <= 1.2e-14) {
tmp = sin(th) / (t_1 * (1.0 / ky));
} else if (sin(ky) <= 0.91) {
tmp = sin(th);
} else {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = th / (t_1 / Math.sin(ky));
} else if (Math.sin(ky) <= 1.2e-14) {
tmp = Math.sin(th) / (t_1 * (1.0 / ky));
} else if (Math.sin(ky) <= 0.91) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.02: tmp = th / (t_1 / math.sin(ky)) elif math.sin(ky) <= 1.2e-14: tmp = math.sin(th) / (t_1 * (1.0 / ky)) elif math.sin(ky) <= 0.91: tmp = math.sin(th) else: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(th / Float64(t_1 / sin(ky))); elseif (sin(ky) <= 1.2e-14) tmp = Float64(sin(th) / Float64(t_1 * Float64(1.0 / ky))); elseif (sin(ky) <= 0.91) tmp = sin(th); else tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.02) tmp = th / (t_1 / sin(ky)); elseif (sin(ky) <= 1.2e-14) tmp = sin(th) / (t_1 * (1.0 / ky)); elseif (sin(ky) <= 0.91) tmp = sin(th); else tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[(th / N[(t$95$1 / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1.2e-14], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 * N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.91], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{th}{\frac{t_1}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq 1.2 \cdot 10^{-14}:\\
\;\;\;\;\frac{\sin th}{t_1 \cdot \frac{1}{ky}}\\
\mathbf{elif}\;\sin ky \leq 0.91:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.7%
associate-*l/99.6%
*-commutative99.6%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 48.0%
+-commutative48.0%
Simplified48.0%
expm1-log1p-u47.8%
expm1-udef47.7%
sqrt-div47.7%
metadata-eval47.7%
+-commutative47.7%
unpow247.7%
unpow247.7%
hypot-udef47.7%
Applied egg-rr47.7%
expm1-def47.8%
expm1-log1p48.0%
hypot-def48.0%
unpow248.0%
unpow248.0%
+-commutative48.0%
unpow248.0%
unpow248.0%
hypot-def48.0%
Simplified48.0%
expm1-log1p-u47.2%
expm1-udef3.9%
associate-*l*3.9%
associate-*l/3.9%
*-un-lft-identity3.9%
Applied egg-rr3.9%
expm1-def47.4%
expm1-log1p48.2%
associate-*r/48.1%
associate-/l*48.1%
Simplified48.1%
if -0.0200000000000000004 < (sin.f64 ky) < 1.2e-14Initial program 90.7%
*-commutative90.7%
clear-num90.6%
+-commutative90.6%
unpow290.6%
unpow290.6%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
hypot-def90.7%
unpow290.7%
unpow290.7%
+-commutative90.7%
unpow290.7%
unpow290.7%
hypot-def99.6%
Simplified99.6%
clear-num99.7%
div-inv99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 99.6%
if 1.2e-14 < (sin.f64 ky) < 0.910000000000000031Initial program 99.7%
Taylor expanded in kx around 0 62.7%
if 0.910000000000000031 < (sin.f64 ky) Initial program 99.6%
*-commutative99.6%
clear-num99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-udef99.3%
un-div-inv99.3%
Applied egg-rr99.3%
expm1-log1p-u99.3%
expm1-udef25.3%
associate-/r/25.3%
*-commutative25.3%
Applied egg-rr25.3%
expm1-def99.3%
expm1-log1p99.3%
associate-*r/99.5%
associate-*l/99.2%
associate-/r/99.6%
hypot-def99.8%
unpow299.8%
unpow299.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 78.8%
associate-*l/78.9%
+-commutative78.9%
unpow278.9%
unpow278.9%
hypot-def78.7%
*-lft-identity78.7%
hypot-def78.9%
unpow278.9%
unpow278.9%
+-commutative78.9%
unpow278.9%
unpow278.9%
hypot-def78.7%
Simplified78.7%
Final simplification78.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) 1e-263)
(* (sin ky) (/ (sin th) (sin kx)))
(if (<= (sin ky) 1e-70)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-263) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 1e-70) {
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) <= 1d-263) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(ky) <= 1d-70) 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) <= 1e-263) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-70) {
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) <= 1e-263: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 1e-70: 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) <= 1e-263) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 1e-70) 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) <= 1e-263) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 1e-70) 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], 1e-263], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-70], 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 10^{-263}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-70}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-263Initial program 94.8%
associate-*l/91.3%
*-commutative91.3%
associate-*l/94.8%
+-commutative94.8%
unpow294.8%
unpow294.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 29.8%
if 1e-263 < (sin.f64 ky) < 9.99999999999999996e-71Initial program 88.7%
Taylor expanded in ky around 0 56.7%
add-sqr-sqrt48.8%
sqrt-unprod68.4%
pow268.4%
Applied egg-rr68.4%
unpow268.4%
rem-sqrt-square80.2%
Simplified80.2%
if 9.99999999999999996e-71 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 57.6%
Final simplification47.3%
(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 95.2%
+-commutative95.2%
unpow295.2%
unpow295.2%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-138) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-138) {
tmp = sin(th) * (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) <= 2d-138) then
tmp = sin(th) * (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) <= 2e-138) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-138: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-138) tmp = Float64(sin(th) * 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) <= 2e-138) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-138], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $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^{-138}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2.00000000000000013e-138Initial program 92.6%
Taylor expanded in ky around 0 36.2%
if 2.00000000000000013e-138 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 52.9%
Final simplification42.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-138) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-138) {
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) <= 2d-138) 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) <= 2e-138) {
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) <= 2e-138: 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) <= 2e-138) 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) <= 2e-138) 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], 2e-138], 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 2 \cdot 10^{-138}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2.00000000000000013e-138Initial program 92.6%
associate-*l/88.6%
*-commutative88.6%
associate-*l/92.6%
+-commutative92.6%
unpow292.6%
unpow292.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 36.3%
if 2.00000000000000013e-138 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 52.9%
Final simplification42.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-137) (* (sin ky) (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-137) {
tmp = sin(ky) * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-137) then
tmp = sin(ky) * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-137) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-137: tmp = math.sin(ky) * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-137) tmp = Float64(sin(ky) * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-137) tmp = sin(ky) * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-137], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-137}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.99999999999999996e-137Initial program 92.6%
Taylor expanded in ky around 0 36.6%
Taylor expanded in kx around 0 24.1%
associate-/l*27.5%
Simplified27.5%
Taylor expanded in ky around inf 24.1%
associate-*r/27.5%
Simplified27.5%
if 1.99999999999999996e-137 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 53.4%
Final simplification37.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-138) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-138) {
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) <= 2d-138) 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) <= 2e-138) {
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) <= 2e-138: 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) <= 2e-138) 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) <= 2e-138) 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], 2e-138], 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 2 \cdot 10^{-138}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2.00000000000000013e-138Initial program 92.6%
Taylor expanded in ky around 0 31.0%
associate-/l*34.3%
associate-/r/34.3%
Simplified34.3%
if 2.00000000000000013e-138 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 52.9%
Final simplification41.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-138) (/ ky (/ (sin kx) (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-138) {
tmp = ky / (sin(kx) / sin(th));
} 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-138) then
tmp = ky / (sin(kx) / sin(th))
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-138) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-138: tmp = ky / (math.sin(kx) / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-138) tmp = Float64(ky / Float64(sin(kx) / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-138) tmp = ky / (sin(kx) / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-138], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-138}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2.00000000000000013e-138Initial program 92.6%
*-commutative92.6%
clear-num92.5%
+-commutative92.5%
unpow292.5%
unpow292.5%
hypot-udef99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 31.0%
associate-/l*34.3%
Simplified34.3%
if 2.00000000000000013e-138 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 52.9%
Final simplification41.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-137) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-137) {
tmp = ky / (kx / sin(th));
} 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-137) then
tmp = ky / (kx / sin(th))
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-137) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-137: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-137) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-137) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-137], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-137}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.99999999999999996e-137Initial program 92.6%
Taylor expanded in ky around 0 36.6%
Taylor expanded in kx around 0 24.1%
associate-/l*27.5%
Simplified27.5%
Taylor expanded in ky around 0 23.8%
associate-/l*27.2%
Simplified27.2%
if 1.99999999999999996e-137 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 53.4%
Final simplification37.0%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -116.0) (not (<= ky 1.45e-138))) (sin th) (* th (/ ky (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -116.0) || !(ky <= 1.45e-138)) {
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 <= (-116.0d0)) .or. (.not. (ky <= 1.45d-138))) 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 <= -116.0) || !(ky <= 1.45e-138)) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -116.0) or not (ky <= 1.45e-138): tmp = math.sin(th) else: tmp = th * (ky / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -116.0) || !(ky <= 1.45e-138)) 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 <= -116.0) || ~((ky <= 1.45e-138))) tmp = sin(th); else tmp = th * (ky / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -116.0], N[Not[LessEqual[ky, 1.45e-138]], $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 -116 \lor \neg \left(ky \leq 1.45 \cdot 10^{-138}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\end{array}
\end{array}
if ky < -116 or 1.44999999999999987e-138 < ky Initial program 99.6%
Taylor expanded in kx around 0 33.5%
if -116 < ky < 1.44999999999999987e-138Initial program 88.2%
associate-*l/81.7%
*-commutative81.7%
associate-*l/88.2%
+-commutative88.2%
unpow288.2%
unpow288.2%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 60.2%
+-commutative60.2%
Simplified60.2%
Taylor expanded in ky around 0 38.7%
associate-/l*44.1%
Simplified44.1%
associate-/r/44.2%
Applied egg-rr44.2%
Final simplification37.6%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -116.0) (not (<= ky 5.5e-139))) (sin th) (* th (/ ky kx))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -116.0) || !(ky <= 5.5e-139)) {
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 <= (-116.0d0)) .or. (.not. (ky <= 5.5d-139))) 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 <= -116.0) || !(ky <= 5.5e-139)) {
tmp = Math.sin(th);
} else {
tmp = th * (ky / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -116.0) or not (ky <= 5.5e-139): tmp = math.sin(th) else: tmp = th * (ky / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -116.0) || !(ky <= 5.5e-139)) 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 <= -116.0) || ~((ky <= 5.5e-139))) tmp = sin(th); else tmp = th * (ky / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -116.0], N[Not[LessEqual[ky, 5.5e-139]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -116 \lor \neg \left(ky \leq 5.5 \cdot 10^{-139}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\end{array}
\end{array}
if ky < -116 or 5.4999999999999997e-139 < ky Initial program 99.6%
Taylor expanded in kx around 0 33.5%
if -116 < ky < 5.4999999999999997e-139Initial program 88.2%
associate-*l/81.7%
*-commutative81.7%
associate-*l/88.2%
+-commutative88.2%
unpow288.2%
unpow288.2%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 60.2%
+-commutative60.2%
Simplified60.2%
Taylor expanded in ky around 0 38.7%
associate-/l*44.1%
Simplified44.1%
Taylor expanded in kx around 0 30.9%
associate-/l*36.3%
Simplified36.3%
associate-/r/36.3%
Applied egg-rr36.3%
Final simplification34.6%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -390.0) (not (<= ky 1.3e-138))) (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666))) (* th (/ ky kx))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -390.0) || !(ky <= 1.3e-138)) {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
} 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 <= (-390.0d0)) .or. (.not. (ky <= 1.3d-138))) then
tmp = 1.0d0 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
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 <= -390.0) || !(ky <= 1.3e-138)) {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
} else {
tmp = th * (ky / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -390.0) or not (ky <= 1.3e-138): tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)) else: tmp = th * (ky / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -390.0) || !(ky <= 1.3e-138)) tmp = Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); else tmp = Float64(th * Float64(ky / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -390.0) || ~((ky <= 1.3e-138))) tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); else tmp = th * (ky / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -390.0], N[Not[LessEqual[ky, 1.3e-138]], $MachinePrecision]], N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -390 \lor \neg \left(ky \leq 1.3 \cdot 10^{-138}\right):\\
\;\;\;\;\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\end{array}
\end{array}
if ky < -390 or 1.3e-138 < ky Initial program 99.6%
*-commutative99.6%
clear-num99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-udef99.6%
un-div-inv99.6%
Applied egg-rr99.6%
expm1-log1p-u99.6%
expm1-udef43.9%
associate-/r/43.8%
*-commutative43.8%
Applied egg-rr43.8%
expm1-def99.5%
expm1-log1p99.6%
associate-*r/97.9%
associate-*l/99.6%
associate-/r/99.6%
hypot-def99.6%
unpow299.6%
unpow299.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 55.0%
+-commutative55.0%
+-commutative55.0%
unpow255.0%
unpow255.0%
hypot-def55.0%
associate-*r*55.0%
+-commutative55.0%
unpow255.0%
unpow255.0%
hypot-def55.0%
distribute-rgt-out55.0%
Simplified55.0%
Taylor expanded in kx around 0 20.8%
if -390 < ky < 1.3e-138Initial program 88.3%
associate-*l/81.9%
*-commutative81.9%
associate-*l/88.3%
+-commutative88.3%
unpow288.3%
unpow288.3%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 59.6%
+-commutative59.6%
Simplified59.6%
Taylor expanded in ky around 0 38.3%
associate-/l*43.7%
Simplified43.7%
Taylor expanded in kx around 0 30.6%
associate-/l*36.0%
Simplified36.0%
associate-/r/36.0%
Applied egg-rr36.0%
Final simplification26.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky -27500.0) th (if (<= ky 3.3e-137) (* ky (/ th kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -27500.0) {
tmp = th;
} else if (ky <= 3.3e-137) {
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 <= (-27500.0d0)) then
tmp = th
else if (ky <= 3.3d-137) 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 <= -27500.0) {
tmp = th;
} else if (ky <= 3.3e-137) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -27500.0: tmp = th elif ky <= 3.3e-137: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -27500.0) tmp = th; elseif (ky <= 3.3e-137) 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 <= -27500.0) tmp = th; elseif (ky <= 3.3e-137) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -27500.0], th, If[LessEqual[ky, 3.3e-137], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -27500:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 3.3 \cdot 10^{-137}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -27500 or 3.3000000000000002e-137 < ky Initial program 99.6%
associate-*l/97.9%
*-commutative97.9%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 55.3%
+-commutative55.3%
Simplified55.3%
Taylor expanded in kx around 0 20.8%
if -27500 < ky < 3.3000000000000002e-137Initial program 88.5%
associate-*l/82.2%
*-commutative82.2%
associate-*l/88.6%
+-commutative88.6%
unpow288.6%
unpow288.6%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 58.5%
+-commutative58.5%
Simplified58.5%
Taylor expanded in ky around 0 37.6%
associate-/l*42.9%
Simplified42.9%
Taylor expanded in kx around 0 30.1%
associate-/l*35.3%
Simplified35.3%
Taylor expanded in ky around 0 30.1%
associate-*r/35.3%
Simplified35.3%
Final simplification26.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky -7200.0) th (if (<= ky 3.6e-137) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -7200.0) {
tmp = th;
} else if (ky <= 3.6e-137) {
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 <= (-7200.0d0)) then
tmp = th
else if (ky <= 3.6d-137) 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 <= -7200.0) {
tmp = th;
} else if (ky <= 3.6e-137) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -7200.0: tmp = th elif ky <= 3.6e-137: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -7200.0) tmp = th; elseif (ky <= 3.6e-137) 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 <= -7200.0) tmp = th; elseif (ky <= 3.6e-137) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -7200.0], th, If[LessEqual[ky, 3.6e-137], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -7200:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 3.6 \cdot 10^{-137}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -7200 or 3.60000000000000006e-137 < ky Initial program 99.6%
associate-*l/97.9%
*-commutative97.9%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 55.3%
+-commutative55.3%
Simplified55.3%
Taylor expanded in kx around 0 20.8%
if -7200 < ky < 3.60000000000000006e-137Initial program 88.5%
associate-*l/82.2%
*-commutative82.2%
associate-*l/88.6%
+-commutative88.6%
unpow288.6%
unpow288.6%
hypot-def99.8%
Simplified99.8%
Taylor expanded in th around 0 58.5%
+-commutative58.5%
Simplified58.5%
Taylor expanded in ky around 0 37.6%
associate-/l*42.9%
Simplified42.9%
Taylor expanded in kx around 0 30.1%
associate-/l*35.3%
Simplified35.3%
associate-/r/35.3%
Applied egg-rr35.3%
Final simplification26.5%
(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 95.2%
associate-*l/91.7%
*-commutative91.7%
associate-*l/95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 56.6%
+-commutative56.6%
Simplified56.6%
Taylor expanded in kx around 0 14.9%
Final simplification14.9%
herbie shell --seed 2023315
(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)))