
(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 20 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 96.0%
+-commutative96.0%
unpow296.0%
unpow296.0%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.0001)
(fabs (* ky (/ (sin th) (sin kx))))
(if (<= (sin kx) -1e-153)
(* (sin ky) (/ (sin th) (- kx)))
(if (<= (sin kx) 2e-44) (sin th) (* (sin th) (log1p (/ ky (sin kx))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.0001) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= -1e-153) {
tmp = sin(ky) * (sin(th) / -kx);
} else if (sin(kx) <= 2e-44) {
tmp = sin(th);
} else {
tmp = sin(th) * log1p((ky / sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.0001) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= -1e-153) {
tmp = Math.sin(ky) * (Math.sin(th) / -kx);
} else if (Math.sin(kx) <= 2e-44) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * Math.log1p((ky / Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.0001: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= -1e-153: tmp = math.sin(ky) * (math.sin(th) / -kx) elif math.sin(kx) <= 2e-44: tmp = math.sin(th) else: tmp = math.sin(th) * math.log1p((ky / math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.0001) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= -1e-153) tmp = Float64(sin(ky) * Float64(sin(th) / Float64(-kx))); elseif (sin(kx) <= 2e-44) tmp = sin(th); else tmp = Float64(sin(th) * log1p(Float64(ky / sin(kx)))); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.0001], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -1e-153], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / (-kx)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-44], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[Log[1 + N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.0001:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq -1 \cdot 10^{-153}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{-kx}\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-44}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \mathsf{log1p}\left(\frac{ky}{\sin kx}\right)\\
\end{array}
\end{array}
if (sin.f64 kx) < -1.00000000000000005e-4Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 16.0%
associate-/l*16.0%
Simplified16.0%
add-sqr-sqrt13.1%
sqrt-unprod25.1%
pow225.1%
div-inv25.1%
clear-num25.1%
Applied egg-rr25.1%
unpow225.1%
rem-sqrt-square35.4%
associate-*r/35.4%
associate-*l/35.4%
*-commutative35.4%
Simplified35.4%
if -1.00000000000000005e-4 < (sin.f64 kx) < -1.00000000000000004e-153Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 7.2%
Taylor expanded in kx around 0 7.3%
add-sqr-sqrt6.0%
sqrt-unprod12.7%
pow212.7%
associate-/l*12.7%
Applied egg-rr12.7%
Taylor expanded in kx around -inf 44.0%
mul-1-neg44.0%
associate-*l/47.9%
*-commutative47.9%
distribute-rgt-neg-in47.9%
*-lft-identity47.9%
metadata-eval47.9%
times-frac47.9%
neg-mul-147.9%
neg-mul-147.9%
distribute-frac-neg47.9%
remove-double-neg47.9%
Simplified47.9%
if -1.00000000000000004e-153 < (sin.f64 kx) < 1.99999999999999991e-44Initial program 89.7%
+-commutative89.7%
unpow289.7%
unpow289.7%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 44.0%
if 1.99999999999999991e-44 < (sin.f64 kx) Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
log1p-expm1-u99.3%
Applied egg-rr99.3%
Taylor expanded in ky around 0 52.3%
Final simplification44.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin kx) -0.0001)
(fabs (* ky t_1))
(if (<= (sin kx) -1e-153)
(* (sin ky) (/ (sin th) (- kx)))
(if (<= (sin kx) 1e-150) (sin th) (* (sin ky) t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(kx) <= -0.0001) {
tmp = fabs((ky * t_1));
} else if (sin(kx) <= -1e-153) {
tmp = sin(ky) * (sin(th) / -kx);
} else if (sin(kx) <= 1e-150) {
tmp = sin(th);
} else {
tmp = sin(ky) * t_1;
}
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) / sin(kx)
if (sin(kx) <= (-0.0001d0)) then
tmp = abs((ky * t_1))
else if (sin(kx) <= (-1d-153)) then
tmp = sin(ky) * (sin(th) / -kx)
else if (sin(kx) <= 1d-150) then
tmp = sin(th)
else
tmp = sin(ky) * t_1
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(kx) <= -0.0001) {
tmp = Math.abs((ky * t_1));
} else if (Math.sin(kx) <= -1e-153) {
tmp = Math.sin(ky) * (Math.sin(th) / -kx);
} else if (Math.sin(kx) <= 1e-150) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) * t_1;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(kx) <= -0.0001: tmp = math.fabs((ky * t_1)) elif math.sin(kx) <= -1e-153: tmp = math.sin(ky) * (math.sin(th) / -kx) elif math.sin(kx) <= 1e-150: tmp = math.sin(th) else: tmp = math.sin(ky) * t_1 return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(kx) <= -0.0001) tmp = abs(Float64(ky * t_1)); elseif (sin(kx) <= -1e-153) tmp = Float64(sin(ky) * Float64(sin(th) / Float64(-kx))); elseif (sin(kx) <= 1e-150) tmp = sin(th); else tmp = Float64(sin(ky) * t_1); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(kx) <= -0.0001) tmp = abs((ky * t_1)); elseif (sin(kx) <= -1e-153) tmp = sin(ky) * (sin(th) / -kx); elseif (sin(kx) <= 1e-150) tmp = sin(th); else tmp = sin(ky) * t_1; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[kx], $MachinePrecision], -0.0001], N[Abs[N[(ky * t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -1e-153], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / (-kx)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-150], N[Sin[th], $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin kx \leq -0.0001:\\
\;\;\;\;\left|ky \cdot t_1\right|\\
\mathbf{elif}\;\sin kx \leq -1 \cdot 10^{-153}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{-kx}\\
\mathbf{elif}\;\sin kx \leq 10^{-150}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot t_1\\
\end{array}
\end{array}
if (sin.f64 kx) < -1.00000000000000005e-4Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 16.0%
associate-/l*16.0%
Simplified16.0%
add-sqr-sqrt13.1%
sqrt-unprod25.1%
pow225.1%
div-inv25.1%
clear-num25.1%
Applied egg-rr25.1%
unpow225.1%
rem-sqrt-square35.4%
associate-*r/35.4%
associate-*l/35.4%
*-commutative35.4%
Simplified35.4%
if -1.00000000000000005e-4 < (sin.f64 kx) < -1.00000000000000004e-153Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 7.2%
Taylor expanded in kx around 0 7.3%
add-sqr-sqrt6.0%
sqrt-unprod12.7%
pow212.7%
associate-/l*12.7%
Applied egg-rr12.7%
Taylor expanded in kx around -inf 44.0%
mul-1-neg44.0%
associate-*l/47.9%
*-commutative47.9%
distribute-rgt-neg-in47.9%
*-lft-identity47.9%
metadata-eval47.9%
times-frac47.9%
neg-mul-147.9%
neg-mul-147.9%
distribute-frac-neg47.9%
remove-double-neg47.9%
Simplified47.9%
if -1.00000000000000004e-153 < (sin.f64 kx) < 1.00000000000000001e-150Initial program 85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def100.0%
Simplified100.0%
Taylor expanded in kx around 0 48.3%
if 1.00000000000000001e-150 < (sin.f64 kx) Initial program 99.5%
associate-*l/98.4%
associate-*r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 53.8%
Final simplification47.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.0001)
(fabs (* ky (/ (sin th) (sin kx))))
(if (<= (sin kx) -1e-153)
(* (sin ky) (/ (sin th) (- kx)))
(if (<= (sin kx) 1e-150) (sin th) (/ (sin ky) (/ (sin kx) (sin th)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.0001) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= -1e-153) {
tmp = sin(ky) * (sin(th) / -kx);
} else if (sin(kx) <= 1e-150) {
tmp = sin(th);
} else {
tmp = sin(ky) / (sin(kx) / 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(kx) <= (-0.0001d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= (-1d-153)) then
tmp = sin(ky) * (sin(th) / -kx)
else if (sin(kx) <= 1d-150) then
tmp = sin(th)
else
tmp = sin(ky) / (sin(kx) / sin(th))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.0001) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= -1e-153) {
tmp = Math.sin(ky) * (Math.sin(th) / -kx);
} else if (Math.sin(kx) <= 1e-150) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.0001: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= -1e-153: tmp = math.sin(ky) * (math.sin(th) / -kx) elif math.sin(kx) <= 1e-150: tmp = math.sin(th) else: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.0001) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= -1e-153) tmp = Float64(sin(ky) * Float64(sin(th) / Float64(-kx))); elseif (sin(kx) <= 1e-150) tmp = sin(th); 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 (sin(kx) <= -0.0001) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= -1e-153) tmp = sin(ky) * (sin(th) / -kx); elseif (sin(kx) <= 1e-150) tmp = sin(th); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.0001], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -1e-153], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / (-kx)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-150], N[Sin[th], $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}\;\sin kx \leq -0.0001:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq -1 \cdot 10^{-153}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{-kx}\\
\mathbf{elif}\;\sin kx \leq 10^{-150}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -1.00000000000000005e-4Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 16.0%
associate-/l*16.0%
Simplified16.0%
add-sqr-sqrt13.1%
sqrt-unprod25.1%
pow225.1%
div-inv25.1%
clear-num25.1%
Applied egg-rr25.1%
unpow225.1%
rem-sqrt-square35.4%
associate-*r/35.4%
associate-*l/35.4%
*-commutative35.4%
Simplified35.4%
if -1.00000000000000005e-4 < (sin.f64 kx) < -1.00000000000000004e-153Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 7.2%
Taylor expanded in kx around 0 7.3%
add-sqr-sqrt6.0%
sqrt-unprod12.7%
pow212.7%
associate-/l*12.7%
Applied egg-rr12.7%
Taylor expanded in kx around -inf 44.0%
mul-1-neg44.0%
associate-*l/47.9%
*-commutative47.9%
distribute-rgt-neg-in47.9%
*-lft-identity47.9%
metadata-eval47.9%
times-frac47.9%
neg-mul-147.9%
neg-mul-147.9%
distribute-frac-neg47.9%
remove-double-neg47.9%
Simplified47.9%
if -1.00000000000000004e-153 < (sin.f64 kx) < 1.00000000000000001e-150Initial program 85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def100.0%
Simplified100.0%
Taylor expanded in kx around 0 48.3%
if 1.00000000000000001e-150 < (sin.f64 kx) Initial program 99.5%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 53.8%
Final simplification47.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.02)
(* (sin th) (fabs (/ (sin ky) (sin kx))))
(if (<= (sin kx) -1e-153)
(* (sin ky) (/ (sin th) (- kx)))
(if (<= (sin kx) 1e-150) (sin th) (/ (sin th) (/ (sin kx) (sin ky)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = sin(th) * fabs((sin(ky) / sin(kx)));
} else if (sin(kx) <= -1e-153) {
tmp = sin(ky) * (sin(th) / -kx);
} else if (sin(kx) <= 1e-150) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / 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(kx) <= (-0.02d0)) then
tmp = sin(th) * abs((sin(ky) / sin(kx)))
else if (sin(kx) <= (-1d-153)) then
tmp = sin(ky) * (sin(th) / -kx)
else if (sin(kx) <= 1d-150) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / sin(ky))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.sin(th) * Math.abs((Math.sin(ky) / Math.sin(kx)));
} else if (Math.sin(kx) <= -1e-153) {
tmp = Math.sin(ky) * (Math.sin(th) / -kx);
} else if (Math.sin(kx) <= 1e-150) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.02: tmp = math.sin(th) * math.fabs((math.sin(ky) / math.sin(kx))) elif math.sin(kx) <= -1e-153: tmp = math.sin(ky) * (math.sin(th) / -kx) elif math.sin(kx) <= 1e-150: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.02) tmp = Float64(sin(th) * abs(Float64(sin(ky) / sin(kx)))); elseif (sin(kx) <= -1e-153) tmp = Float64(sin(ky) * Float64(sin(th) / Float64(-kx))); elseif (sin(kx) <= 1e-150) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.02) tmp = sin(th) * abs((sin(ky) / sin(kx))); elseif (sin(kx) <= -1e-153) tmp = sin(ky) * (sin(th) / -kx); elseif (sin(kx) <= 1e-150) tmp = sin(th); else tmp = sin(th) / (sin(kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(N[Sin[th], $MachinePrecision] * N[Abs[N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -1e-153], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / (-kx)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-150], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq -1 \cdot 10^{-153}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{-kx}\\
\mathbf{elif}\;\sin kx \leq 10^{-150}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 15.9%
add-sqr-sqrt4.1%
sqrt-unprod36.2%
pow236.2%
Applied egg-rr36.2%
unpow236.2%
rem-sqrt-square46.3%
Simplified46.3%
if -0.0200000000000000004 < (sin.f64 kx) < -1.00000000000000004e-153Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 7.0%
Taylor expanded in kx around 0 7.1%
add-sqr-sqrt5.7%
sqrt-unprod14.9%
pow214.9%
associate-/l*14.9%
Applied egg-rr14.9%
Taylor expanded in kx around -inf 44.8%
mul-1-neg44.8%
associate-*l/48.6%
*-commutative48.6%
distribute-rgt-neg-in48.6%
*-lft-identity48.6%
metadata-eval48.6%
times-frac48.6%
neg-mul-148.6%
neg-mul-148.6%
distribute-frac-neg48.6%
remove-double-neg48.6%
Simplified48.6%
if -1.00000000000000004e-153 < (sin.f64 kx) < 1.00000000000000001e-150Initial program 85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def100.0%
Simplified100.0%
Taylor expanded in kx around 0 48.3%
if 1.00000000000000001e-150 < (sin.f64 kx) Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 53.8%
*-commutative53.8%
clear-num53.8%
un-div-inv53.8%
Applied egg-rr53.8%
Final simplification50.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(sin th)
(if (<= (sin th) 0.05)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(fabs (* (sin ky) (/ (sin th) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = sin(th);
} else if (sin(th) <= 0.05) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= 0.05) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.sin(th) elif math.sin(th) <= 0.05: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) else: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = sin(th); elseif (sin(th) <= 0.05) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); else tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = sin(th); elseif (sin(th) <= 0.05) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); else tmp = abs((sin(ky) * (sin(th) / sin(kx)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.05], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq 0.05:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 97.5%
+-commutative97.5%
unpow297.5%
unpow297.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 28.1%
if -0.050000000000000003 < (sin.f64 th) < 0.050000000000000003Initial program 95.2%
associate-*l/91.1%
+-commutative91.1%
unpow291.1%
unpow291.1%
hypot-def92.1%
Simplified92.1%
Taylor expanded in th around 0 90.6%
expm1-log1p-u90.5%
expm1-udef21.3%
*-un-lft-identity21.3%
times-frac21.3%
/-rgt-identity21.3%
Applied egg-rr21.3%
expm1-def98.0%
expm1-log1p98.1%
Simplified98.1%
if 0.050000000000000003 < (sin.f64 th) Initial program 96.4%
+-commutative96.4%
unpow296.4%
unpow296.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 22.7%
add-sqr-sqrt13.4%
sqrt-unprod17.2%
pow217.2%
associate-*l/17.2%
*-un-lft-identity17.2%
times-frac17.2%
/-rgt-identity17.2%
Applied egg-rr17.2%
unpow217.2%
rem-sqrt-square28.5%
Simplified28.5%
Final simplification66.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.05)
(sin th)
(if (<= (sin th) 0.05)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(fabs (* (sin ky) (/ (sin th) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.05) {
tmp = sin(th);
} else if (sin(th) <= 0.05) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = fabs((sin(ky) * (sin(th) / sin(kx))));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(th) <= -0.05) {
tmp = Math.sin(th);
} else if (Math.sin(th) <= 0.05) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.abs((Math.sin(ky) * (Math.sin(th) / Math.sin(kx))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.05: tmp = math.sin(th) elif math.sin(th) <= 0.05: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.fabs((math.sin(ky) * (math.sin(th) / math.sin(kx)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.05) tmp = sin(th); elseif (sin(th) <= 0.05) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = abs(Float64(sin(ky) * Float64(sin(th) / sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(th) <= -0.05) tmp = sin(th); elseif (sin(th) <= 0.05) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = abs((sin(ky) * (sin(th) / sin(kx)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.05], N[Sin[th], $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.05], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[Abs[N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.05:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin th \leq 0.05:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\left|\sin ky \cdot \frac{\sin th}{\sin kx}\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -0.050000000000000003Initial program 97.5%
+-commutative97.5%
unpow297.5%
unpow297.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 28.1%
if -0.050000000000000003 < (sin.f64 th) < 0.050000000000000003Initial program 95.2%
associate-*l/91.1%
+-commutative91.1%
unpow291.1%
unpow291.1%
hypot-def92.1%
Simplified92.1%
Taylor expanded in th around 0 90.6%
associate-/l*98.1%
associate-/r/98.1%
Applied egg-rr98.1%
if 0.050000000000000003 < (sin.f64 th) Initial program 96.4%
+-commutative96.4%
unpow296.4%
unpow296.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 22.7%
add-sqr-sqrt13.4%
sqrt-unprod17.2%
pow217.2%
associate-*l/17.2%
*-un-lft-identity17.2%
times-frac17.2%
/-rgt-identity17.2%
Applied egg-rr17.2%
unpow217.2%
rem-sqrt-square28.5%
Simplified28.5%
Final simplification66.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.0001)
(fabs (* ky (/ (sin th) (sin kx))))
(if (<= (sin kx) -1e-153)
(* (sin ky) (/ (sin th) (- kx)))
(if (<= (sin kx) 2e-44) (sin th) (/ (sin th) (/ (sin kx) ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.0001) {
tmp = fabs((ky * (sin(th) / sin(kx))));
} else if (sin(kx) <= -1e-153) {
tmp = sin(ky) * (sin(th) / -kx);
} else if (sin(kx) <= 2e-44) {
tmp = sin(th);
} else {
tmp = sin(th) / (sin(kx) / 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(kx) <= (-0.0001d0)) then
tmp = abs((ky * (sin(th) / sin(kx))))
else if (sin(kx) <= (-1d-153)) then
tmp = sin(ky) * (sin(th) / -kx)
else if (sin(kx) <= 2d-44) then
tmp = sin(th)
else
tmp = sin(th) / (sin(kx) / ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.0001) {
tmp = Math.abs((ky * (Math.sin(th) / Math.sin(kx))));
} else if (Math.sin(kx) <= -1e-153) {
tmp = Math.sin(ky) * (Math.sin(th) / -kx);
} else if (Math.sin(kx) <= 2e-44) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.0001: tmp = math.fabs((ky * (math.sin(th) / math.sin(kx)))) elif math.sin(kx) <= -1e-153: tmp = math.sin(ky) * (math.sin(th) / -kx) elif math.sin(kx) <= 2e-44: tmp = math.sin(th) else: tmp = math.sin(th) / (math.sin(kx) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.0001) tmp = abs(Float64(ky * Float64(sin(th) / sin(kx)))); elseif (sin(kx) <= -1e-153) tmp = Float64(sin(ky) * Float64(sin(th) / Float64(-kx))); elseif (sin(kx) <= 2e-44) tmp = sin(th); else tmp = Float64(sin(th) / Float64(sin(kx) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.0001) tmp = abs((ky * (sin(th) / sin(kx)))); elseif (sin(kx) <= -1e-153) tmp = sin(ky) * (sin(th) / -kx); elseif (sin(kx) <= 2e-44) tmp = sin(th); else tmp = sin(th) / (sin(kx) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.0001], N[Abs[N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], -1e-153], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / (-kx)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-44], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.0001:\\
\;\;\;\;\left|ky \cdot \frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq -1 \cdot 10^{-153}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{-kx}\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-44}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -1.00000000000000005e-4Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 16.0%
associate-/l*16.0%
Simplified16.0%
add-sqr-sqrt13.1%
sqrt-unprod25.1%
pow225.1%
div-inv25.1%
clear-num25.1%
Applied egg-rr25.1%
unpow225.1%
rem-sqrt-square35.4%
associate-*r/35.4%
associate-*l/35.4%
*-commutative35.4%
Simplified35.4%
if -1.00000000000000005e-4 < (sin.f64 kx) < -1.00000000000000004e-153Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 7.2%
Taylor expanded in kx around 0 7.3%
add-sqr-sqrt6.0%
sqrt-unprod12.7%
pow212.7%
associate-/l*12.7%
Applied egg-rr12.7%
Taylor expanded in kx around -inf 44.0%
mul-1-neg44.0%
associate-*l/47.9%
*-commutative47.9%
distribute-rgt-neg-in47.9%
*-lft-identity47.9%
metadata-eval47.9%
times-frac47.9%
neg-mul-147.9%
neg-mul-147.9%
distribute-frac-neg47.9%
remove-double-neg47.9%
Simplified47.9%
if -1.00000000000000004e-153 < (sin.f64 kx) < 1.99999999999999991e-44Initial program 89.7%
+-commutative89.7%
unpow289.7%
unpow289.7%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 44.0%
if 1.99999999999999991e-44 < (sin.f64 kx) Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 52.2%
associate-/l*52.2%
Simplified52.2%
Final simplification44.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-297) (/ (sin ky) (/ (sin kx) (sin th))) (if (<= (sin ky) 4e-25) (/ (sin th) (fabs (/ (sin kx) ky))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-297) {
tmp = sin(ky) / (sin(kx) / sin(th));
} else if (sin(ky) <= 4e-25) {
tmp = sin(th) / fabs((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-297)) then
tmp = sin(ky) / (sin(kx) / sin(th))
else if (sin(ky) <= 4d-25) then
tmp = sin(th) / abs((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-297) {
tmp = Math.sin(ky) / (Math.sin(kx) / Math.sin(th));
} else if (Math.sin(ky) <= 4e-25) {
tmp = Math.sin(th) / Math.abs((Math.sin(kx) / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-297: tmp = math.sin(ky) / (math.sin(kx) / math.sin(th)) elif math.sin(ky) <= 4e-25: tmp = math.sin(th) / math.fabs((math.sin(kx) / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-297) tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); elseif (sin(ky) <= 4e-25) tmp = Float64(sin(th) / abs(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-297) tmp = sin(ky) / (sin(kx) / sin(th)); elseif (sin(ky) <= 4e-25) tmp = sin(th) / abs((sin(kx) / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-297], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-25], N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-297}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sin th}{\left|\frac{\sin kx}{ky}\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000004e-297Initial program 95.8%
associate-/r/95.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 27.3%
if -1.00000000000000004e-297 < (sin.f64 ky) < 4.00000000000000015e-25Initial program 92.6%
+-commutative92.6%
unpow292.6%
unpow292.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 49.3%
associate-/l*49.1%
Simplified49.1%
add-sqr-sqrt36.4%
sqrt-unprod61.4%
pow261.4%
Applied egg-rr61.4%
unpow261.4%
rem-sqrt-square78.9%
Simplified78.9%
if 4.00000000000000015e-25 < (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.5%
Final simplification47.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -1e-297) (/ (sin th) (/ (sin kx) (sin ky))) (if (<= (sin ky) 4e-25) (/ (sin th) (fabs (/ (sin kx) ky))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-297) {
tmp = sin(th) / (sin(kx) / sin(ky));
} else if (sin(ky) <= 4e-25) {
tmp = sin(th) / fabs((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-297)) then
tmp = sin(th) / (sin(kx) / sin(ky))
else if (sin(ky) <= 4d-25) then
tmp = sin(th) / abs((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-297) {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
} else if (Math.sin(ky) <= 4e-25) {
tmp = Math.sin(th) / Math.abs((Math.sin(kx) / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-297: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) elif math.sin(ky) <= 4e-25: tmp = math.sin(th) / math.fabs((math.sin(kx) / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-297) tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); elseif (sin(ky) <= 4e-25) tmp = Float64(sin(th) / abs(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-297) tmp = sin(th) / (sin(kx) / sin(ky)); elseif (sin(ky) <= 4e-25) tmp = sin(th) / abs((sin(kx) / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-297], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 4e-25], N[(N[Sin[th], $MachinePrecision] / N[Abs[N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-297}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\mathbf{elif}\;\sin ky \leq 4 \cdot 10^{-25}:\\
\;\;\;\;\frac{\sin th}{\left|\frac{\sin kx}{ky}\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000004e-297Initial program 95.8%
+-commutative95.8%
unpow295.8%
unpow295.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 27.2%
*-commutative27.2%
clear-num27.3%
un-div-inv27.3%
Applied egg-rr27.3%
if -1.00000000000000004e-297 < (sin.f64 ky) < 4.00000000000000015e-25Initial program 92.6%
+-commutative92.6%
unpow292.6%
unpow292.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 49.3%
associate-/l*49.1%
Simplified49.1%
add-sqr-sqrt36.4%
sqrt-unprod61.4%
pow261.4%
Applied egg-rr61.4%
unpow261.4%
rem-sqrt-square78.9%
Simplified78.9%
if 4.00000000000000015e-25 < (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.5%
Final simplification47.6%
(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 96.0%
associate-*l/93.8%
associate-*r/95.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot (sin ky) (sin kx))))
(if (or (<= th -3.6e-6) (not (<= th 1250000000000.0)))
(/ (* ky (sin th)) t_1)
(* (/ (sin ky) t_1) th))))
double code(double kx, double ky, double th) {
double t_1 = hypot(sin(ky), sin(kx));
double tmp;
if ((th <= -3.6e-6) || !(th <= 1250000000000.0)) {
tmp = (ky * sin(th)) / t_1;
} else {
tmp = (sin(ky) / t_1) * 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 ((th <= -3.6e-6) || !(th <= 1250000000000.0)) {
tmp = (ky * Math.sin(th)) / t_1;
} else {
tmp = (Math.sin(ky) / t_1) * th;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(math.sin(ky), math.sin(kx)) tmp = 0 if (th <= -3.6e-6) or not (th <= 1250000000000.0): tmp = (ky * math.sin(th)) / t_1 else: tmp = (math.sin(ky) / t_1) * th return tmp
function code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)) tmp = 0.0 if ((th <= -3.6e-6) || !(th <= 1250000000000.0)) tmp = Float64(Float64(ky * sin(th)) / t_1); else tmp = Float64(Float64(sin(ky) / t_1) * th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(sin(ky), sin(kx)); tmp = 0.0; if ((th <= -3.6e-6) || ~((th <= 1250000000000.0))) tmp = (ky * sin(th)) / t_1; else tmp = (sin(ky) / t_1) * 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[Or[LessEqual[th, -3.6e-6], N[Not[LessEqual[th, 1250000000000.0]], $MachinePrecision]], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / t$95$1), $MachinePrecision] * th), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;th \leq -3.6 \cdot 10^{-6} \lor \neg \left(th \leq 1250000000000\right):\\
\;\;\;\;\frac{ky \cdot \sin th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\end{array}
\end{array}
if th < -3.59999999999999984e-6 or 1.25e12 < th Initial program 96.9%
associate-*l/96.9%
+-commutative96.9%
unpow296.9%
unpow296.9%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 50.6%
if -3.59999999999999984e-6 < th < 1.25e12Initial program 95.2%
associate-*l/91.1%
+-commutative91.1%
unpow291.1%
unpow291.1%
hypot-def92.1%
Simplified92.1%
Taylor expanded in th around 0 90.2%
associate-/l*97.7%
associate-/r/97.8%
Applied egg-rr97.8%
Final simplification76.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-120) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-120) {
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-120) 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-120) {
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-120: 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-120) 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-120) 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-120], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-120}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999979e-121Initial program 94.2%
+-commutative94.2%
unpow294.2%
unpow294.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 33.3%
if 9.99999999999999979e-121 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 53.0%
Final simplification39.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-120) (/ (sin th) (/ (sin kx) ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-120) {
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-120) 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-120) {
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-120: 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-120) 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-120) 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-120], 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 10^{-120}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 9.99999999999999979e-121Initial program 94.2%
+-commutative94.2%
unpow294.2%
unpow294.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 32.2%
associate-/l*33.3%
Simplified33.3%
if 9.99999999999999979e-121 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 53.0%
Final simplification39.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 2e-128) (/ (sin th) (/ kx ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 2e-128) {
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-128) 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-128) {
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-128: 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-128) 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-128) 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-128], 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^{-128}:\\
\;\;\;\;\frac{\sin th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 2.00000000000000011e-128Initial program 94.1%
+-commutative94.1%
unpow294.1%
unpow294.1%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 35.1%
Taylor expanded in kx around 0 23.5%
Taylor expanded in ky around 0 23.3%
associate-/l*24.5%
Simplified24.5%
if 2.00000000000000011e-128 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 53.0%
Final simplification34.1%
(FPCore (kx ky th) :precision binary64 (if (<= ky -470000.0) (sin th) (if (<= ky 1.4e-173) (* ky (/ th (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -470000.0) {
tmp = sin(th);
} else if (ky <= 1.4e-173) {
tmp = ky * (th / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-470000.0d0)) then
tmp = sin(th)
else if (ky <= 1.4d-173) then
tmp = ky * (th / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -470000.0) {
tmp = Math.sin(th);
} else if (ky <= 1.4e-173) {
tmp = ky * (th / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -470000.0: tmp = math.sin(th) elif ky <= 1.4e-173: tmp = ky * (th / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -470000.0) tmp = sin(th); elseif (ky <= 1.4e-173) tmp = Float64(ky * Float64(th / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -470000.0) tmp = sin(th); elseif (ky <= 1.4e-173) tmp = ky * (th / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -470000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.4e-173], N[(ky * N[(th / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -470000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.4 \cdot 10^{-173}:\\
\;\;\;\;ky \cdot \frac{th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -4.7e5 or 1.39999999999999995e-173 < ky Initial program 99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 30.4%
if -4.7e5 < ky < 1.39999999999999995e-173Initial program 89.6%
associate-*l/85.5%
+-commutative85.5%
unpow285.5%
unpow285.5%
hypot-def90.0%
Simplified90.0%
Taylor expanded in th around 0 47.2%
Taylor expanded in ky around 0 34.0%
associate-/l*36.3%
Simplified36.3%
clear-num36.2%
associate-/r/36.2%
clear-num36.2%
Applied egg-rr36.2%
Final simplification32.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky -470000.0) (sin th) (if (<= ky 1.8e-172) (/ ky (/ (sin kx) th)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -470000.0) {
tmp = sin(th);
} else if (ky <= 1.8e-172) {
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 <= (-470000.0d0)) then
tmp = sin(th)
else if (ky <= 1.8d-172) 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 <= -470000.0) {
tmp = Math.sin(th);
} else if (ky <= 1.8e-172) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -470000.0: tmp = math.sin(th) elif ky <= 1.8e-172: tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -470000.0) tmp = sin(th); elseif (ky <= 1.8e-172) 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 <= -470000.0) tmp = sin(th); elseif (ky <= 1.8e-172) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -470000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.8e-172], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -470000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.8 \cdot 10^{-172}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -4.7e5 or 1.80000000000000007e-172 < ky Initial program 99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 30.4%
if -4.7e5 < ky < 1.80000000000000007e-172Initial program 89.6%
associate-*l/85.5%
+-commutative85.5%
unpow285.5%
unpow285.5%
hypot-def90.0%
Simplified90.0%
Taylor expanded in th around 0 47.2%
Taylor expanded in ky around 0 34.0%
associate-/l*36.3%
Simplified36.3%
Final simplification32.4%
(FPCore (kx ky th) :precision binary64 (if (<= ky -2900000.0) (sin th) (if (<= ky 2.45e-163) (* th (/ ky kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2900000.0) {
tmp = sin(th);
} else if (ky <= 2.45e-163) {
tmp = th * (ky / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-2900000.0d0)) then
tmp = sin(th)
else if (ky <= 2.45d-163) then
tmp = th * (ky / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -2900000.0) {
tmp = Math.sin(th);
} else if (ky <= 2.45e-163) {
tmp = th * (ky / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -2900000.0: tmp = math.sin(th) elif ky <= 2.45e-163: tmp = th * (ky / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -2900000.0) tmp = sin(th); elseif (ky <= 2.45e-163) tmp = Float64(th * Float64(ky / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -2900000.0) tmp = sin(th); elseif (ky <= 2.45e-163) tmp = th * (ky / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -2900000.0], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 2.45e-163], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -2900000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.45 \cdot 10^{-163}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -2.9e6 or 2.4500000000000001e-163 < ky Initial program 99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 30.8%
if -2.9e6 < ky < 2.4500000000000001e-163Initial program 89.9%
associate-*l/84.9%
+-commutative84.9%
unpow284.9%
unpow284.9%
hypot-def89.3%
Simplified89.3%
Taylor expanded in th around 0 45.8%
Taylor expanded in ky around 0 33.0%
associate-/l*35.2%
Simplified35.2%
Taylor expanded in kx around 0 32.6%
associate-/r/32.9%
Applied egg-rr32.9%
Final simplification31.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -125000.0) th (if (<= ky 2e-120) (* th (/ ky kx)) th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -125000.0) {
tmp = th;
} else if (ky <= 2e-120) {
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 <= (-125000.0d0)) then
tmp = th
else if (ky <= 2d-120) 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 <= -125000.0) {
tmp = th;
} else if (ky <= 2e-120) {
tmp = th * (ky / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -125000.0: tmp = th elif ky <= 2e-120: tmp = th * (ky / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -125000.0) tmp = th; elseif (ky <= 2e-120) 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 <= -125000.0) tmp = th; elseif (ky <= 2e-120) tmp = th * (ky / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -125000.0], th, If[LessEqual[ky, 2e-120], N[(th * N[(ky / kx), $MachinePrecision]), $MachinePrecision], th]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -125000:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 2 \cdot 10^{-120}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < -125000 or 1.99999999999999996e-120 < ky Initial program 99.7%
associate-*l/98.9%
+-commutative98.9%
unpow298.9%
unpow298.9%
hypot-def98.9%
Simplified98.9%
Taylor expanded in th around 0 53.1%
Taylor expanded in kx around 0 17.7%
if -125000 < ky < 1.99999999999999996e-120Initial program 90.5%
associate-*l/86.1%
+-commutative86.1%
unpow286.1%
unpow286.1%
hypot-def90.6%
Simplified90.6%
Taylor expanded in th around 0 46.5%
Taylor expanded in ky around 0 33.3%
associate-/l*35.3%
Simplified35.3%
Taylor expanded in kx around 0 32.1%
associate-/r/32.4%
Applied egg-rr32.4%
Final simplification23.6%
(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 96.0%
associate-*l/93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def95.6%
Simplified95.6%
Taylor expanded in th around 0 50.4%
Taylor expanded in kx around 0 13.2%
Final simplification13.2%
herbie shell --seed 2023182
(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)))