
(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 94.0%
+-commutative94.0%
unpow294.0%
unpow294.0%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -5e-5)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= (sin ky) 5e-8)
(* ky (/ (sin th) (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-5) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (sin(ky) <= 5e-8) {
tmp = ky * (sin(th) / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-5) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(ky) <= 5e-8) {
tmp = ky * (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-5: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(ky) <= 5e-8: tmp = ky * (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-5) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (sin(ky) <= 5e-8) tmp = Float64(ky * Float64(sin(th) / hypot(sin(kx), sin(ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-5) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 5e-8) tmp = ky * (sin(th) / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-5], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-8], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-8}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.00000000000000024e-5Initial program 99.8%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 56.2%
*-commutative56.2%
Simplified56.2%
expm1-log1p-u55.6%
expm1-udef4.6%
*-commutative4.6%
associate-/l*4.6%
Applied egg-rr4.6%
expm1-def55.7%
expm1-log1p56.3%
associate-/r/56.2%
*-commutative56.2%
Simplified56.2%
if -5.00000000000000024e-5 < (sin.f64 ky) < 4.9999999999999998e-8Initial program 88.0%
associate-*l/83.6%
+-commutative83.6%
unpow283.6%
unpow283.6%
hypot-def90.9%
Simplified90.9%
Taylor expanded in ky around 0 90.7%
associate-/l*99.4%
div-inv99.3%
clear-num99.5%
hypot-udef87.7%
+-commutative87.7%
hypot-udef99.5%
Applied egg-rr99.5%
if 4.9999999999999998e-8 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 62.5%
Final simplification78.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -5e-5)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= (sin ky) 5e-8)
(* (sin th) (/ ky (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-5) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (sin(ky) <= 5e-8) {
tmp = sin(th) * (ky / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-5) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (Math.sin(ky) <= 5e-8) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-5: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif math.sin(ky) <= 5e-8: tmp = math.sin(th) * (ky / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-5) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (sin(ky) <= 5e-8) tmp = Float64(sin(th) * Float64(ky / hypot(sin(kx), sin(ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-5) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (sin(ky) <= 5e-8) tmp = sin(th) * (ky / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-5], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-8], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.00000000000000024e-5Initial program 99.8%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 56.2%
*-commutative56.2%
Simplified56.2%
expm1-log1p-u55.6%
expm1-udef4.6%
*-commutative4.6%
associate-/l*4.6%
Applied egg-rr4.6%
expm1-def55.7%
expm1-log1p56.3%
associate-/r/56.2%
*-commutative56.2%
Simplified56.2%
if -5.00000000000000024e-5 < (sin.f64 ky) < 4.9999999999999998e-8Initial program 88.0%
associate-*l/83.6%
+-commutative83.6%
unpow283.6%
unpow283.6%
hypot-def90.9%
Simplified90.9%
Taylor expanded in ky around 0 90.7%
associate-/l*99.4%
associate-/r/99.5%
hypot-udef87.8%
+-commutative87.8%
hypot-udef99.5%
Applied egg-rr99.5%
if 4.9999999999999998e-8 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 62.5%
Final simplification78.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -5e-5)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(if (<= (sin ky) 5e-8)
(* (sin th) (/ ky (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-5) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else if (sin(ky) <= 5e-8) {
tmp = sin(th) * (ky / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-5) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else if (Math.sin(ky) <= 5e-8) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-5: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th elif math.sin(ky) <= 5e-8: tmp = math.sin(th) * (ky / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-5) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); elseif (sin(ky) <= 5e-8) tmp = Float64(sin(th) * Float64(ky / hypot(sin(kx), sin(ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-5) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; elseif (sin(ky) <= 5e-8) tmp = sin(th) * (ky / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-5], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-8], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.00000000000000024e-5Initial program 99.8%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 56.2%
*-commutative56.2%
Simplified56.2%
associate-/l*56.1%
associate-/r/56.2%
Applied egg-rr56.2%
if -5.00000000000000024e-5 < (sin.f64 ky) < 4.9999999999999998e-8Initial program 88.0%
associate-*l/83.6%
+-commutative83.6%
unpow283.6%
unpow283.6%
hypot-def90.9%
Simplified90.9%
Taylor expanded in ky around 0 90.7%
associate-/l*99.4%
associate-/r/99.5%
hypot-udef87.8%
+-commutative87.8%
hypot-udef99.5%
Applied egg-rr99.5%
if 4.9999999999999998e-8 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 62.5%
Final simplification78.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -5e-5)
(/
(sin ky)
(* (hypot (sin ky) (sin kx)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= (sin ky) 5e-8)
(* (sin th) (/ ky (hypot (sin kx) (sin ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-5) {
tmp = sin(ky) / (hypot(sin(ky), sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (sin(ky) <= 5e-8) {
tmp = sin(th) * (ky / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-5) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(ky), Math.sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (Math.sin(ky) <= 5e-8) {
tmp = Math.sin(th) * (ky / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-5: tmp = math.sin(ky) / (math.hypot(math.sin(ky), math.sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666))) elif math.sin(ky) <= 5e-8: tmp = math.sin(th) * (ky / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-5) tmp = Float64(sin(ky) / Float64(hypot(sin(ky), sin(kx)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (sin(ky) <= 5e-8) tmp = Float64(sin(th) * Float64(ky / hypot(sin(kx), sin(ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-5) tmp = sin(ky) / (hypot(sin(ky), sin(kx)) * ((1.0 / th) + (th * 0.16666666666666666))); elseif (sin(ky) <= 5e-8) tmp = sin(th) * (ky / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-5], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-8], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-8}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.00000000000000024e-5Initial program 99.8%
associate-/r/99.6%
+-commutative99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
+-commutative99.6%
Simplified99.5%
Taylor expanded in th around 0 56.4%
+-commutative56.4%
unpow256.4%
unpow256.4%
hypot-def56.4%
associate-*r*56.4%
unpow256.4%
unpow256.4%
hypot-def56.4%
distribute-rgt-out56.4%
Simplified56.4%
if -5.00000000000000024e-5 < (sin.f64 ky) < 4.9999999999999998e-8Initial program 88.0%
associate-*l/83.6%
+-commutative83.6%
unpow283.6%
unpow283.6%
hypot-def90.9%
Simplified90.9%
Taylor expanded in ky around 0 90.7%
associate-/l*99.4%
associate-/r/99.5%
hypot-udef87.8%
+-commutative87.8%
hypot-udef99.5%
Applied egg-rr99.5%
if 4.9999999999999998e-8 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 62.5%
Final simplification78.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-308) (/ ky (/ (sin kx) (sin th))) (if (<= (sin ky) 1e-69) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-308) {
tmp = ky / (sin(kx) / sin(th));
} else if (sin(ky) <= 1e-69) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-2d-308)) then
tmp = ky / (sin(kx) / sin(th))
else if (sin(ky) <= 1d-69) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -2e-308) {
tmp = ky / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 1e-69) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-308: tmp = ky / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 1e-69: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-308) tmp = Float64(ky / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 1e-69) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-308) tmp = ky / (sin(kx) / sin(th)); elseif (sin(ky) <= 1e-69) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-308], N[(ky / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-69], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-308}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.9999999999999998e-308Initial program 92.1%
Taylor expanded in ky around 0 21.5%
associate-/l*22.8%
Simplified22.8%
if -1.9999999999999998e-308 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 61.9%
add-sqr-sqrt48.0%
sqrt-unprod68.9%
pow268.9%
Applied egg-rr68.9%
unpow268.9%
rem-sqrt-square94.7%
Simplified94.7%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 61.6%
Final simplification45.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-308) (* (sin th) (/ (sin ky) (sin kx))) (if (<= (sin ky) 1e-69) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-308) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else if (sin(ky) <= 1e-69) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-2d-308)) then
tmp = sin(th) * (sin(ky) / sin(kx))
else if (sin(ky) <= 1d-69) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -2e-308) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-69) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-308: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) elif math.sin(ky) <= 1e-69: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-308) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); elseif (sin(ky) <= 1e-69) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-308) tmp = sin(th) * (sin(ky) / sin(kx)); elseif (sin(ky) <= 1e-69) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-308], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-69], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-308}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.9999999999999998e-308Initial program 92.1%
Taylor expanded in ky around 0 24.5%
if -1.9999999999999998e-308 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 61.9%
add-sqr-sqrt48.0%
sqrt-unprod68.9%
pow268.9%
Applied egg-rr68.9%
unpow268.9%
rem-sqrt-square94.7%
Simplified94.7%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 61.6%
Final simplification46.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-270) (* (sin ky) (/ (sin th) (sin kx))) (if (<= (sin ky) 1e-69) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-270) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else if (sin(ky) <= 1e-69) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-270) then
tmp = sin(ky) * (sin(th) / sin(kx))
else if (sin(ky) <= 1d-69) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-270) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= 1e-69) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-270: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= 1e-69: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-270) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= 1e-69) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-270) tmp = sin(ky) * (sin(th) / sin(kx)); elseif (sin(ky) <= 1e-69) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-270], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-69], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-270}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2.0000000000000001e-270Initial program 91.9%
associate-/r/91.7%
+-commutative91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
+-commutative91.7%
Simplified99.6%
clear-num98.8%
associate-/r/99.5%
clear-num99.7%
hypot-udef91.8%
unpow291.8%
unpow291.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-def99.7%
Applied egg-rr99.7%
Taylor expanded in ky around 0 26.4%
if 2.0000000000000001e-270 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 90.6%
+-commutative90.6%
unpow290.6%
unpow290.6%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 63.2%
add-sqr-sqrt49.1%
sqrt-unprod72.8%
pow272.8%
Applied egg-rr72.8%
unpow272.8%
rem-sqrt-square93.3%
Simplified93.3%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 61.6%
Final simplification45.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-308) (/ (sin ky) (/ (sin kx) (sin th))) (if (<= (sin ky) 1e-69) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-308) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if (sin(ky) <= 1e-69) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-2d-308)) then
tmp = sin(ky) / (sin(kx) / sin(th))
else if (sin(ky) <= 1d-69) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -2e-308) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 1e-69) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-308: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 1e-69: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-308) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 1e-69) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-308) tmp = sin(ky) / (sin(kx) / sin(th)); elseif (sin(ky) <= 1e-69) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-308], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-69], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-308}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.9999999999999998e-308Initial program 92.1%
associate-/r/91.9%
+-commutative91.9%
unpow291.9%
sqr-neg91.9%
sin-neg91.9%
sin-neg91.9%
unpow291.9%
+-commutative91.9%
Simplified99.6%
Taylor expanded in ky around 0 24.5%
if -1.9999999999999998e-308 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 90.2%
+-commutative90.2%
unpow290.2%
unpow290.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 61.9%
add-sqr-sqrt48.0%
sqrt-unprod68.9%
pow268.9%
Applied egg-rr68.9%
unpow268.9%
rem-sqrt-square94.7%
Simplified94.7%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 61.6%
Final simplification46.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-270) (/ (sin th) (/ (sin kx) (sin ky))) (if (<= (sin ky) 1e-69) (* (sin th) (fabs (/ ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-270) {
tmp = sin(th) / (sin(kx) / sin(ky));
} else if (sin(ky) <= 1e-69) {
tmp = sin(th) * fabs((ky / sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-270) then
tmp = sin(th) / (sin(kx) / sin(ky))
else if (sin(ky) <= 1d-69) then
tmp = sin(th) * abs((ky / sin(kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-270) {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
} else if (Math.sin(ky) <= 1e-69) {
tmp = Math.sin(th) * Math.abs((ky / Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-270: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) elif math.sin(ky) <= 1e-69: tmp = math.sin(th) * math.fabs((ky / math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-270) tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); elseif (sin(ky) <= 1e-69) tmp = Float64(sin(th) * abs(Float64(ky / sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-270) tmp = sin(th) / (sin(kx) / sin(ky)); elseif (sin(ky) <= 1e-69) tmp = sin(th) * abs((ky / sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-270], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-69], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-270}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq 10^{-69}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2.0000000000000001e-270Initial program 91.9%
Taylor expanded in ky around 0 26.5%
Taylor expanded in ky around inf 24.7%
*-commutative24.7%
associate-/l*26.5%
Simplified26.5%
if 2.0000000000000001e-270 < (sin.f64 ky) < 9.9999999999999996e-70Initial program 90.6%
+-commutative90.6%
unpow290.6%
unpow290.6%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 63.2%
add-sqr-sqrt49.1%
sqrt-unprod72.8%
pow272.8%
Applied egg-rr72.8%
unpow272.8%
rem-sqrt-square93.3%
Simplified93.3%
if 9.9999999999999996e-70 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 61.6%
Final simplification45.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 5e-8) (* ky (/ (sin th) (hypot (sin kx) (sin ky)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-8) {
tmp = ky * (sin(th) / hypot(sin(kx), sin(ky)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 5e-8) {
tmp = ky * (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-8: tmp = ky * (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-8) tmp = Float64(ky * Float64(sin(th) / hypot(sin(kx), sin(ky)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 5e-8) tmp = ky * (sin(th) / hypot(sin(kx), sin(ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-8], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-8}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.9999999999999998e-8Initial program 92.3%
associate-*l/89.4%
+-commutative89.4%
unpow289.4%
unpow289.4%
hypot-def94.1%
Simplified94.1%
Taylor expanded in ky around 0 59.4%
associate-/l*64.9%
div-inv64.8%
clear-num64.9%
hypot-udef57.4%
+-commutative57.4%
hypot-udef64.9%
Applied egg-rr64.9%
if 4.9999999999999998e-8 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 62.5%
Final simplification64.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-73) (* (sin ky) (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-73) {
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) <= 1d-73) 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) <= 1e-73) {
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) <= 1e-73: 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) <= 1e-73) 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) <= 1e-73) 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], 1e-73], 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 10^{-73}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999997e-74Initial program 91.5%
Taylor expanded in ky around 0 32.4%
Taylor expanded in kx around 0 21.3%
associate-/l*23.1%
div-inv23.1%
Applied egg-rr23.1%
Taylor expanded in kx around 0 23.1%
if 9.99999999999999997e-74 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 60.7%
Final simplification34.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-73) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-73) {
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-73) 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-73) {
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-73: 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-73) 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-73) 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-73], 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^{-73}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999997e-74Initial program 91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 31.1%
if 9.99999999999999997e-74 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 60.7%
Final simplification40.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-73) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-73) {
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-73) 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-73) {
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-73: 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-73) 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-73) 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-73], 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^{-73}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999997e-74Initial program 91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 31.1%
*-commutative31.1%
clear-num31.1%
un-div-inv31.1%
Applied egg-rr31.1%
associate-/r/31.1%
Simplified31.1%
if 9.99999999999999997e-74 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 60.7%
Final simplification40.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-73) (* (sin ky) (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-73) {
tmp = sin(ky) * (th / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-73) then
tmp = sin(ky) * (th / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-73) {
tmp = Math.sin(ky) * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-73: tmp = math.sin(ky) * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-73) tmp = Float64(sin(ky) * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-73) tmp = sin(ky) * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-73], N[(N[Sin[ky], $MachinePrecision] * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-73}:\\
\;\;\;\;\sin ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999997e-74Initial program 91.5%
Taylor expanded in ky around 0 32.4%
Taylor expanded in kx around 0 21.3%
associate-/l*23.1%
div-inv23.1%
Applied egg-rr23.1%
Taylor expanded in th around 0 20.1%
if 9.99999999999999997e-74 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 60.7%
Final simplification32.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-73) (* (sin th) (/ ky kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-73) {
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) <= 1d-73) 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) <= 1e-73) {
tmp = Math.sin(th) * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-73: tmp = math.sin(th) * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-73) 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) <= 1e-73) tmp = sin(th) * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-73], 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 10^{-73}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999997e-74Initial program 91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 31.1%
Taylor expanded in kx around 0 23.0%
if 9.99999999999999997e-74 < (sin.f64 ky) Initial program 99.6%
Taylor expanded in kx around 0 60.7%
Final simplification34.7%
(FPCore (kx ky th) :precision binary64 (if (<= ky -1000.0) (sin th) (if (<= ky 9e-74) (/ ky (/ kx th)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1000.0) {
tmp = sin(th);
} else if (ky <= 9e-74) {
tmp = ky / (kx / 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 (ky <= (-1000.0d0)) then
tmp = sin(th)
else if (ky <= 9d-74) then
tmp = ky / (kx / th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -1000.0) {
tmp = Math.sin(th);
} else if (ky <= 9e-74) {
tmp = ky / (kx / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -1000.0: tmp = math.sin(th) elif ky <= 9e-74: tmp = ky / (kx / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -1000.0) tmp = sin(th); elseif (ky <= 9e-74) tmp = Float64(ky / Float64(kx / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -1000.0) tmp = sin(th); elseif (ky <= 9e-74) tmp = ky / (kx / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -1000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 9e-74], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 9 \cdot 10^{-74}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1e3 or 8.9999999999999998e-74 < ky Initial program 99.7%
Taylor expanded in kx around 0 33.5%
if -1e3 < ky < 8.9999999999999998e-74Initial program 86.1%
+-commutative86.1%
unpow286.1%
unpow286.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 49.4%
Taylor expanded in kx around 0 35.9%
Taylor expanded in th around 0 27.8%
associate-/l*30.8%
Simplified30.8%
Final simplification32.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky -6e+34) th (if (<= ky 1.85e-73) (/ ky (/ kx th)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -6e+34) {
tmp = th;
} else if (ky <= 1.85e-73) {
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 <= (-6d+34)) then
tmp = th
else if (ky <= 1.85d-73) 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 <= -6e+34) {
tmp = th;
} else if (ky <= 1.85e-73) {
tmp = ky / (kx / th);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -6e+34: tmp = th elif ky <= 1.85e-73: tmp = ky / (kx / th) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -6e+34) tmp = th; elseif (ky <= 1.85e-73) 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 <= -6e+34) tmp = th; elseif (ky <= 1.85e-73) tmp = ky / (kx / th); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -6e+34], th, If[LessEqual[ky, 1.85e-73], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -6 \cdot 10^{+34}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 1.85 \cdot 10^{-73}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -6.00000000000000037e34 or 1.85e-73 < ky Initial program 99.7%
associate-*l/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in th around 0 53.9%
*-commutative53.9%
Simplified53.9%
Taylor expanded in kx around 0 18.8%
if -6.00000000000000037e34 < ky < 1.85e-73Initial program 87.0%
+-commutative87.0%
unpow287.0%
unpow287.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 46.4%
Taylor expanded in kx around 0 33.6%
Taylor expanded in th around 0 26.0%
associate-/l*28.8%
Simplified28.8%
Final simplification23.3%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.0%
associate-*l/91.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-def95.4%
Simplified95.4%
Taylor expanded in th around 0 49.1%
*-commutative49.1%
Simplified49.1%
Taylor expanded in kx around 0 12.1%
Final simplification12.1%
herbie shell --seed 2023291
(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)))