
(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 15 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 95.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.1) (- (sin th)) (if (<= (sin ky) 1e-16) (* (sin th) (/ ky (hypot ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.1) {
tmp = -sin(th);
} else if (sin(ky) <= 1e-16) {
tmp = sin(th) * (ky / hypot(ky, sin(kx)));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.1) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 1e-16) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.1: tmp = -math.sin(th) elif math.sin(ky) <= 1e-16: tmp = math.sin(th) * (ky / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.1) tmp = Float64(-sin(th)); elseif (sin(ky) <= 1e-16) tmp = Float64(sin(th) * Float64(ky / hypot(ky, sin(kx)))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.1) tmp = -sin(th); elseif (sin(ky) <= 1e-16) tmp = sin(th) * (ky / hypot(ky, sin(kx))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.1], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-16], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.1:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 10^{-16}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.10000000000000001Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 5.6%
Taylor expanded in ky around -inf 4.4%
mul-1-neg4.4%
associate-/l*4.4%
distribute-neg-frac4.4%
Simplified4.4%
Taylor expanded in ky around 0 66.5%
neg-mul-166.5%
Simplified66.5%
if -0.10000000000000001 < (sin.f64 ky) < 9.9999999999999998e-17Initial program 91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 98.6%
Taylor expanded in ky around 0 98.9%
if 9.9999999999999998e-17 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 66.9%
Final simplification81.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-29)
(- (sin th))
(if (<= (sin ky) 1e-168)
(/ (/ ky (sin kx)) (/ 1.0 (sin th)))
(/ (* (sin ky) (sin th)) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-29) {
tmp = -sin(th);
} else if (sin(ky) <= 1e-168) {
tmp = (ky / sin(kx)) / (1.0 / sin(th));
} else {
tmp = (sin(ky) * sin(th)) / sin(ky);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-1d-29)) then
tmp = -sin(th)
else if (sin(ky) <= 1d-168) then
tmp = (ky / sin(kx)) / (1.0d0 / sin(th))
else
tmp = (sin(ky) * sin(th)) / sin(ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-29) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 1e-168) {
tmp = (ky / Math.sin(kx)) / (1.0 / Math.sin(th));
} else {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-29: tmp = -math.sin(th) elif math.sin(ky) <= 1e-168: tmp = (ky / math.sin(kx)) / (1.0 / math.sin(th)) else: tmp = (math.sin(ky) * math.sin(th)) / math.sin(ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-29) tmp = Float64(-sin(th)); elseif (sin(ky) <= 1e-168) tmp = Float64(Float64(ky / sin(kx)) / Float64(1.0 / sin(th))); else tmp = Float64(Float64(sin(ky) * sin(th)) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-29) tmp = -sin(th); elseif (sin(ky) <= 1e-168) tmp = (ky / sin(kx)) / (1.0 / sin(th)); else tmp = (sin(ky) * sin(th)) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-29], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-168], N[(N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[Sin[th], $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 -1 \cdot 10^{-29}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 10^{-168}:\\
\;\;\;\;\frac{\frac{ky}{\sin kx}}{\frac{1}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.99999999999999943e-30Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 12.7%
Taylor expanded in ky around -inf 9.2%
mul-1-neg9.2%
associate-/l*9.2%
distribute-neg-frac9.2%
Simplified9.2%
Taylor expanded in ky around 0 66.1%
neg-mul-166.1%
Simplified66.1%
if -9.99999999999999943e-30 < (sin.f64 ky) < 1e-168Initial program 87.2%
+-commutative87.2%
unpow287.2%
unpow287.2%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 53.5%
if 1e-168 < (sin.f64 ky) Initial program 99.7%
associate-*l/98.7%
+-commutative98.7%
unpow298.7%
unpow298.7%
hypot-def98.7%
Simplified98.7%
Taylor expanded in kx around 0 62.4%
Final simplification60.8%
(FPCore (kx ky th) :precision binary64 (* (sin ky) (/ (sin th) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(ky) * (sin(th) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(ky) * (sin(th) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 95.9%
associate-*l/94.4%
associate-*r/95.8%
+-commutative95.8%
unpow295.8%
unpow295.8%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-29) (- (sin th)) (if (<= (sin ky) 5e-136) (* (sin th) (/ ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-29) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-136) {
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-29)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-136) 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-29) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-136) {
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-29: tmp = -math.sin(th) elif math.sin(ky) <= 5e-136: 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-29) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-136) 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-29) tmp = -sin(th); elseif (sin(ky) <= 5e-136) 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-29], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-136], 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 -1 \cdot 10^{-29}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-136}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.99999999999999943e-30Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 12.7%
Taylor expanded in ky around -inf 9.2%
mul-1-neg9.2%
associate-/l*9.2%
distribute-neg-frac9.2%
Simplified9.2%
Taylor expanded in ky around 0 66.1%
neg-mul-166.1%
Simplified66.1%
if -9.99999999999999943e-30 < (sin.f64 ky) < 5.0000000000000002e-136Initial program 88.1%
+-commutative88.1%
unpow288.1%
unpow288.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 53.3%
if 5.0000000000000002e-136 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 62.2%
Final simplification60.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-29) (- (sin th)) (if (<= (sin ky) 5e-136) (/ (sin th) (/ (sin kx) ky)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-29) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-136) {
tmp = sin(th) / (sin(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) <= (-1d-29)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-136) then
tmp = sin(th) / (sin(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) <= -1e-29) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-136) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-29: tmp = -math.sin(th) elif math.sin(ky) <= 5e-136: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-29) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-136) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-29) tmp = -sin(th); elseif (sin(ky) <= 5e-136) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-29], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-136], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-29}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-136}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -9.99999999999999943e-30Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 12.7%
Taylor expanded in ky around -inf 9.2%
mul-1-neg9.2%
associate-/l*9.2%
distribute-neg-frac9.2%
Simplified9.2%
Taylor expanded in ky around 0 66.1%
neg-mul-166.1%
Simplified66.1%
if -9.99999999999999943e-30 < (sin.f64 ky) < 5.0000000000000002e-136Initial program 88.1%
+-commutative88.1%
unpow288.1%
unpow288.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 52.4%
associate-/l*53.4%
Simplified53.4%
if 5.0000000000000002e-136 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 62.2%
Final simplification60.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -1.1e+126)
t_1
(if (<= ky -1800.0)
(sin th)
(if (<= ky -1.9e-135)
t_1
(if (<= ky 1.8e-143)
(/ (/ ky kx) (/ 1.0 (sin th)))
(if (<= ky 8e+58)
(sin th)
(if (<= ky 1.05e+138) t_1 (sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -1.1e+126) {
tmp = t_1;
} else if (ky <= -1800.0) {
tmp = sin(th);
} else if (ky <= -1.9e-135) {
tmp = t_1;
} else if (ky <= 1.8e-143) {
tmp = (ky / kx) / (1.0 / sin(th));
} else if (ky <= 8e+58) {
tmp = sin(th);
} else if (ky <= 1.05e+138) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-1.1d+126)) then
tmp = t_1
else if (ky <= (-1800.0d0)) then
tmp = sin(th)
else if (ky <= (-1.9d-135)) then
tmp = t_1
else if (ky <= 1.8d-143) then
tmp = (ky / kx) / (1.0d0 / sin(th))
else if (ky <= 8d+58) then
tmp = sin(th)
else if (ky <= 1.05d+138) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = -Math.sin(th);
double tmp;
if (ky <= -1.1e+126) {
tmp = t_1;
} else if (ky <= -1800.0) {
tmp = Math.sin(th);
} else if (ky <= -1.9e-135) {
tmp = t_1;
} else if (ky <= 1.8e-143) {
tmp = (ky / kx) / (1.0 / Math.sin(th));
} else if (ky <= 8e+58) {
tmp = Math.sin(th);
} else if (ky <= 1.05e+138) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -1.1e+126: tmp = t_1 elif ky <= -1800.0: tmp = math.sin(th) elif ky <= -1.9e-135: tmp = t_1 elif ky <= 1.8e-143: tmp = (ky / kx) / (1.0 / math.sin(th)) elif ky <= 8e+58: tmp = math.sin(th) elif ky <= 1.05e+138: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -1.1e+126) tmp = t_1; elseif (ky <= -1800.0) tmp = sin(th); elseif (ky <= -1.9e-135) tmp = t_1; elseif (ky <= 1.8e-143) tmp = Float64(Float64(ky / kx) / Float64(1.0 / sin(th))); elseif (ky <= 8e+58) tmp = sin(th); elseif (ky <= 1.05e+138) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -1.1e+126) tmp = t_1; elseif (ky <= -1800.0) tmp = sin(th); elseif (ky <= -1.9e-135) tmp = t_1; elseif (ky <= 1.8e-143) tmp = (ky / kx) / (1.0 / sin(th)); elseif (ky <= 8e+58) tmp = sin(th); elseif (ky <= 1.05e+138) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -1.1e+126], t$95$1, If[LessEqual[ky, -1800.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -1.9e-135], t$95$1, If[LessEqual[ky, 1.8e-143], N[(N[(ky / kx), $MachinePrecision] / N[(1.0 / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 8e+58], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.05e+138], t$95$1, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -1.1 \cdot 10^{+126}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -1800:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -1.9 \cdot 10^{-135}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 1.8 \cdot 10^{-143}:\\
\;\;\;\;\frac{\frac{ky}{kx}}{\frac{1}{\sin th}}\\
\mathbf{elif}\;ky \leq 8 \cdot 10^{+58}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.05 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.09999999999999999e126 or -1800 < ky < -1.9000000000000001e-135 or 7.99999999999999955e58 < ky < 1.05000000000000003e138Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 33.2%
Taylor expanded in ky around -inf 16.5%
mul-1-neg16.5%
associate-/l*16.6%
distribute-neg-frac16.6%
Simplified16.6%
Taylor expanded in ky around 0 46.8%
neg-mul-146.8%
Simplified46.8%
if -1.09999999999999999e126 < ky < -1800 or 1.7999999999999999e-143 < ky < 7.99999999999999955e58 or 1.05000000000000003e138 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 45.2%
if -1.9000000000000001e-135 < ky < 1.7999999999999999e-143Initial program 83.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 62.4%
Taylor expanded in kx around 0 47.2%
Final simplification46.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -1.1e+126)
t_1
(if (<= ky -1800.0)
(sin th)
(if (<= ky -2.8e-152)
t_1
(if (<= ky 3.6e-195)
(sqrt (* th th))
(if (<= ky 8e+58)
(sin th)
(if (<= ky 1.05e+138) t_1 (sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -1.1e+126) {
tmp = t_1;
} else if (ky <= -1800.0) {
tmp = sin(th);
} else if (ky <= -2.8e-152) {
tmp = t_1;
} else if (ky <= 3.6e-195) {
tmp = sqrt((th * th));
} else if (ky <= 8e+58) {
tmp = sin(th);
} else if (ky <= 1.05e+138) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-1.1d+126)) then
tmp = t_1
else if (ky <= (-1800.0d0)) then
tmp = sin(th)
else if (ky <= (-2.8d-152)) then
tmp = t_1
else if (ky <= 3.6d-195) then
tmp = sqrt((th * th))
else if (ky <= 8d+58) then
tmp = sin(th)
else if (ky <= 1.05d+138) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = -Math.sin(th);
double tmp;
if (ky <= -1.1e+126) {
tmp = t_1;
} else if (ky <= -1800.0) {
tmp = Math.sin(th);
} else if (ky <= -2.8e-152) {
tmp = t_1;
} else if (ky <= 3.6e-195) {
tmp = Math.sqrt((th * th));
} else if (ky <= 8e+58) {
tmp = Math.sin(th);
} else if (ky <= 1.05e+138) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -1.1e+126: tmp = t_1 elif ky <= -1800.0: tmp = math.sin(th) elif ky <= -2.8e-152: tmp = t_1 elif ky <= 3.6e-195: tmp = math.sqrt((th * th)) elif ky <= 8e+58: tmp = math.sin(th) elif ky <= 1.05e+138: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -1.1e+126) tmp = t_1; elseif (ky <= -1800.0) tmp = sin(th); elseif (ky <= -2.8e-152) tmp = t_1; elseif (ky <= 3.6e-195) tmp = sqrt(Float64(th * th)); elseif (ky <= 8e+58) tmp = sin(th); elseif (ky <= 1.05e+138) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -1.1e+126) tmp = t_1; elseif (ky <= -1800.0) tmp = sin(th); elseif (ky <= -2.8e-152) tmp = t_1; elseif (ky <= 3.6e-195) tmp = sqrt((th * th)); elseif (ky <= 8e+58) tmp = sin(th); elseif (ky <= 1.05e+138) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -1.1e+126], t$95$1, If[LessEqual[ky, -1800.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -2.8e-152], t$95$1, If[LessEqual[ky, 3.6e-195], N[Sqrt[N[(th * th), $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 8e+58], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.05e+138], t$95$1, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -1.1 \cdot 10^{+126}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -1800:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -2.8 \cdot 10^{-152}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 3.6 \cdot 10^{-195}:\\
\;\;\;\;\sqrt{th \cdot th}\\
\mathbf{elif}\;ky \leq 8 \cdot 10^{+58}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.05 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.09999999999999999e126 or -1800 < ky < -2.79999999999999984e-152 or 7.99999999999999955e58 < ky < 1.05000000000000003e138Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 37.1%
Taylor expanded in ky around -inf 15.9%
mul-1-neg15.9%
associate-/l*15.9%
distribute-neg-frac15.9%
Simplified15.9%
Taylor expanded in ky around 0 44.4%
neg-mul-144.4%
Simplified44.4%
if -1.09999999999999999e126 < ky < -1800 or 3.6e-195 < ky < 7.99999999999999955e58 or 1.05000000000000003e138 < ky Initial program 97.4%
+-commutative97.4%
unpow297.4%
unpow297.4%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 45.0%
if -2.79999999999999984e-152 < ky < 3.6e-195Initial program 85.5%
+-commutative85.5%
unpow285.5%
unpow285.5%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 7.1%
Taylor expanded in th around 0 4.8%
remove-double-div4.8%
add-sqr-sqrt2.8%
sqrt-unprod39.0%
Applied egg-rr39.0%
Final simplification43.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -1.1e+126)
t_1
(if (<= ky -1800.0)
(sin th)
(if (<= ky -3.7e-148)
t_1
(if (<= ky 2.8e-195)
(/ ky (/ (sin kx) th))
(if (<= ky 8e+58)
(sin th)
(if (<= ky 1.05e+138) t_1 (sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -1.1e+126) {
tmp = t_1;
} else if (ky <= -1800.0) {
tmp = sin(th);
} else if (ky <= -3.7e-148) {
tmp = t_1;
} else if (ky <= 2.8e-195) {
tmp = ky / (sin(kx) / th);
} else if (ky <= 8e+58) {
tmp = sin(th);
} else if (ky <= 1.05e+138) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-1.1d+126)) then
tmp = t_1
else if (ky <= (-1800.0d0)) then
tmp = sin(th)
else if (ky <= (-3.7d-148)) then
tmp = t_1
else if (ky <= 2.8d-195) then
tmp = ky / (sin(kx) / th)
else if (ky <= 8d+58) then
tmp = sin(th)
else if (ky <= 1.05d+138) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = -Math.sin(th);
double tmp;
if (ky <= -1.1e+126) {
tmp = t_1;
} else if (ky <= -1800.0) {
tmp = Math.sin(th);
} else if (ky <= -3.7e-148) {
tmp = t_1;
} else if (ky <= 2.8e-195) {
tmp = ky / (Math.sin(kx) / th);
} else if (ky <= 8e+58) {
tmp = Math.sin(th);
} else if (ky <= 1.05e+138) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -1.1e+126: tmp = t_1 elif ky <= -1800.0: tmp = math.sin(th) elif ky <= -3.7e-148: tmp = t_1 elif ky <= 2.8e-195: tmp = ky / (math.sin(kx) / th) elif ky <= 8e+58: tmp = math.sin(th) elif ky <= 1.05e+138: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -1.1e+126) tmp = t_1; elseif (ky <= -1800.0) tmp = sin(th); elseif (ky <= -3.7e-148) tmp = t_1; elseif (ky <= 2.8e-195) tmp = Float64(ky / Float64(sin(kx) / th)); elseif (ky <= 8e+58) tmp = sin(th); elseif (ky <= 1.05e+138) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -1.1e+126) tmp = t_1; elseif (ky <= -1800.0) tmp = sin(th); elseif (ky <= -3.7e-148) tmp = t_1; elseif (ky <= 2.8e-195) tmp = ky / (sin(kx) / th); elseif (ky <= 8e+58) tmp = sin(th); elseif (ky <= 1.05e+138) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -1.1e+126], t$95$1, If[LessEqual[ky, -1800.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -3.7e-148], t$95$1, If[LessEqual[ky, 2.8e-195], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 8e+58], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.05e+138], t$95$1, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -1.1 \cdot 10^{+126}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -1800:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -3.7 \cdot 10^{-148}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 2.8 \cdot 10^{-195}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{elif}\;ky \leq 8 \cdot 10^{+58}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.05 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.09999999999999999e126 or -1800 < ky < -3.70000000000000034e-148 or 7.99999999999999955e58 < ky < 1.05000000000000003e138Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 34.8%
Taylor expanded in ky around -inf 16.3%
mul-1-neg16.3%
associate-/l*16.3%
distribute-neg-frac16.3%
Simplified16.3%
Taylor expanded in ky around 0 45.8%
neg-mul-145.8%
Simplified45.8%
if -1.09999999999999999e126 < ky < -1800 or 2.80000000000000003e-195 < ky < 7.99999999999999955e58 or 1.05000000000000003e138 < ky Initial program 97.4%
+-commutative97.4%
unpow297.4%
unpow297.4%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 45.0%
if -3.70000000000000034e-148 < ky < 2.80000000000000003e-195Initial program 86.3%
+-commutative86.3%
unpow286.3%
unpow286.3%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in th around 0 50.8%
Taylor expanded in ky around 0 42.0%
associate-/l*43.7%
Simplified43.7%
Final simplification45.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -1.1e+126)
t_1
(if (<= ky -1800.0)
(sin th)
(if (<= ky -6e-136)
t_1
(if (<= ky 2.6e-144)
(/ (sin th) (/ kx ky))
(if (<= ky 8e+58)
(sin th)
(if (<= ky 1.05e+138) t_1 (sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -1.1e+126) {
tmp = t_1;
} else if (ky <= -1800.0) {
tmp = sin(th);
} else if (ky <= -6e-136) {
tmp = t_1;
} else if (ky <= 2.6e-144) {
tmp = sin(th) / (kx / ky);
} else if (ky <= 8e+58) {
tmp = sin(th);
} else if (ky <= 1.05e+138) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (ky <= (-1.1d+126)) then
tmp = t_1
else if (ky <= (-1800.0d0)) then
tmp = sin(th)
else if (ky <= (-6d-136)) then
tmp = t_1
else if (ky <= 2.6d-144) then
tmp = sin(th) / (kx / ky)
else if (ky <= 8d+58) then
tmp = sin(th)
else if (ky <= 1.05d+138) then
tmp = t_1
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = -Math.sin(th);
double tmp;
if (ky <= -1.1e+126) {
tmp = t_1;
} else if (ky <= -1800.0) {
tmp = Math.sin(th);
} else if (ky <= -6e-136) {
tmp = t_1;
} else if (ky <= 2.6e-144) {
tmp = Math.sin(th) / (kx / ky);
} else if (ky <= 8e+58) {
tmp = Math.sin(th);
} else if (ky <= 1.05e+138) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -1.1e+126: tmp = t_1 elif ky <= -1800.0: tmp = math.sin(th) elif ky <= -6e-136: tmp = t_1 elif ky <= 2.6e-144: tmp = math.sin(th) / (kx / ky) elif ky <= 8e+58: tmp = math.sin(th) elif ky <= 1.05e+138: tmp = t_1 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (ky <= -1.1e+126) tmp = t_1; elseif (ky <= -1800.0) tmp = sin(th); elseif (ky <= -6e-136) tmp = t_1; elseif (ky <= 2.6e-144) tmp = Float64(sin(th) / Float64(kx / ky)); elseif (ky <= 8e+58) tmp = sin(th); elseif (ky <= 1.05e+138) tmp = t_1; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (ky <= -1.1e+126) tmp = t_1; elseif (ky <= -1800.0) tmp = sin(th); elseif (ky <= -6e-136) tmp = t_1; elseif (ky <= 2.6e-144) tmp = sin(th) / (kx / ky); elseif (ky <= 8e+58) tmp = sin(th); elseif (ky <= 1.05e+138) tmp = t_1; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[ky, -1.1e+126], t$95$1, If[LessEqual[ky, -1800.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, -6e-136], t$95$1, If[LessEqual[ky, 2.6e-144], N[(N[Sin[th], $MachinePrecision] / N[(kx / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 8e+58], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.05e+138], t$95$1, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -1.1 \cdot 10^{+126}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -1800:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -6 \cdot 10^{-136}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 2.6 \cdot 10^{-144}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{elif}\;ky \leq 8 \cdot 10^{+58}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.05 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.09999999999999999e126 or -1800 < ky < -5.9999999999999996e-136 or 7.99999999999999955e58 < ky < 1.05000000000000003e138Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 33.2%
Taylor expanded in ky around -inf 16.5%
mul-1-neg16.5%
associate-/l*16.6%
distribute-neg-frac16.6%
Simplified16.6%
Taylor expanded in ky around 0 46.8%
neg-mul-146.8%
Simplified46.8%
if -1.09999999999999999e126 < ky < -1800 or 2.6000000000000001e-144 < ky < 7.99999999999999955e58 or 1.05000000000000003e138 < ky Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 45.2%
if -5.9999999999999996e-136 < ky < 2.6000000000000001e-144Initial program 83.7%
+-commutative83.7%
unpow283.7%
unpow283.7%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 62.4%
Taylor expanded in kx around 0 45.8%
associate-/l*47.2%
Simplified47.2%
Final simplification46.2%
(FPCore (kx ky th)
:precision binary64
(if (or (<= ky -1.1e+126)
(and (not (<= ky -1800.0))
(or (<= ky -5e-310)
(and (not (<= ky 8e+58)) (<= ky 1.05e+138)))))
(- (sin th))
(sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1.1e+126) || (!(ky <= -1800.0) && ((ky <= -5e-310) || (!(ky <= 8e+58) && (ky <= 1.05e+138))))) {
tmp = -sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((ky <= (-1.1d+126)) .or. (.not. (ky <= (-1800.0d0))) .and. (ky <= (-5d-310)) .or. (.not. (ky <= 8d+58)) .and. (ky <= 1.05d+138)) then
tmp = -sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1.1e+126) || (!(ky <= -1800.0) && ((ky <= -5e-310) || (!(ky <= 8e+58) && (ky <= 1.05e+138))))) {
tmp = -Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -1.1e+126) or (not (ky <= -1800.0) and ((ky <= -5e-310) or (not (ky <= 8e+58) and (ky <= 1.05e+138)))): tmp = -math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -1.1e+126) || (!(ky <= -1800.0) && ((ky <= -5e-310) || (!(ky <= 8e+58) && (ky <= 1.05e+138))))) tmp = Float64(-sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -1.1e+126) || (~((ky <= -1800.0)) && ((ky <= -5e-310) || (~((ky <= 8e+58)) && (ky <= 1.05e+138))))) tmp = -sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -1.1e+126], And[N[Not[LessEqual[ky, -1800.0]], $MachinePrecision], Or[LessEqual[ky, -5e-310], And[N[Not[LessEqual[ky, 8e+58]], $MachinePrecision], LessEqual[ky, 1.05e+138]]]]], (-N[Sin[th], $MachinePrecision]), N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1.1 \cdot 10^{+126} \lor \neg \left(ky \leq -1800\right) \land \left(ky \leq -5 \cdot 10^{-310} \lor \neg \left(ky \leq 8 \cdot 10^{+58}\right) \land ky \leq 1.05 \cdot 10^{+138}\right):\\
\;\;\;\;-\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.09999999999999999e126 or -1800 < ky < -4.999999999999985e-310 or 7.99999999999999955e58 < ky < 1.05000000000000003e138Initial program 96.2%
+-commutative96.2%
unpow296.2%
unpow296.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 53.4%
Taylor expanded in ky around -inf 24.6%
mul-1-neg24.6%
associate-/l*15.7%
distribute-neg-frac15.7%
Simplified15.7%
Taylor expanded in ky around 0 36.8%
neg-mul-136.8%
Simplified36.8%
if -1.09999999999999999e126 < ky < -1800 or -4.999999999999985e-310 < ky < 7.99999999999999955e58 or 1.05000000000000003e138 < ky Initial program 95.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 40.6%
Final simplification38.9%
(FPCore (kx ky th) :precision binary64 (if (<= th 9.2e-306) (sin th) (if (<= th 1.4e-50) (- th) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 9.2e-306) {
tmp = sin(th);
} else if (th <= 1.4e-50) {
tmp = -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 (th <= 9.2d-306) then
tmp = sin(th)
else if (th <= 1.4d-50) then
tmp = -th
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 9.2e-306) {
tmp = Math.sin(th);
} else if (th <= 1.4e-50) {
tmp = -th;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 9.2e-306: tmp = math.sin(th) elif th <= 1.4e-50: tmp = -th else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 9.2e-306) tmp = sin(th); elseif (th <= 1.4e-50) tmp = Float64(-th); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 9.2e-306) tmp = sin(th); elseif (th <= 1.4e-50) tmp = -th; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 9.2e-306], N[Sin[th], $MachinePrecision], If[LessEqual[th, 1.4e-50], (-th), N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 9.2 \cdot 10^{-306}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;th \leq 1.4 \cdot 10^{-50}:\\
\;\;\;\;-th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if th < 9.19999999999999956e-306 or 1.3999999999999999e-50 < th Initial program 95.5%
+-commutative95.5%
unpow295.5%
unpow295.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 30.5%
if 9.19999999999999956e-306 < th < 1.3999999999999999e-50Initial program 97.7%
+-commutative97.7%
unpow297.7%
unpow297.7%
hypot-def99.8%
Simplified99.8%
associate-/r/99.8%
div-inv99.7%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in kx around 0 15.3%
remove-double-div15.3%
remove-double-neg15.3%
add-sqr-sqrt0.0%
sqrt-unprod49.5%
sqr-neg49.5%
sqrt-unprod33.2%
distribute-rgt-neg-in33.2%
Applied egg-rr33.2%
Taylor expanded in th around 0 33.4%
neg-mul-133.4%
Simplified33.4%
Final simplification31.0%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5.9e-238) (- th) (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666)))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.9e-238) {
tmp = -th;
} else {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
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 <= (-5.9d-238)) then
tmp = -th
else
tmp = 1.0d0 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.9e-238) {
tmp = -th;
} else {
tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5.9e-238: tmp = -th else: tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5.9e-238) tmp = Float64(-th); else tmp = Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -5.9e-238) tmp = -th; else tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5.9e-238], (-th), N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5.9 \cdot 10^{-238}:\\
\;\;\;\;-th\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}\\
\end{array}
\end{array}
if ky < -5.8999999999999998e-238Initial program 97.7%
+-commutative97.7%
unpow297.7%
unpow297.7%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 17.6%
remove-double-div17.7%
remove-double-neg17.7%
add-sqr-sqrt13.0%
sqrt-unprod30.8%
sqr-neg30.8%
sqrt-unprod16.4%
distribute-rgt-neg-in16.4%
Applied egg-rr16.4%
Taylor expanded in th around 0 19.3%
neg-mul-119.3%
Simplified19.3%
if -5.8999999999999998e-238 < ky Initial program 94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.8%
Simplified99.8%
associate-/r/99.7%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 34.9%
Taylor expanded in th around 0 18.0%
*-commutative18.0%
Simplified18.0%
Final simplification18.5%
(FPCore (kx ky th) :precision binary64 (if (<= ky -5.9e-238) (- th) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.9e-238) {
tmp = -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 <= (-5.9d-238)) then
tmp = -th
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -5.9e-238) {
tmp = -th;
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -5.9e-238: tmp = -th else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -5.9e-238) tmp = Float64(-th); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -5.9e-238) tmp = -th; else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -5.9e-238], (-th), th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -5.9 \cdot 10^{-238}:\\
\;\;\;\;-th\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -5.8999999999999998e-238Initial program 97.7%
+-commutative97.7%
unpow297.7%
unpow297.7%
hypot-def99.6%
Simplified99.6%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.4%
Applied egg-rr99.4%
Taylor expanded in kx around 0 17.6%
remove-double-div17.7%
remove-double-neg17.7%
add-sqr-sqrt13.0%
sqrt-unprod30.8%
sqr-neg30.8%
sqrt-unprod16.4%
distribute-rgt-neg-in16.4%
Applied egg-rr16.4%
Taylor expanded in th around 0 19.3%
neg-mul-119.3%
Simplified19.3%
if -5.8999999999999998e-238 < ky Initial program 94.5%
+-commutative94.5%
unpow294.5%
unpow294.5%
hypot-def99.8%
Simplified99.8%
associate-/r/99.7%
div-inv99.5%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 34.9%
Taylor expanded in th around 0 17.4%
Final simplification18.2%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 95.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.7%
Simplified99.7%
associate-/r/99.6%
div-inv99.5%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 27.6%
Taylor expanded in th around 0 14.7%
Final simplification14.7%
herbie shell --seed 2023228
(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)))