
(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 92.7%
+-commutative92.7%
unpow292.7%
unpow292.7%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))) (t_2 (* (sin ky) (/ th t_1))))
(if (<= (sin ky) -0.35)
t_2
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) -5e-7)
t_2
(if (<= (sin ky) 0.02) (* (sin th) (/ ky t_1)) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double t_2 = sin(ky) * (th / t_1);
double tmp;
if (sin(ky) <= -0.35) {
tmp = t_2;
} else if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-7) {
tmp = t_2;
} else if (sin(ky) <= 0.02) {
tmp = sin(th) * (ky / t_1);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double t_2 = Math.sin(ky) * (th / t_1);
double tmp;
if (Math.sin(ky) <= -0.35) {
tmp = t_2;
} else if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-7) {
tmp = t_2;
} else if (Math.sin(ky) <= 0.02) {
tmp = Math.sin(th) * (ky / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) t_2 = math.sin(ky) * (th / t_1) tmp = 0 if math.sin(ky) <= -0.35: tmp = t_2 elif math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-7: tmp = t_2 elif math.sin(ky) <= 0.02: tmp = math.sin(th) * (ky / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) t_2 = Float64(sin(ky) * Float64(th / t_1)) tmp = 0.0 if (sin(ky) <= -0.35) tmp = t_2; elseif (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-7) tmp = t_2; elseif (sin(ky) <= 0.02) tmp = Float64(sin(th) * Float64(ky / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); t_2 = sin(ky) * (th / t_1); tmp = 0.0; if (sin(ky) <= -0.35) tmp = t_2; elseif (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-7) tmp = t_2; elseif (sin(ky) <= 0.02) tmp = sin(th) * (ky / t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.35], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-7], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], 0.02], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \sin ky \cdot \frac{th}{t_1}\\
\mathbf{if}\;\sin ky \leq -0.35:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-7}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq 0.02:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.34999999999999998 or -0.0200000000000000004 < (sin.f64 ky) < -4.99999999999999977e-7Initial program 99.7%
associate-*l/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Simplified99.3%
Taylor expanded in th around 0 60.8%
expm1-log1p-u60.0%
expm1-udef3.7%
div-inv3.7%
*-commutative3.7%
associate-*l*3.7%
div-inv3.7%
Applied egg-rr3.7%
expm1-def60.4%
expm1-log1p61.2%
*-commutative61.2%
associate-*l/60.8%
associate-*r/61.2%
Simplified61.2%
if -0.34999999999999998 < (sin.f64 ky) < -0.0200000000000000004Initial program 99.8%
associate-*l/99.6%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.3%
clear-num2.3%
inv-pow2.3%
Applied egg-rr2.3%
unpow-12.3%
Simplified2.3%
add-sqr-sqrt0.6%
sqrt-unprod38.7%
pow238.7%
un-div-inv38.9%
Applied egg-rr38.9%
unpow238.9%
rem-sqrt-square51.1%
associate-/r/51.2%
*-inverses51.2%
*-lft-identity51.2%
Simplified51.2%
if -4.99999999999999977e-7 < (sin.f64 ky) < 0.0200000000000000004Initial program 84.9%
associate-*l/84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def93.2%
Simplified93.2%
Taylor expanded in ky around 0 91.5%
expm1-log1p-u91.5%
expm1-udef30.9%
associate-/l*30.9%
associate-/r/30.9%
Applied egg-rr30.9%
expm1-def97.9%
expm1-log1p97.9%
associate-*l/91.5%
associate-*r/98.0%
Simplified98.0%
if 0.0200000000000000004 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 56.1%
Final simplification76.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.35)
(* (/ (sin ky) t_1) th)
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) -5e-7)
(* (sin ky) (/ th t_1))
(if (<= (sin ky) 0.02) (* (sin th) (/ ky t_1)) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.35) {
tmp = (sin(ky) / t_1) * th;
} else if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-7) {
tmp = sin(ky) * (th / t_1);
} else if (sin(ky) <= 0.02) {
tmp = sin(th) * (ky / t_1);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.35) {
tmp = (Math.sin(ky) / t_1) * th;
} else if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-7) {
tmp = Math.sin(ky) * (th / t_1);
} else if (Math.sin(ky) <= 0.02) {
tmp = Math.sin(th) * (ky / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.35: tmp = (math.sin(ky) / t_1) * th elif math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-7: tmp = math.sin(ky) * (th / t_1) elif math.sin(ky) <= 0.02: tmp = math.sin(th) * (ky / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.35) tmp = Float64(Float64(sin(ky) / t_1) * th); elseif (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-7) tmp = Float64(sin(ky) * Float64(th / t_1)); elseif (sin(ky) <= 0.02) tmp = Float64(sin(th) * Float64(ky / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.35) tmp = (sin(ky) / t_1) * th; elseif (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-7) tmp = sin(ky) * (th / t_1); elseif (sin(ky) <= 0.02) tmp = sin(th) * (ky / t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.35], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-7], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.02], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.35:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-7}:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 0.02:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.34999999999999998Initial program 99.7%
associate-*l/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 59.7%
associate-/l*59.7%
associate-/r/59.7%
Applied egg-rr59.7%
if -0.34999999999999998 < (sin.f64 ky) < -0.0200000000000000004Initial program 99.8%
associate-*l/99.6%
associate-*r/99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 2.3%
clear-num2.3%
inv-pow2.3%
Applied egg-rr2.3%
unpow-12.3%
Simplified2.3%
add-sqr-sqrt0.6%
sqrt-unprod38.7%
pow238.7%
un-div-inv38.9%
Applied egg-rr38.9%
unpow238.9%
rem-sqrt-square51.1%
associate-/r/51.2%
*-inverses51.2%
*-lft-identity51.2%
Simplified51.2%
if -0.0200000000000000004 < (sin.f64 ky) < -4.99999999999999977e-7Initial program 100.0%
associate-*l/89.2%
+-commutative89.2%
unpow289.2%
unpow289.2%
hypot-def89.2%
Simplified89.2%
Taylor expanded in th around 0 89.2%
expm1-log1p-u89.2%
expm1-udef9.5%
div-inv9.5%
*-commutative9.5%
associate-*l*9.5%
div-inv9.5%
Applied egg-rr9.5%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
associate-*l/89.2%
associate-*r/100.0%
Simplified100.0%
if -4.99999999999999977e-7 < (sin.f64 ky) < 0.0200000000000000004Initial program 84.9%
associate-*l/84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def93.2%
Simplified93.2%
Taylor expanded in ky around 0 91.5%
expm1-log1p-u91.5%
expm1-udef30.9%
associate-/l*30.9%
associate-/r/30.9%
Applied egg-rr30.9%
expm1-def97.9%
expm1-log1p97.9%
associate-*l/91.5%
associate-*r/98.0%
Simplified98.0%
if 0.0200000000000000004 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 56.1%
Final simplification76.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (<= (sin ky) -0.34)
(/ (/ (sin ky) t_1) (+ (/ 1.0 th) (* th 0.16666666666666666)))
(if (<= (sin ky) -0.02)
(fabs (sin th))
(if (<= (sin ky) -5e-7)
(* (sin ky) (/ th t_1))
(if (<= (sin ky) 0.02) (* (sin th) (/ ky t_1)) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if (sin(ky) <= -0.34) {
tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (sin(ky) <= -0.02) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -5e-7) {
tmp = sin(ky) * (th / t_1);
} else if (sin(ky) <= 0.02) {
tmp = sin(th) * (ky / t_1);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(Math.sin(ky), Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -0.34) {
tmp = (Math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666));
} else if (Math.sin(ky) <= -0.02) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -5e-7) {
tmp = Math.sin(ky) * (th / t_1);
} else if (Math.sin(ky) <= 0.02) {
tmp = Math.sin(th) * (ky / t_1);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if math.sin(ky) <= -0.34: tmp = (math.sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)) elif math.sin(ky) <= -0.02: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -5e-7: tmp = math.sin(ky) * (th / t_1) elif math.sin(ky) <= 0.02: tmp = math.sin(th) * (ky / t_1) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if (sin(ky) <= -0.34) tmp = Float64(Float64(sin(ky) / t_1) / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); elseif (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-7) tmp = Float64(sin(ky) * Float64(th / t_1)); elseif (sin(ky) <= 0.02) tmp = Float64(sin(th) * Float64(ky / t_1)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if (sin(ky) <= -0.34) tmp = (sin(ky) / t_1) / ((1.0 / th) + (th * 0.16666666666666666)); elseif (sin(ky) <= -0.02) tmp = abs(sin(th)); elseif (sin(ky) <= -5e-7) tmp = sin(ky) * (th / t_1); elseif (sin(ky) <= 0.02) tmp = sin(th) * (ky / t_1); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.34], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-7], N[(N[Sin[ky], $MachinePrecision] * N[(th / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.02], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.34:\\
\;\;\;\;\frac{\frac{\sin ky}{t_1}}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\mathbf{elif}\;\sin ky \leq -0.02:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-7}:\\
\;\;\;\;\sin ky \cdot \frac{th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 0.02:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.340000000000000024Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 58.7%
*-commutative58.7%
Simplified58.7%
if -0.340000000000000024 < (sin.f64 ky) < -0.0200000000000000004Initial program 99.8%
associate-*l/99.7%
associate-*r/99.8%
+-commutative99.8%
unpow299.8%
unpow299.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 2.3%
clear-num2.3%
inv-pow2.3%
Applied egg-rr2.3%
unpow-12.3%
Simplified2.3%
add-sqr-sqrt0.5%
sqrt-unprod41.3%
pow241.3%
un-div-inv41.6%
Applied egg-rr41.6%
unpow241.6%
rem-sqrt-square54.6%
associate-/r/54.7%
*-inverses54.7%
*-lft-identity54.7%
Simplified54.7%
if -0.0200000000000000004 < (sin.f64 ky) < -4.99999999999999977e-7Initial program 100.0%
associate-*l/89.2%
+-commutative89.2%
unpow289.2%
unpow289.2%
hypot-def89.2%
Simplified89.2%
Taylor expanded in th around 0 89.2%
expm1-log1p-u89.2%
expm1-udef9.5%
div-inv9.5%
*-commutative9.5%
associate-*l*9.5%
div-inv9.5%
Applied egg-rr9.5%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
associate-*l/89.2%
associate-*r/100.0%
Simplified100.0%
if -4.99999999999999977e-7 < (sin.f64 ky) < 0.0200000000000000004Initial program 84.9%
associate-*l/84.1%
+-commutative84.1%
unpow284.1%
unpow284.1%
hypot-def93.2%
Simplified93.2%
Taylor expanded in ky around 0 91.5%
expm1-log1p-u91.5%
expm1-udef30.9%
associate-/l*30.9%
associate-/r/30.9%
Applied egg-rr30.9%
expm1-def97.9%
expm1-log1p97.9%
associate-*l/91.5%
associate-*r/98.0%
Simplified98.0%
if 0.0200000000000000004 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 56.1%
Final simplification76.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -2e-39)
(fabs (sin th))
(if (<= (sin ky) -1e-277)
(/ (sin th) (+ (/ (sin kx) ky) (* ky (/ 0.5 kx))))
(if (<= (sin ky) 5e-70)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(/ (* (sin ky) (sin th)) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-39) {
tmp = fabs(sin(th));
} else if (sin(ky) <= -1e-277) {
tmp = sin(th) / ((sin(kx) / ky) + (ky * (0.5 / kx)));
} else if (sin(ky) <= 5e-70) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else {
tmp = (sin(ky) * sin(th)) / sin(ky);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-2d-39)) then
tmp = abs(sin(th))
else if (sin(ky) <= (-1d-277)) then
tmp = sin(th) / ((sin(kx) / ky) + (ky * (0.5d0 / kx)))
else if (sin(ky) <= 5d-70) then
tmp = sin(th) * abs((sin(ky) / sin(kx)))
else
tmp = (sin(ky) * sin(th)) / sin(ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -2e-39) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= -1e-277) {
tmp = Math.sin(th) / ((Math.sin(kx) / ky) + (ky * (0.5 / kx)));
} else if (Math.sin(ky) <= 5e-70) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-39: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= -1e-277: tmp = math.sin(th) / ((math.sin(kx) / ky) + (ky * (0.5 / kx))) elif math.sin(ky) <= 5e-70: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) else: tmp = (math.sin(ky) * math.sin(th)) / math.sin(ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-39) tmp = abs(sin(th)); elseif (sin(ky) <= -1e-277) tmp = Float64(sin(th) / Float64(Float64(sin(kx) / ky) + Float64(ky * Float64(0.5 / kx)))); elseif (sin(ky) <= 5e-70) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-39) tmp = abs(sin(th)); elseif (sin(ky) <= -1e-277) tmp = sin(th) / ((sin(kx) / ky) + (ky * (0.5 / kx))); elseif (sin(ky) <= 5e-70) tmp = sin(th) * abs((sin(ky) / sin(kx))); else tmp = (sin(ky) * sin(th)) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-39], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-277], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision] + N[(ky * N[(0.5 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-70], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-39}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-277}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky} + ky \cdot \frac{0.5}{kx}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-70}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999986e-39Initial program 99.7%
associate-*l/99.4%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.9%
clear-num2.9%
inv-pow2.9%
Applied egg-rr2.9%
unpow-12.9%
Simplified2.9%
add-sqr-sqrt1.1%
sqrt-unprod25.0%
pow225.0%
un-div-inv25.0%
Applied egg-rr25.0%
unpow225.0%
rem-sqrt-square38.9%
associate-/r/39.0%
*-inverses39.0%
*-lft-identity39.0%
Simplified39.0%
if -1.99999999999999986e-39 < (sin.f64 ky) < -9.99999999999999969e-278Initial program 90.1%
+-commutative90.1%
unpow290.1%
unpow290.1%
hypot-def99.7%
Simplified99.7%
associate-*l/95.3%
associate-*r/99.5%
expm1-log1p-u99.5%
expm1-udef22.4%
Applied egg-rr22.4%
expm1-def99.5%
expm1-log1p99.5%
*-commutative99.5%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in ky around 0 51.3%
*-commutative51.3%
cancel-sign-sub-inv51.3%
associate-*r/51.3%
metadata-eval51.3%
metadata-eval51.3%
Simplified51.3%
Taylor expanded in kx around 0 51.3%
if -9.99999999999999969e-278 < (sin.f64 ky) < 4.9999999999999998e-70Initial program 72.1%
+-commutative72.1%
unpow272.1%
unpow272.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 55.5%
add-sqr-sqrt39.2%
sqrt-unprod64.7%
pow264.7%
Applied egg-rr64.7%
unpow264.7%
rem-sqrt-square80.4%
Simplified80.4%
if 4.9999999999999998e-70 < (sin.f64 ky) Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 55.8%
Final simplification54.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -2e-39)
(fabs (sin th))
(if (<= (sin ky) 5e-70)
(/ (sin th) (+ (/ (sin kx) ky) (* ky (/ 0.5 kx))))
(/ (* (sin ky) (sin th)) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-39) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-70) {
tmp = sin(th) / ((sin(kx) / ky) + (ky * (0.5 / kx)));
} else {
tmp = (sin(ky) * sin(th)) / sin(ky);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-2d-39)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-70) then
tmp = sin(th) / ((sin(kx) / ky) + (ky * (0.5d0 / kx)))
else
tmp = (sin(ky) * sin(th)) / sin(ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -2e-39) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-70) {
tmp = Math.sin(th) / ((Math.sin(kx) / ky) + (ky * (0.5 / kx)));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-39: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-70: tmp = math.sin(th) / ((math.sin(kx) / ky) + (ky * (0.5 / kx))) else: tmp = (math.sin(ky) * math.sin(th)) / math.sin(ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-39) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-70) tmp = Float64(sin(th) / Float64(Float64(sin(kx) / ky) + Float64(ky * Float64(0.5 / kx)))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-39) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-70) tmp = sin(th) / ((sin(kx) / ky) + (ky * (0.5 / kx))); else tmp = (sin(ky) * sin(th)) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-39], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-70], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision] + N[(ky * N[(0.5 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-39}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky} + ky \cdot \frac{0.5}{kx}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999986e-39Initial program 99.7%
associate-*l/99.4%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.9%
clear-num2.9%
inv-pow2.9%
Applied egg-rr2.9%
unpow-12.9%
Simplified2.9%
add-sqr-sqrt1.1%
sqrt-unprod25.0%
pow225.0%
un-div-inv25.0%
Applied egg-rr25.0%
unpow225.0%
rem-sqrt-square38.9%
associate-/r/39.0%
*-inverses39.0%
*-lft-identity39.0%
Simplified39.0%
if -1.99999999999999986e-39 < (sin.f64 ky) < 4.9999999999999998e-70Initial program 81.5%
+-commutative81.5%
unpow281.5%
unpow281.5%
hypot-def99.7%
Simplified99.7%
associate-*l/91.7%
associate-*r/99.6%
expm1-log1p-u99.6%
expm1-udef27.8%
Applied egg-rr27.8%
expm1-def99.6%
expm1-log1p99.6%
*-commutative99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 53.4%
*-commutative53.4%
cancel-sign-sub-inv53.4%
associate-*r/53.4%
metadata-eval53.4%
metadata-eval53.4%
Simplified53.4%
Taylor expanded in kx around 0 53.4%
if 4.9999999999999998e-70 < (sin.f64 ky) Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in kx around 0 55.8%
Final simplification50.0%
(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 92.7%
associate-*l/92.2%
associate-*r/92.7%
+-commutative92.7%
unpow292.7%
unpow292.7%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -2e-39)
(fabs (sin th))
(if (<= (sin ky) 5e-70)
(/ (sin th) (+ (/ (sin kx) ky) (* ky (/ 0.5 kx))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-39) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-70) {
tmp = sin(th) / ((sin(kx) / ky) + (ky * (0.5 / 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-39)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-70) then
tmp = sin(th) / ((sin(kx) / ky) + (ky * (0.5d0 / 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-39) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-70) {
tmp = Math.sin(th) / ((Math.sin(kx) / ky) + (ky * (0.5 / kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -2e-39: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-70: tmp = math.sin(th) / ((math.sin(kx) / ky) + (ky * (0.5 / kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -2e-39) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-70) tmp = Float64(sin(th) / Float64(Float64(sin(kx) / ky) + Float64(ky * Float64(0.5 / kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -2e-39) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-70) tmp = sin(th) / ((sin(kx) / ky) + (ky * (0.5 / kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -2e-39], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-70], N[(N[Sin[th], $MachinePrecision] / N[(N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision] + N[(ky * N[(0.5 / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-39}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky} + ky \cdot \frac{0.5}{kx}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999986e-39Initial program 99.7%
associate-*l/99.4%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.9%
clear-num2.9%
inv-pow2.9%
Applied egg-rr2.9%
unpow-12.9%
Simplified2.9%
add-sqr-sqrt1.1%
sqrt-unprod25.0%
pow225.0%
un-div-inv25.0%
Applied egg-rr25.0%
unpow225.0%
rem-sqrt-square38.9%
associate-/r/39.0%
*-inverses39.0%
*-lft-identity39.0%
Simplified39.0%
if -1.99999999999999986e-39 < (sin.f64 ky) < 4.9999999999999998e-70Initial program 81.5%
+-commutative81.5%
unpow281.5%
unpow281.5%
hypot-def99.7%
Simplified99.7%
associate-*l/91.7%
associate-*r/99.6%
expm1-log1p-u99.6%
expm1-udef27.8%
Applied egg-rr27.8%
expm1-def99.6%
expm1-log1p99.6%
*-commutative99.6%
associate-/r/99.6%
Simplified99.6%
Taylor expanded in ky around 0 53.4%
*-commutative53.4%
cancel-sign-sub-inv53.4%
associate-*r/53.4%
metadata-eval53.4%
metadata-eval53.4%
Simplified53.4%
Taylor expanded in kx around 0 53.4%
if 4.9999999999999998e-70 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 54.9%
Final simplification49.7%
(FPCore (kx ky th)
:precision binary64
(if (<= th -2.65)
(/ (sin th) (+ 1.0 (* 0.5 (* (/ kx ky) (/ kx ky)))))
(if (<= th 7.2e-6)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= th 8.4e+102)
(fabs (* (sin th) (/ (sin ky) (sin kx))))
(/ (sin ky) (/ (sin kx) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= -2.65) {
tmp = sin(th) / (1.0 + (0.5 * ((kx / ky) * (kx / ky))));
} else if (th <= 7.2e-6) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (th <= 8.4e+102) {
tmp = fabs((sin(th) * (sin(ky) / sin(kx))));
} else {
tmp = sin(ky) / (sin(kx) / sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= -2.65) {
tmp = Math.sin(th) / (1.0 + (0.5 * ((kx / ky) * (kx / ky))));
} else if (th <= 7.2e-6) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (th <= 8.4e+102) {
tmp = Math.abs((Math.sin(th) * (Math.sin(ky) / Math.sin(kx))));
} else {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= -2.65: tmp = math.sin(th) / (1.0 + (0.5 * ((kx / ky) * (kx / ky)))) elif th <= 7.2e-6: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif th <= 8.4e+102: tmp = math.fabs((math.sin(th) * (math.sin(ky) / math.sin(kx)))) else: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= -2.65) tmp = Float64(sin(th) / Float64(1.0 + Float64(0.5 * Float64(Float64(kx / ky) * Float64(kx / ky))))); elseif (th <= 7.2e-6) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (th <= 8.4e+102) tmp = abs(Float64(sin(th) * Float64(sin(ky) / sin(kx)))); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= -2.65) tmp = sin(th) / (1.0 + (0.5 * ((kx / ky) * (kx / ky)))); elseif (th <= 7.2e-6) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (th <= 8.4e+102) tmp = abs((sin(th) * (sin(ky) / sin(kx)))); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, -2.65], N[(N[Sin[th], $MachinePrecision] / N[(1.0 + N[(0.5 * N[(N[(kx / ky), $MachinePrecision] * N[(kx / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 7.2e-6], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 8.4e+102], N[Abs[N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq -2.65:\\
\;\;\;\;\frac{\sin th}{1 + 0.5 \cdot \left(\frac{kx}{ky} \cdot \frac{kx}{ky}\right)}\\
\mathbf{elif}\;th \leq 7.2 \cdot 10^{-6}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 8.4 \cdot 10^{+102}:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if th < -2.64999999999999991Initial program 93.3%
+-commutative93.3%
unpow293.3%
unpow293.3%
hypot-def99.6%
Simplified99.6%
associate-*l/99.5%
associate-*r/99.5%
expm1-log1p-u99.5%
expm1-udef68.4%
Applied egg-rr68.4%
expm1-def99.5%
expm1-log1p99.5%
*-commutative99.5%
associate-/r/99.5%
Simplified99.5%
Taylor expanded in kx around 0 26.5%
associate-*r/26.5%
unpow226.5%
Simplified26.5%
Taylor expanded in ky around 0 27.1%
unpow227.1%
unpow227.1%
times-frac29.9%
Simplified29.9%
if -2.64999999999999991 < th < 7.19999999999999967e-6Initial program 91.2%
associate-*l/90.1%
+-commutative90.1%
unpow290.1%
unpow290.1%
hypot-def92.6%
Simplified92.6%
Taylor expanded in th around 0 92.4%
expm1-log1p-u92.4%
expm1-udef19.7%
div-inv19.7%
*-commutative19.7%
associate-*l*19.7%
div-inv19.7%
Applied egg-rr19.7%
expm1-def99.5%
expm1-log1p99.5%
*-commutative99.5%
associate-*l/92.4%
associate-*r/99.5%
Simplified99.5%
if 7.19999999999999967e-6 < th < 8.40000000000000006e102Initial program 95.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 19.3%
add-sqr-sqrt13.3%
sqrt-unprod24.6%
pow224.6%
*-commutative24.6%
Applied egg-rr24.6%
unpow224.6%
rem-sqrt-square39.1%
Simplified39.1%
if 8.40000000000000006e102 < th Initial program 93.7%
associate-/r/93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 33.3%
Final simplification62.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -2e-39) (fabs (sin th)) (if (<= (sin ky) 5e-70) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -2e-39) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 5e-70) {
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-39)) then
tmp = abs(sin(th))
else if (sin(ky) <= 5d-70) 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-39) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 5e-70) {
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-39: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 5e-70: 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-39) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-70) 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-39) tmp = abs(sin(th)); elseif (sin(ky) <= 5e-70) 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-39], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-70], 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^{-39}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-70}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.99999999999999986e-39Initial program 99.7%
associate-*l/99.4%
associate-*r/99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.9%
clear-num2.9%
inv-pow2.9%
Applied egg-rr2.9%
unpow-12.9%
Simplified2.9%
add-sqr-sqrt1.1%
sqrt-unprod25.0%
pow225.0%
un-div-inv25.0%
Applied egg-rr25.0%
unpow225.0%
rem-sqrt-square38.9%
associate-/r/39.0%
*-inverses39.0%
*-lft-identity39.0%
Simplified39.0%
if -1.99999999999999986e-39 < (sin.f64 ky) < 4.9999999999999998e-70Initial program 81.5%
+-commutative81.5%
unpow281.5%
unpow281.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 53.1%
if 4.9999999999999998e-70 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 54.9%
Final simplification49.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -5e-186) (fabs (sin th)) (if (<= (sin ky) 2e-197) (/ (sin th) (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-186) {
tmp = fabs(sin(th));
} else if (sin(ky) <= 2e-197) {
tmp = sin(th) / (kx / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-5d-186)) then
tmp = abs(sin(th))
else if (sin(ky) <= 2d-197) then
tmp = sin(th) / (kx / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-186) {
tmp = Math.abs(Math.sin(th));
} else if (Math.sin(ky) <= 2e-197) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-186: tmp = math.fabs(math.sin(th)) elif math.sin(ky) <= 2e-197: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-186) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-197) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-186) tmp = abs(sin(th)); elseif (sin(ky) <= 2e-197) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-186], N[Abs[N[Sin[th], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-197], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-186}:\\
\;\;\;\;\left|\sin th\right|\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-197}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5e-186Initial program 98.8%
associate-*l/97.7%
associate-*r/98.7%
+-commutative98.7%
unpow298.7%
unpow298.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 2.8%
clear-num2.8%
inv-pow2.8%
Applied egg-rr2.8%
unpow-12.8%
Simplified2.8%
add-sqr-sqrt1.1%
sqrt-unprod22.3%
pow222.3%
un-div-inv22.3%
Applied egg-rr22.3%
unpow222.3%
rem-sqrt-square32.0%
associate-/r/32.1%
*-inverses32.1%
*-lft-identity32.1%
Simplified32.1%
if -5e-186 < (sin.f64 ky) < 2e-197Initial program 71.2%
+-commutative71.2%
unpow271.2%
unpow271.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 68.2%
Taylor expanded in kx around 0 42.8%
associate-/l*44.4%
Simplified44.4%
Taylor expanded in ky around 0 42.8%
associate-/l*44.4%
Simplified44.4%
if 2e-197 < (sin.f64 ky) Initial program 97.0%
+-commutative97.0%
unpow297.0%
unpow297.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 51.4%
Final simplification42.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-197) (/ (sin th) (+ (/ kx ky) (* 0.16666666666666666 (* ky kx)))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-197) {
tmp = sin(th) / ((kx / ky) + (0.16666666666666666 * (ky * kx)));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-197) then
tmp = sin(th) / ((kx / ky) + (0.16666666666666666d0 * (ky * kx)))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-197) {
tmp = Math.sin(th) / ((kx / ky) + (0.16666666666666666 * (ky * kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-197: tmp = math.sin(th) / ((kx / ky) + (0.16666666666666666 * (ky * kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-197) tmp = Float64(sin(th) / Float64(Float64(kx / ky) + Float64(0.16666666666666666 * Float64(ky * kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-197) tmp = sin(th) / ((kx / ky) + (0.16666666666666666 * (ky * kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-197], N[(N[Sin[th], $MachinePrecision] / N[(N[(kx / ky), $MachinePrecision] + N[(0.16666666666666666 * N[(ky * kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-197}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky} + 0.16666666666666666 \cdot \left(ky \cdot kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2e-197Initial program 90.0%
+-commutative90.0%
unpow290.0%
unpow290.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 32.4%
Taylor expanded in kx around 0 18.6%
associate-/l*19.1%
Simplified19.1%
Taylor expanded in ky around 0 19.5%
if 2e-197 < (sin.f64 ky) Initial program 97.0%
+-commutative97.0%
unpow297.0%
unpow297.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 51.4%
Final simplification31.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-197) (/ (sin ky) (/ kx th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-197) {
tmp = sin(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 (sin(ky) <= 2d-197) then
tmp = sin(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 (Math.sin(ky) <= 2e-197) {
tmp = Math.sin(ky) / (kx / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-197: tmp = math.sin(ky) / (kx / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-197) tmp = Float64(sin(ky) / Float64(kx / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-197) tmp = sin(ky) / (kx / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-197], N[(N[Sin[ky], $MachinePrecision] / N[(kx / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-197}:\\
\;\;\;\;\frac{\sin ky}{\frac{kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2e-197Initial program 90.0%
+-commutative90.0%
unpow290.0%
unpow290.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 32.4%
Taylor expanded in kx around 0 18.6%
associate-/l*19.1%
Simplified19.1%
Taylor expanded in th around 0 13.1%
associate-/l*13.6%
Simplified13.6%
if 2e-197 < (sin.f64 ky) Initial program 97.0%
+-commutative97.0%
unpow297.0%
unpow297.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 51.4%
Final simplification28.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-197) (/ (sin th) (/ kx ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-197) {
tmp = sin(th) / (kx / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 2d-197) then
tmp = sin(th) / (kx / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 2e-197) {
tmp = Math.sin(th) / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 2e-197: tmp = math.sin(th) / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 2e-197) tmp = Float64(sin(th) / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 2e-197) tmp = sin(th) / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-197], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-197}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2e-197Initial program 90.0%
+-commutative90.0%
unpow290.0%
unpow290.0%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 32.4%
Taylor expanded in kx around 0 18.6%
associate-/l*19.1%
Simplified19.1%
Taylor expanded in ky around 0 18.5%
associate-/l*19.0%
Simplified19.0%
if 2e-197 < (sin.f64 ky) Initial program 97.0%
+-commutative97.0%
unpow297.0%
unpow297.0%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 51.4%
Final simplification31.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -3.7e-36) (sin th) (if (<= ky 3.6e-193) (/ ky (/ (sin kx) th)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -3.7e-36) {
tmp = sin(th);
} else if (ky <= 3.6e-193) {
tmp = ky / (sin(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 <= (-3.7d-36)) then
tmp = sin(th)
else if (ky <= 3.6d-193) then
tmp = ky / (sin(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 <= -3.7e-36) {
tmp = Math.sin(th);
} else if (ky <= 3.6e-193) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -3.7e-36: tmp = math.sin(th) elif ky <= 3.6e-193: tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -3.7e-36) tmp = sin(th); elseif (ky <= 3.6e-193) tmp = Float64(ky / Float64(sin(kx) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -3.7e-36) tmp = sin(th); elseif (ky <= 3.6e-193) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -3.7e-36], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.6e-193], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3.7 \cdot 10^{-36}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.6 \cdot 10^{-193}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -3.70000000000000002e-36 or 3.5999999999999999e-193 < ky Initial program 98.2%
+-commutative98.2%
unpow298.2%
unpow298.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 30.9%
if -3.70000000000000002e-36 < ky < 3.5999999999999999e-193Initial program 81.6%
associate-*l/80.4%
+-commutative80.4%
unpow280.4%
unpow280.4%
hypot-def91.4%
Simplified91.4%
Taylor expanded in th around 0 31.6%
Taylor expanded in ky around 0 21.3%
associate-/l*22.2%
Simplified22.2%
Final simplification28.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -6.8e-7) (sin th) (if (<= ky 3.2e-185) (/ th (/ kx ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -6.8e-7) {
tmp = sin(th);
} else if (ky <= 3.2e-185) {
tmp = th / (kx / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-6.8d-7)) then
tmp = sin(th)
else if (ky <= 3.2d-185) then
tmp = th / (kx / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -6.8e-7) {
tmp = Math.sin(th);
} else if (ky <= 3.2e-185) {
tmp = th / (kx / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -6.8e-7: tmp = math.sin(th) elif ky <= 3.2e-185: tmp = th / (kx / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -6.8e-7) tmp = sin(th); elseif (ky <= 3.2e-185) tmp = Float64(th / Float64(kx / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -6.8e-7) tmp = sin(th); elseif (ky <= 3.2e-185) tmp = th / (kx / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -6.8e-7], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 3.2e-185], N[(th / N[(kx / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -6.8 \cdot 10^{-7}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.2 \cdot 10^{-185}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.79999999999999948e-7 or 3.1999999999999997e-185 < ky Initial program 98.1%
+-commutative98.1%
unpow298.1%
unpow298.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 31.7%
if -6.79999999999999948e-7 < ky < 3.1999999999999997e-185Initial program 82.6%
associate-*l/81.4%
+-commutative81.4%
unpow281.4%
unpow281.4%
hypot-def91.9%
Simplified91.9%
Taylor expanded in th around 0 32.2%
Taylor expanded in ky around 0 20.2%
associate-/l*21.1%
Simplified21.1%
Taylor expanded in kx around 0 20.0%
associate-/l*21.1%
Simplified21.1%
Final simplification28.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -8e-19) th (if (<= ky 4.6e-122) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -8e-19) {
tmp = th;
} else if (ky <= 4.6e-122) {
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 <= (-8d-19)) then
tmp = th
else if (ky <= 4.6d-122) 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 <= -8e-19) {
tmp = th;
} else if (ky <= 4.6e-122) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -8e-19: tmp = th elif ky <= 4.6e-122: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -8e-19) tmp = th; elseif (ky <= 4.6e-122) 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 <= -8e-19) tmp = th; elseif (ky <= 4.6e-122) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -8e-19], th, If[LessEqual[ky, 4.6e-122], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -8 \cdot 10^{-19}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 4.6 \cdot 10^{-122}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -7.9999999999999998e-19 or 4.60000000000000014e-122 < ky Initial program 99.7%
associate-*l/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 49.3%
Taylor expanded in kx around 0 14.3%
if -7.9999999999999998e-19 < ky < 4.60000000000000014e-122Initial program 80.7%
associate-*l/79.6%
+-commutative79.6%
unpow279.6%
unpow279.6%
hypot-def91.4%
Simplified91.4%
Taylor expanded in th around 0 32.7%
Taylor expanded in ky around 0 20.5%
associate-/l*21.3%
Simplified21.3%
Taylor expanded in kx around 0 21.1%
associate-/r/21.3%
Applied egg-rr21.3%
Final simplification16.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky -4.5e-19) th (if (<= ky 1.12e-122) (/ th (/ kx ky)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -4.5e-19) {
tmp = th;
} else if (ky <= 1.12e-122) {
tmp = th / (kx / ky);
} else {
tmp = th;
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-4.5d-19)) then
tmp = th
else if (ky <= 1.12d-122) then
tmp = th / (kx / ky)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -4.5e-19) {
tmp = th;
} else if (ky <= 1.12e-122) {
tmp = th / (kx / ky);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -4.5e-19: tmp = th elif ky <= 1.12e-122: tmp = th / (kx / ky) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -4.5e-19) tmp = th; elseif (ky <= 1.12e-122) tmp = Float64(th / Float64(kx / ky)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -4.5e-19) tmp = th; elseif (ky <= 1.12e-122) tmp = th / (kx / ky); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -4.5e-19], th, If[LessEqual[ky, 1.12e-122], N[(th / N[(kx / ky), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -4.5 \cdot 10^{-19}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 1.12 \cdot 10^{-122}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -4.50000000000000013e-19 or 1.12e-122 < ky Initial program 99.7%
associate-*l/99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.5%
Simplified99.5%
Taylor expanded in th around 0 49.3%
Taylor expanded in kx around 0 14.3%
if -4.50000000000000013e-19 < ky < 1.12e-122Initial program 80.7%
associate-*l/79.6%
+-commutative79.6%
unpow279.6%
unpow279.6%
hypot-def91.4%
Simplified91.4%
Taylor expanded in th around 0 32.7%
Taylor expanded in ky around 0 20.5%
associate-/l*21.3%
Simplified21.3%
Taylor expanded in kx around 0 20.3%
associate-/l*21.3%
Simplified21.3%
Final simplification16.9%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 92.7%
associate-*l/92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def96.5%
Simplified96.5%
Taylor expanded in th around 0 43.2%
Taylor expanded in kx around 0 11.1%
Final simplification11.1%
herbie shell --seed 2023189
(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)))