
(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 24 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 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (sin th) (/ ky (hypot ky kx)))))
(if (<= (sin ky) -1e-10)
(- (sin th))
(if (<= (sin ky) -5e-303)
t_1
(if (<= (sin ky) 5e-93)
(/ (sin th) (/ (sin kx) ky))
(if (<= (sin ky) 1e-49)
t_1
(if (<= (sin ky) 2e-24) (* ky (/ (sin th) (sin kx))) (sin th))))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) * (ky / hypot(ky, kx));
double tmp;
if (sin(ky) <= -1e-10) {
tmp = -sin(th);
} else if (sin(ky) <= -5e-303) {
tmp = t_1;
} else if (sin(ky) <= 5e-93) {
tmp = sin(th) / (sin(kx) / ky);
} else if (sin(ky) <= 1e-49) {
tmp = t_1;
} else if (sin(ky) <= 2e-24) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) * (ky / Math.hypot(ky, kx));
double tmp;
if (Math.sin(ky) <= -1e-10) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= -5e-303) {
tmp = t_1;
} else if (Math.sin(ky) <= 5e-93) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else if (Math.sin(ky) <= 1e-49) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-24) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) * (ky / math.hypot(ky, kx)) tmp = 0 if math.sin(ky) <= -1e-10: tmp = -math.sin(th) elif math.sin(ky) <= -5e-303: tmp = t_1 elif math.sin(ky) <= 5e-93: tmp = math.sin(th) / (math.sin(kx) / ky) elif math.sin(ky) <= 1e-49: tmp = t_1 elif math.sin(ky) <= 2e-24: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) * Float64(ky / hypot(ky, kx))) tmp = 0.0 if (sin(ky) <= -1e-10) tmp = Float64(-sin(th)); elseif (sin(ky) <= -5e-303) tmp = t_1; elseif (sin(ky) <= 5e-93) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); elseif (sin(ky) <= 1e-49) tmp = t_1; elseif (sin(ky) <= 2e-24) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) * (ky / hypot(ky, kx)); tmp = 0.0; if (sin(ky) <= -1e-10) tmp = -sin(th); elseif (sin(ky) <= -5e-303) tmp = t_1; elseif (sin(ky) <= 5e-93) tmp = sin(th) / (sin(kx) / ky); elseif (sin(ky) <= 1e-49) tmp = t_1; elseif (sin(ky) <= 2e-24) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-10], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-303], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-93], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-49], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-24], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-10}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-303}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-93}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{elif}\;\sin ky \leq 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-24}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000004e-10Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 11.0%
Taylor expanded in ky around 0 32.3%
Taylor expanded in ky around -inf 54.1%
neg-mul-154.1%
Simplified54.1%
if -1.00000000000000004e-10 < (sin.f64 ky) < -4.9999999999999998e-303 or 4.99999999999999994e-93 < (sin.f64 ky) < 9.99999999999999936e-50Initial program 87.7%
+-commutative87.7%
unpow287.7%
unpow287.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in kx around 0 66.7%
if -4.9999999999999998e-303 < (sin.f64 ky) < 4.99999999999999994e-93Initial program 86.5%
+-commutative86.5%
unpow286.5%
unpow286.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 53.2%
associate-/l*56.0%
Simplified56.0%
if 9.99999999999999936e-50 < (sin.f64 ky) < 1.99999999999999985e-24Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 35.3%
associate-/l*35.3%
associate-/r/35.8%
Applied egg-rr35.8%
if 1.99999999999999985e-24 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 58.4%
Final simplification58.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))) (t_2 (* (sin th) (/ ky (sin kx)))))
(if (<= (sin ky) -1.6e-33)
t_1
(if (<= (sin ky) -5e-196)
t_2
(if (<= (sin ky) -1e-230) t_1 (if (<= (sin ky) 2e-24) t_2 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double t_2 = sin(th) * (ky / sin(kx));
double tmp;
if (sin(ky) <= -1.6e-33) {
tmp = t_1;
} else if (sin(ky) <= -5e-196) {
tmp = t_2;
} else if (sin(ky) <= -1e-230) {
tmp = t_1;
} else if (sin(ky) <= 2e-24) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = -sin(th)
t_2 = sin(th) * (ky / sin(kx))
if (sin(ky) <= (-1.6d-33)) then
tmp = t_1
else if (sin(ky) <= (-5d-196)) then
tmp = t_2
else if (sin(ky) <= (-1d-230)) then
tmp = t_1
else if (sin(ky) <= 2d-24) then
tmp = t_2
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 t_2 = Math.sin(th) * (ky / Math.sin(kx));
double tmp;
if (Math.sin(ky) <= -1.6e-33) {
tmp = t_1;
} else if (Math.sin(ky) <= -5e-196) {
tmp = t_2;
} else if (Math.sin(ky) <= -1e-230) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-24) {
tmp = t_2;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) t_2 = math.sin(th) * (ky / math.sin(kx)) tmp = 0 if math.sin(ky) <= -1.6e-33: tmp = t_1 elif math.sin(ky) <= -5e-196: tmp = t_2 elif math.sin(ky) <= -1e-230: tmp = t_1 elif math.sin(ky) <= 2e-24: tmp = t_2 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) t_2 = Float64(sin(th) * Float64(ky / sin(kx))) tmp = 0.0 if (sin(ky) <= -1.6e-33) tmp = t_1; elseif (sin(ky) <= -5e-196) tmp = t_2; elseif (sin(ky) <= -1e-230) tmp = t_1; elseif (sin(ky) <= 2e-24) tmp = t_2; else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); t_2 = sin(th) * (ky / sin(kx)); tmp = 0.0; if (sin(ky) <= -1.6e-33) tmp = t_1; elseif (sin(ky) <= -5e-196) tmp = t_2; elseif (sin(ky) <= -1e-230) tmp = t_1; elseif (sin(ky) <= 2e-24) tmp = t_2; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, Block[{t$95$2 = N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -1.6e-33], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-196], t$95$2, If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-230], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-24], t$95$2, N[Sin[th], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
t_2 := \sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{if}\;\sin ky \leq -1.6 \cdot 10^{-33}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-196}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-24}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.59999999999999988e-33 or -5.0000000000000005e-196 < (sin.f64 ky) < -1.00000000000000005e-230Initial program 93.6%
+-commutative93.6%
unpow293.6%
unpow293.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 25.3%
Taylor expanded in ky around 0 43.2%
Taylor expanded in ky around -inf 58.1%
neg-mul-158.1%
Simplified58.1%
if -1.59999999999999988e-33 < (sin.f64 ky) < -5.0000000000000005e-196 or -1.00000000000000005e-230 < (sin.f64 ky) < 1.99999999999999985e-24Initial program 90.5%
+-commutative90.5%
unpow290.5%
unpow290.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 52.8%
if 1.99999999999999985e-24 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 58.4%
Final simplification56.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= (sin ky) -1.6e-33)
t_1
(if (<= (sin ky) -5e-196)
(* ky (/ (sin th) (sin kx)))
(if (<= (sin ky) -1e-230)
t_1
(if (<= (sin ky) 2e-24) (* (sin th) (/ ky (sin kx))) (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (sin(ky) <= -1.6e-33) {
tmp = t_1;
} else if (sin(ky) <= -5e-196) {
tmp = ky * (sin(th) / sin(kx));
} else if (sin(ky) <= -1e-230) {
tmp = t_1;
} else if (sin(ky) <= 2e-24) {
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) :: t_1
real(8) :: tmp
t_1 = -sin(th)
if (sin(ky) <= (-1.6d-33)) then
tmp = t_1
else if (sin(ky) <= (-5d-196)) then
tmp = ky * (sin(th) / sin(kx))
else if (sin(ky) <= (-1d-230)) then
tmp = t_1
else if (sin(ky) <= 2d-24) 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 t_1 = -Math.sin(th);
double tmp;
if (Math.sin(ky) <= -1.6e-33) {
tmp = t_1;
} else if (Math.sin(ky) <= -5e-196) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else if (Math.sin(ky) <= -1e-230) {
tmp = t_1;
} else if (Math.sin(ky) <= 2e-24) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if math.sin(ky) <= -1.6e-33: tmp = t_1 elif math.sin(ky) <= -5e-196: tmp = ky * (math.sin(th) / math.sin(kx)) elif math.sin(ky) <= -1e-230: tmp = t_1 elif math.sin(ky) <= 2e-24: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(-sin(th)) tmp = 0.0 if (sin(ky) <= -1.6e-33) tmp = t_1; elseif (sin(ky) <= -5e-196) tmp = Float64(ky * Float64(sin(th) / sin(kx))); elseif (sin(ky) <= -1e-230) tmp = t_1; elseif (sin(ky) <= 2e-24) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = -sin(th); tmp = 0.0; if (sin(ky) <= -1.6e-33) tmp = t_1; elseif (sin(ky) <= -5e-196) tmp = ky * (sin(th) / sin(kx)); elseif (sin(ky) <= -1e-230) tmp = t_1; elseif (sin(ky) <= 2e-24) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = (-N[Sin[th], $MachinePrecision])}, If[LessEqual[N[Sin[ky], $MachinePrecision], -1.6e-33], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-196], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-230], t$95$1, If[LessEqual[N[Sin[ky], $MachinePrecision], 2e-24], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;\sin ky \leq -1.6 \cdot 10^{-33}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq -5 \cdot 10^{-196}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.59999999999999988e-33 or -5.0000000000000005e-196 < (sin.f64 ky) < -1.00000000000000005e-230Initial program 93.6%
+-commutative93.6%
unpow293.6%
unpow293.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 25.3%
Taylor expanded in ky around 0 43.2%
Taylor expanded in ky around -inf 58.1%
neg-mul-158.1%
Simplified58.1%
if -1.59999999999999988e-33 < (sin.f64 ky) < -5.0000000000000005e-196Initial program 95.9%
+-commutative95.9%
unpow295.9%
unpow295.9%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 53.5%
associate-/l*53.5%
associate-/r/53.5%
Applied egg-rr53.5%
if -1.00000000000000005e-230 < (sin.f64 ky) < 1.99999999999999985e-24Initial program 88.6%
+-commutative88.6%
unpow288.6%
unpow288.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 52.6%
if 1.99999999999999985e-24 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 58.4%
Final simplification56.0%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -1e-5)
(- (sin th))
(if (<= (sin ky) 0.0005)
(* (sin ky) (/ (sin th) (hypot ky (sin kx))))
(* (sin th) (+ 1.0 (* -0.5 (/ (pow (sin kx) 2.0) (* ky ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -1e-5) {
tmp = -sin(th);
} else if (sin(ky) <= 0.0005) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(th) * (1.0 + (-0.5 * (pow(sin(kx), 2.0) / (ky * ky))));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -1e-5) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 0.0005) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th) * (1.0 + (-0.5 * (Math.pow(Math.sin(kx), 2.0) / (ky * ky))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -1e-5: tmp = -math.sin(th) elif math.sin(ky) <= 0.0005: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) * (1.0 + (-0.5 * (math.pow(math.sin(kx), 2.0) / (ky * ky)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -1e-5) tmp = Float64(-sin(th)); elseif (sin(ky) <= 0.0005) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(th) * Float64(1.0 + Float64(-0.5 * Float64((sin(kx) ^ 2.0) / Float64(ky * ky))))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -1e-5) tmp = -sin(th); elseif (sin(ky) <= 0.0005) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(th) * (1.0 + (-0.5 * ((sin(kx) ^ 2.0) / (ky * ky)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -1e-5], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0005], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] / N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-5}:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 0.0005:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(1 + -0.5 \cdot \frac{{\sin kx}^{2}}{ky \cdot ky}\right)\\
\end{array}
\end{array}
if (sin.f64 ky) < -1.00000000000000008e-5Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 6.9%
Taylor expanded in ky around 0 29.2%
Taylor expanded in ky around -inf 54.7%
neg-mul-154.7%
Simplified54.7%
if -1.00000000000000008e-5 < (sin.f64 ky) < 5.0000000000000001e-4Initial program 88.4%
associate-*l/85.3%
associate-*r/88.4%
+-commutative88.4%
unpow288.4%
unpow288.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 99.5%
if 5.0000000000000001e-4 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 6.0%
Taylor expanded in ky around 0 33.0%
Taylor expanded in ky around inf 58.0%
unpow258.0%
Simplified58.0%
Final simplification78.4%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(- (sin th))
(if (<= (sin ky) 0.0005)
(* (sin th) (/ ky (hypot ky (sin kx))))
(* (sin th) (+ 1.0 (* -0.5 (/ (pow (sin kx) 2.0) (* ky ky))))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = -sin(th);
} else if (sin(ky) <= 0.0005) {
tmp = sin(th) * (ky / hypot(ky, sin(kx)));
} else {
tmp = sin(th) * (1.0 + (-0.5 * (pow(sin(kx), 2.0) / (ky * ky))));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 0.0005) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(th) * (1.0 + (-0.5 * (Math.pow(Math.sin(kx), 2.0) / (ky * ky))));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = -math.sin(th) elif math.sin(ky) <= 0.0005: tmp = math.sin(th) * (ky / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(th) * (1.0 + (-0.5 * (math.pow(math.sin(kx), 2.0) / (ky * ky)))) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(-sin(th)); elseif (sin(ky) <= 0.0005) tmp = Float64(sin(th) * Float64(ky / hypot(ky, sin(kx)))); else tmp = Float64(sin(th) * Float64(1.0 + Float64(-0.5 * Float64((sin(kx) ^ 2.0) / Float64(ky * ky))))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = -sin(th); elseif (sin(ky) <= 0.0005) tmp = sin(th) * (ky / hypot(ky, sin(kx))); else tmp = sin(th) * (1.0 + (-0.5 * ((sin(kx) ^ 2.0) / (ky * ky)))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0005], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] / N[(ky * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 0.0005:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(1 + -0.5 \cdot \frac{{\sin kx}^{2}}{ky \cdot ky}\right)\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 5.9%
Taylor expanded in ky around 0 28.1%
Taylor expanded in ky around -inf 54.0%
neg-mul-154.0%
Simplified54.0%
if -0.0100000000000000002 < (sin.f64 ky) < 5.0000000000000001e-4Initial program 88.5%
+-commutative88.5%
unpow288.5%
unpow288.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.4%
Taylor expanded in ky around 0 99.4%
if 5.0000000000000001e-4 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 6.0%
Taylor expanded in ky around 0 33.0%
Taylor expanded in ky around inf 58.0%
unpow258.0%
Simplified58.0%
Final simplification78.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (- (sin th)) (if (<= (sin ky) 0.0005) (* (sin th) (/ ky (hypot ky (sin kx)))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = -sin(th);
} else if (sin(ky) <= 0.0005) {
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.01) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 0.0005) {
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.01: tmp = -math.sin(th) elif math.sin(ky) <= 0.0005: 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.01) tmp = Float64(-sin(th)); elseif (sin(ky) <= 0.0005) 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.01) tmp = -sin(th); elseif (sin(ky) <= 0.0005) 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.01], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 0.0005], 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.01:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 0.0005:\\
\;\;\;\;\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.0100000000000000002Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 5.9%
Taylor expanded in ky around 0 28.1%
Taylor expanded in ky around -inf 54.0%
neg-mul-154.0%
Simplified54.0%
if -0.0100000000000000002 < (sin.f64 ky) < 5.0000000000000001e-4Initial program 88.5%
+-commutative88.5%
unpow288.5%
unpow288.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.4%
Taylor expanded in ky around 0 99.4%
if 5.0000000000000001e-4 < (sin.f64 ky) Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 58.0%
Final simplification78.3%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.04)
(* (sin th) (/ ky (fabs (sin kx))))
(if (<= (sin kx) 1e-6)
(* (sin th) (/ ky (hypot ky kx)))
(* (sin ky) (/ (sin th) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = sin(th) * (ky / fabs(sin(kx)));
} else if (sin(kx) <= 1e-6) {
tmp = sin(th) * (ky / hypot(ky, kx));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-6) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, kx));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.04: tmp = math.sin(th) * (ky / math.fabs(math.sin(kx))) elif math.sin(kx) <= 1e-6: tmp = math.sin(th) * (ky / math.hypot(ky, kx)) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.04) tmp = Float64(sin(th) * Float64(ky / abs(sin(kx)))); elseif (sin(kx) <= 1e-6) tmp = Float64(sin(th) * Float64(ky / hypot(ky, kx))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = sin(th) * (ky / abs(sin(kx))); elseif (sin(kx) <= 1e-6) tmp = sin(th) * (ky / hypot(ky, kx)); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
\mathbf{elif}\;\sin kx \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 20.0%
add-sqr-sqrt0.0%
sqrt-prod62.9%
rem-sqrt-square62.9%
Applied egg-rr62.9%
Taylor expanded in ky around 0 54.4%
if -0.0400000000000000008 < (sin.f64 kx) < 9.99999999999999955e-7Initial program 87.4%
+-commutative87.4%
unpow287.4%
unpow287.4%
hypot-def99.9%
Simplified99.9%
Taylor expanded in ky around 0 55.4%
Taylor expanded in ky around 0 76.9%
Taylor expanded in kx around 0 76.2%
if 9.99999999999999955e-7 < (sin.f64 kx) Initial program 99.4%
associate-*l/99.3%
associate-*r/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Simplified99.3%
Taylor expanded in ky around 0 57.0%
Final simplification65.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.04)
(* (sin th) (/ ky (fabs (sin kx))))
(if (<= (sin kx) 1e-6)
(* (sin th) (/ ky (hypot ky kx)))
(* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = sin(th) * (ky / fabs(sin(kx)));
} else if (sin(kx) <= 1e-6) {
tmp = sin(th) * (ky / hypot(ky, kx));
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-6) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= -0.04: tmp = math.sin(th) * (ky / math.fabs(math.sin(kx))) elif math.sin(kx) <= 1e-6: tmp = math.sin(th) * (ky / math.hypot(ky, kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.04) tmp = Float64(sin(th) * Float64(ky / abs(sin(kx)))); elseif (sin(kx) <= 1e-6) tmp = Float64(sin(th) * Float64(ky / hypot(ky, kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = sin(th) * (ky / abs(sin(kx))); elseif (sin(kx) <= 1e-6) tmp = sin(th) * (ky / hypot(ky, kx)); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
\mathbf{elif}\;\sin kx \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 20.0%
add-sqr-sqrt0.0%
sqrt-prod62.9%
rem-sqrt-square62.9%
Applied egg-rr62.9%
Taylor expanded in ky around 0 54.4%
if -0.0400000000000000008 < (sin.f64 kx) < 9.99999999999999955e-7Initial program 87.4%
+-commutative87.4%
unpow287.4%
unpow287.4%
hypot-def99.9%
Simplified99.9%
Taylor expanded in ky around 0 55.4%
Taylor expanded in ky around 0 76.9%
Taylor expanded in kx around 0 76.2%
if 9.99999999999999955e-7 < (sin.f64 kx) Initial program 99.4%
+-commutative99.4%
unpow299.4%
unpow299.4%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 57.1%
Final simplification65.1%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.04)
(* (sin th) (/ ky (fabs (sin kx))))
(if (<= (sin kx) 1e-6)
(* (sin th) (/ ky (hypot ky kx)))
(/ (sin ky) (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = sin(th) * (ky / fabs(sin(kx)));
} else if (sin(kx) <= 1e-6) {
tmp = sin(th) * (ky / hypot(ky, kx));
} else {
tmp = sin(ky) / (sin(kx) / sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
} else if (Math.sin(kx) <= 1e-6) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, kx));
} 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.04: tmp = math.sin(th) * (ky / math.fabs(math.sin(kx))) elif math.sin(kx) <= 1e-6: tmp = math.sin(th) * (ky / math.hypot(ky, kx)) 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.04) tmp = Float64(sin(th) * Float64(ky / abs(sin(kx)))); elseif (sin(kx) <= 1e-6) tmp = Float64(sin(th) * Float64(ky / hypot(ky, kx))); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = sin(th) * (ky / abs(sin(kx))); elseif (sin(kx) <= 1e-6) tmp = sin(th) * (ky / hypot(ky, kx)); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\sin th \cdot \frac{ky}{\left|\sin kx\right|}\\
\mathbf{elif}\;\sin kx \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 20.0%
add-sqr-sqrt0.0%
sqrt-prod62.9%
rem-sqrt-square62.9%
Applied egg-rr62.9%
Taylor expanded in ky around 0 54.4%
if -0.0400000000000000008 < (sin.f64 kx) < 9.99999999999999955e-7Initial program 87.4%
+-commutative87.4%
unpow287.4%
unpow287.4%
hypot-def99.9%
Simplified99.9%
Taylor expanded in ky around 0 55.4%
Taylor expanded in ky around 0 76.9%
Taylor expanded in kx around 0 76.2%
if 9.99999999999999955e-7 < (sin.f64 kx) Initial program 99.4%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 57.2%
Final simplification65.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.04)
(/ (sin th) (/ (fabs (sin kx)) ky))
(if (<= (sin kx) 1e-6)
(* (sin th) (/ ky (hypot ky kx)))
(/ (sin ky) (/ (sin kx) (sin th))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.04) {
tmp = sin(th) / (fabs(sin(kx)) / ky);
} else if (sin(kx) <= 1e-6) {
tmp = sin(th) * (ky / hypot(ky, kx));
} else {
tmp = sin(ky) / (sin(kx) / sin(th));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.04) {
tmp = Math.sin(th) / (Math.abs(Math.sin(kx)) / ky);
} else if (Math.sin(kx) <= 1e-6) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, kx));
} 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.04: tmp = math.sin(th) / (math.fabs(math.sin(kx)) / ky) elif math.sin(kx) <= 1e-6: tmp = math.sin(th) * (ky / math.hypot(ky, kx)) 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.04) tmp = Float64(sin(th) / Float64(abs(sin(kx)) / ky)); elseif (sin(kx) <= 1e-6) tmp = Float64(sin(th) * Float64(ky / hypot(ky, kx))); else tmp = Float64(sin(ky) / Float64(sin(kx) / sin(th))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= -0.04) tmp = sin(th) / (abs(sin(kx)) / ky); elseif (sin(kx) <= 1e-6) tmp = sin(th) * (ky / hypot(ky, kx)); else tmp = sin(ky) / (sin(kx) / sin(th)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.04], N[(N[Sin[th], $MachinePrecision] / N[(N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.04:\\
\;\;\;\;\frac{\sin th}{\frac{\left|\sin kx\right|}{ky}}\\
\mathbf{elif}\;\sin kx \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0400000000000000008Initial program 99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 20.0%
add-sqr-sqrt0.0%
sqrt-prod62.9%
rem-sqrt-square62.9%
Applied egg-rr62.9%
Taylor expanded in ky around 0 54.3%
associate-/l*54.3%
Simplified54.3%
if -0.0400000000000000008 < (sin.f64 kx) < 9.99999999999999955e-7Initial program 87.4%
+-commutative87.4%
unpow287.4%
unpow287.4%
hypot-def99.9%
Simplified99.9%
Taylor expanded in ky around 0 55.4%
Taylor expanded in ky around 0 76.9%
Taylor expanded in kx around 0 76.2%
if 9.99999999999999955e-7 < (sin.f64 kx) Initial program 99.4%
associate-/r/99.5%
+-commutative99.5%
unpow299.5%
unpow299.5%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 57.2%
Final simplification65.1%
(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 93.9%
associate-*l/92.3%
associate-*r/93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot ky (sin kx))))
(if (<= th -8.2e-10)
(* (sin th) (/ ky t_1))
(if (<= th 1.35e+15)
(* (sin ky) (/ th (hypot (sin ky) (sin kx))))
(if (<= th 4.2e+151)
(/ (sin th) (/ t_1 ky))
(* (sin ky) (/ (sin th) (hypot (sin ky) kx))))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(ky, sin(kx));
double tmp;
if (th <= -8.2e-10) {
tmp = sin(th) * (ky / t_1);
} else if (th <= 1.35e+15) {
tmp = sin(ky) * (th / hypot(sin(ky), sin(kx)));
} else if (th <= 4.2e+151) {
tmp = sin(th) / (t_1 / ky);
} else {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(ky, Math.sin(kx));
double tmp;
if (th <= -8.2e-10) {
tmp = Math.sin(th) * (ky / t_1);
} else if (th <= 1.35e+15) {
tmp = Math.sin(ky) * (th / Math.hypot(Math.sin(ky), Math.sin(kx)));
} else if (th <= 4.2e+151) {
tmp = Math.sin(th) / (t_1 / ky);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(ky, math.sin(kx)) tmp = 0 if th <= -8.2e-10: tmp = math.sin(th) * (ky / t_1) elif th <= 1.35e+15: tmp = math.sin(ky) * (th / math.hypot(math.sin(ky), math.sin(kx))) elif th <= 4.2e+151: tmp = math.sin(th) / (t_1 / ky) else: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) return tmp
function code(kx, ky, th) t_1 = hypot(ky, sin(kx)) tmp = 0.0 if (th <= -8.2e-10) tmp = Float64(sin(th) * Float64(ky / t_1)); elseif (th <= 1.35e+15) tmp = Float64(sin(ky) * Float64(th / hypot(sin(ky), sin(kx)))); elseif (th <= 4.2e+151) tmp = Float64(sin(th) / Float64(t_1 / ky)); else tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(ky, sin(kx)); tmp = 0.0; if (th <= -8.2e-10) tmp = sin(th) * (ky / t_1); elseif (th <= 1.35e+15) tmp = sin(ky) * (th / hypot(sin(ky), sin(kx))); elseif (th <= 4.2e+151) tmp = sin(th) / (t_1 / ky); else tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[th, -8.2e-10], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 1.35e+15], N[(N[Sin[ky], $MachinePrecision] * N[(th / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 4.2e+151], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / ky), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(ky, \sin kx\right)\\
\mathbf{if}\;th \leq -8.2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{elif}\;th \leq 1.35 \cdot 10^{+15}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 4.2 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\end{array}
\end{array}
if th < -8.1999999999999996e-10Initial program 92.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 51.7%
Taylor expanded in ky around 0 63.3%
if -8.1999999999999996e-10 < th < 1.35e15Initial program 93.7%
associate-/r/93.7%
+-commutative93.7%
unpow293.7%
unpow293.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 92.2%
associate-*r/92.3%
unpow292.3%
unpow292.3%
hypot-def98.3%
*-rgt-identity98.3%
hypot-def92.3%
unpow292.3%
unpow292.3%
+-commutative92.3%
unpow292.3%
unpow292.3%
hypot-def98.3%
Simplified98.3%
clear-num97.7%
associate-/r/98.1%
clear-num98.3%
hypot-udef92.3%
+-commutative92.3%
hypot-udef98.3%
Applied egg-rr98.3%
if 1.35e15 < th < 4.2000000000000001e151Initial program 95.5%
+-commutative95.5%
unpow295.5%
unpow295.5%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 63.5%
Taylor expanded in ky around 0 75.9%
*-commutative75.9%
clear-num75.9%
un-div-inv76.0%
Applied egg-rr76.0%
if 4.2000000000000001e151 < th Initial program 96.5%
associate-*l/96.4%
associate-*r/96.3%
+-commutative96.3%
unpow296.3%
unpow296.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 67.4%
Final simplification83.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot ky (sin kx))))
(if (<= th -7.8e-5)
(* (sin th) (/ ky t_1))
(if (<= th 1.35e+15)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(if (<= th 1.9e+151)
(/ (sin th) (/ t_1 ky))
(* (sin ky) (/ (sin th) (hypot (sin ky) kx))))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(ky, sin(kx));
double tmp;
if (th <= -7.8e-5) {
tmp = sin(th) * (ky / t_1);
} else if (th <= 1.35e+15) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else if (th <= 1.9e+151) {
tmp = sin(th) / (t_1 / ky);
} else {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(ky, Math.sin(kx));
double tmp;
if (th <= -7.8e-5) {
tmp = Math.sin(th) * (ky / t_1);
} else if (th <= 1.35e+15) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else if (th <= 1.9e+151) {
tmp = Math.sin(th) / (t_1 / ky);
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(ky, math.sin(kx)) tmp = 0 if th <= -7.8e-5: tmp = math.sin(th) * (ky / t_1) elif th <= 1.35e+15: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th elif th <= 1.9e+151: tmp = math.sin(th) / (t_1 / ky) else: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) return tmp
function code(kx, ky, th) t_1 = hypot(ky, sin(kx)) tmp = 0.0 if (th <= -7.8e-5) tmp = Float64(sin(th) * Float64(ky / t_1)); elseif (th <= 1.35e+15) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); elseif (th <= 1.9e+151) tmp = Float64(sin(th) / Float64(t_1 / ky)); else tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(ky, sin(kx)); tmp = 0.0; if (th <= -7.8e-5) tmp = sin(th) * (ky / t_1); elseif (th <= 1.35e+15) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; elseif (th <= 1.9e+151) tmp = sin(th) / (t_1 / ky); else tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[th, -7.8e-5], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 1.35e+15], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[th, 1.9e+151], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / ky), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(ky, \sin kx\right)\\
\mathbf{if}\;th \leq -7.8 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{elif}\;th \leq 1.35 \cdot 10^{+15}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;th \leq 1.9 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\end{array}
\end{array}
if th < -7.7999999999999999e-5Initial program 92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 50.2%
Taylor expanded in ky around 0 62.1%
if -7.7999999999999999e-5 < th < 1.35e15Initial program 93.8%
associate-/r/93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 92.3%
associate-*r/92.4%
unpow292.4%
unpow292.4%
hypot-def98.3%
*-rgt-identity98.3%
hypot-def92.4%
unpow292.4%
unpow292.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-def98.3%
Simplified98.3%
associate-/r/98.4%
hypot-udef92.4%
+-commutative92.4%
hypot-udef98.4%
Applied egg-rr98.4%
if 1.35e15 < th < 1.9e151Initial program 95.5%
+-commutative95.5%
unpow295.5%
unpow295.5%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 63.5%
Taylor expanded in ky around 0 75.9%
*-commutative75.9%
clear-num75.9%
un-div-inv76.0%
Applied egg-rr76.0%
if 1.9e151 < th Initial program 96.5%
associate-*l/96.4%
associate-*r/96.3%
+-commutative96.3%
unpow296.3%
unpow296.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 67.4%
Final simplification83.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (hypot ky (sin kx))))
(if (<= th -2.3e-5)
(* (sin th) (/ ky t_1))
(if (<= th 1.35e+15)
(* (/ (sin ky) (hypot (sin ky) (sin kx))) th)
(if (<= th 4.1e+151)
(/ (sin th) (/ t_1 ky))
(/ (sin th) (/ (hypot (sin ky) kx) (sin ky))))))))
double code(double kx, double ky, double th) {
double t_1 = hypot(ky, sin(kx));
double tmp;
if (th <= -2.3e-5) {
tmp = sin(th) * (ky / t_1);
} else if (th <= 1.35e+15) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else if (th <= 4.1e+151) {
tmp = sin(th) / (t_1 / ky);
} else {
tmp = sin(th) / (hypot(sin(ky), kx) / sin(ky));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.hypot(ky, Math.sin(kx));
double tmp;
if (th <= -2.3e-5) {
tmp = Math.sin(th) * (ky / t_1);
} else if (th <= 1.35e+15) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else if (th <= 4.1e+151) {
tmp = Math.sin(th) / (t_1 / ky);
} else {
tmp = Math.sin(th) / (Math.hypot(Math.sin(ky), kx) / Math.sin(ky));
}
return tmp;
}
def code(kx, ky, th): t_1 = math.hypot(ky, math.sin(kx)) tmp = 0 if th <= -2.3e-5: tmp = math.sin(th) * (ky / t_1) elif th <= 1.35e+15: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th elif th <= 4.1e+151: tmp = math.sin(th) / (t_1 / ky) else: tmp = math.sin(th) / (math.hypot(math.sin(ky), kx) / math.sin(ky)) return tmp
function code(kx, ky, th) t_1 = hypot(ky, sin(kx)) tmp = 0.0 if (th <= -2.3e-5) tmp = Float64(sin(th) * Float64(ky / t_1)); elseif (th <= 1.35e+15) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); elseif (th <= 4.1e+151) tmp = Float64(sin(th) / Float64(t_1 / ky)); else tmp = Float64(sin(th) / Float64(hypot(sin(ky), kx) / sin(ky))); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = hypot(ky, sin(kx)); tmp = 0.0; if (th <= -2.3e-5) tmp = sin(th) * (ky / t_1); elseif (th <= 1.35e+15) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; elseif (th <= 4.1e+151) tmp = sin(th) / (t_1 / ky); else tmp = sin(th) / (hypot(sin(ky), kx) / sin(ky)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[th, -2.3e-5], N[(N[Sin[th], $MachinePrecision] * N[(ky / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[th, 1.35e+15], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[th, 4.1e+151], N[(N[Sin[th], $MachinePrecision] / N[(t$95$1 / ky), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{hypot}\left(ky, \sin kx\right)\\
\mathbf{if}\;th \leq -2.3 \cdot 10^{-5}:\\
\;\;\;\;\sin th \cdot \frac{ky}{t_1}\\
\mathbf{elif}\;th \leq 1.35 \cdot 10^{+15}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;th \leq 4.1 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, kx\right)}{\sin ky}}\\
\end{array}
\end{array}
if th < -2.3e-5Initial program 92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 50.2%
Taylor expanded in ky around 0 62.1%
if -2.3e-5 < th < 1.35e15Initial program 93.8%
associate-/r/93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.7%
Simplified99.7%
Taylor expanded in th around 0 92.3%
associate-*r/92.4%
unpow292.4%
unpow292.4%
hypot-def98.3%
*-rgt-identity98.3%
hypot-def92.4%
unpow292.4%
unpow292.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-def98.3%
Simplified98.3%
associate-/r/98.4%
hypot-udef92.4%
+-commutative92.4%
hypot-udef98.4%
Applied egg-rr98.4%
if 1.35e15 < th < 4.0999999999999998e151Initial program 95.5%
+-commutative95.5%
unpow295.5%
unpow295.5%
hypot-def99.4%
Simplified99.4%
Taylor expanded in ky around 0 63.5%
Taylor expanded in ky around 0 75.9%
*-commutative75.9%
clear-num75.9%
un-div-inv76.0%
Applied egg-rr76.0%
if 4.0999999999999998e151 < th Initial program 96.5%
+-commutative96.5%
unpow296.5%
unpow296.5%
hypot-def99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in kx around 0 67.6%
Final simplification83.4%
(FPCore (kx ky th) :precision binary64 (if (<= kx 0.001) (* (sin ky) (/ (sin th) (hypot (sin ky) kx))) (* (sin th) (/ (sin ky) (fabs (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.001) {
tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx));
} else {
tmp = sin(th) * (sin(ky) / fabs(sin(kx)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (kx <= 0.001) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(Math.sin(ky), kx));
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.abs(Math.sin(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if kx <= 0.001: tmp = math.sin(ky) * (math.sin(th) / math.hypot(math.sin(ky), kx)) else: tmp = math.sin(th) * (math.sin(ky) / math.fabs(math.sin(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (kx <= 0.001) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(sin(ky), kx))); else tmp = Float64(sin(th) * Float64(sin(ky) / abs(sin(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (kx <= 0.001) tmp = sin(ky) * (sin(th) / hypot(sin(ky), kx)); else tmp = sin(th) * (sin(ky) / abs(sin(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[kx, 0.001], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;kx \leq 0.001:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left|\sin kx\right|}\\
\end{array}
\end{array}
if kx < 1e-3Initial program 92.0%
associate-*l/89.8%
associate-*r/91.9%
+-commutative91.9%
unpow291.9%
unpow291.9%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 69.3%
if 1e-3 < kx Initial program 99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 39.3%
add-sqr-sqrt26.0%
sqrt-prod58.3%
rem-sqrt-square58.3%
Applied egg-rr58.3%
Final simplification66.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) 1e-6) (* (sin th) (/ ky (hypot ky kx))) (* (sin ky) (/ (sin th) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 1e-6) {
tmp = sin(th) * (ky / hypot(ky, kx));
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= 1e-6) {
tmp = Math.sin(th) * (ky / Math.hypot(ky, kx));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(kx) <= 1e-6: tmp = math.sin(th) * (ky / math.hypot(ky, kx)) else: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 1e-6) tmp = Float64(sin(th) * Float64(ky / hypot(ky, kx))); else tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(kx) <= 1e-6) tmp = sin(th) * (ky / hypot(ky, kx)); else tmp = sin(ky) * (sin(th) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-6], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 10^{-6}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\mathsf{hypot}\left(ky, kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 9.99999999999999955e-7Initial program 92.2%
+-commutative92.2%
unpow292.2%
unpow292.2%
hypot-def99.8%
Simplified99.8%
Taylor expanded in ky around 0 55.3%
Taylor expanded in ky around 0 70.0%
Taylor expanded in kx around 0 56.0%
if 9.99999999999999955e-7 < (sin.f64 kx) Initial program 99.4%
associate-*l/99.3%
associate-*r/99.3%
+-commutative99.3%
unpow299.3%
unpow299.3%
hypot-def99.3%
Simplified99.3%
Taylor expanded in ky around 0 57.0%
Final simplification56.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -2.5e-139)
t_1
(if (<= ky -2.25e-203)
(/ ky (/ (sin kx) th))
(if (<= ky -1.85e-230)
t_1
(if (<= ky 8e-105)
(* (sin th) (/ ky kx))
(if (<= ky 2.1e+29) (sin th) (if (<= ky 6e+175) t_1 (sin th)))))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -2.5e-139) {
tmp = t_1;
} else if (ky <= -2.25e-203) {
tmp = ky / (sin(kx) / th);
} else if (ky <= -1.85e-230) {
tmp = t_1;
} else if (ky <= 8e-105) {
tmp = sin(th) * (ky / kx);
} else if (ky <= 2.1e+29) {
tmp = sin(th);
} else if (ky <= 6e+175) {
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 <= (-2.5d-139)) then
tmp = t_1
else if (ky <= (-2.25d-203)) then
tmp = ky / (sin(kx) / th)
else if (ky <= (-1.85d-230)) then
tmp = t_1
else if (ky <= 8d-105) then
tmp = sin(th) * (ky / kx)
else if (ky <= 2.1d+29) then
tmp = sin(th)
else if (ky <= 6d+175) 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 <= -2.5e-139) {
tmp = t_1;
} else if (ky <= -2.25e-203) {
tmp = ky / (Math.sin(kx) / th);
} else if (ky <= -1.85e-230) {
tmp = t_1;
} else if (ky <= 8e-105) {
tmp = Math.sin(th) * (ky / kx);
} else if (ky <= 2.1e+29) {
tmp = Math.sin(th);
} else if (ky <= 6e+175) {
tmp = t_1;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = -math.sin(th) tmp = 0 if ky <= -2.5e-139: tmp = t_1 elif ky <= -2.25e-203: tmp = ky / (math.sin(kx) / th) elif ky <= -1.85e-230: tmp = t_1 elif ky <= 8e-105: tmp = math.sin(th) * (ky / kx) elif ky <= 2.1e+29: tmp = math.sin(th) elif ky <= 6e+175: 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 <= -2.5e-139) tmp = t_1; elseif (ky <= -2.25e-203) tmp = Float64(ky / Float64(sin(kx) / th)); elseif (ky <= -1.85e-230) tmp = t_1; elseif (ky <= 8e-105) tmp = Float64(sin(th) * Float64(ky / kx)); elseif (ky <= 2.1e+29) tmp = sin(th); elseif (ky <= 6e+175) 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 <= -2.5e-139) tmp = t_1; elseif (ky <= -2.25e-203) tmp = ky / (sin(kx) / th); elseif (ky <= -1.85e-230) tmp = t_1; elseif (ky <= 8e-105) tmp = sin(th) * (ky / kx); elseif (ky <= 2.1e+29) tmp = sin(th); elseif (ky <= 6e+175) 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, -2.5e-139], t$95$1, If[LessEqual[ky, -2.25e-203], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, -1.85e-230], t$95$1, If[LessEqual[ky, 8e-105], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.1e+29], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 6e+175], t$95$1, N[Sin[th], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -2.5 \cdot 10^{-139}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -2.25 \cdot 10^{-203}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{elif}\;ky \leq -1.85 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 8 \cdot 10^{-105}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{elif}\;ky \leq 2.1 \cdot 10^{+29}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 6 \cdot 10^{+175}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -2.50000000000000017e-139 or -2.2500000000000001e-203 < ky < -1.84999999999999991e-230 or 2.1000000000000002e29 < ky < 6.0000000000000003e175Initial program 95.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 30.0%
Taylor expanded in ky around 0 46.0%
Taylor expanded in ky around -inf 40.5%
neg-mul-140.5%
Simplified40.5%
if -2.50000000000000017e-139 < ky < -2.2500000000000001e-203Initial program 92.0%
+-commutative92.0%
unpow292.0%
unpow292.0%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 56.0%
Taylor expanded in th around 0 41.2%
*-commutative41.2%
associate-/l*41.1%
Simplified41.1%
if -1.84999999999999991e-230 < ky < 7.99999999999999972e-105Initial program 85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in kx around 0 71.1%
Taylor expanded in ky around 0 46.1%
if 7.99999999999999972e-105 < ky < 2.1000000000000002e29 or 6.0000000000000003e175 < ky Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 40.4%
Final simplification41.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -1.62e-305)
t_1
(if (<= ky 1.95e-105)
(sqrt (* th th))
(if (<= ky 2.1e+29) (sin th) (if (<= ky 6e+175) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -1.62e-305) {
tmp = t_1;
} else if (ky <= 1.95e-105) {
tmp = sqrt((th * th));
} else if (ky <= 2.1e+29) {
tmp = sin(th);
} else if (ky <= 6e+175) {
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.62d-305)) then
tmp = t_1
else if (ky <= 1.95d-105) then
tmp = sqrt((th * th))
else if (ky <= 2.1d+29) then
tmp = sin(th)
else if (ky <= 6d+175) 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.62e-305) {
tmp = t_1;
} else if (ky <= 1.95e-105) {
tmp = Math.sqrt((th * th));
} else if (ky <= 2.1e+29) {
tmp = Math.sin(th);
} else if (ky <= 6e+175) {
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.62e-305: tmp = t_1 elif ky <= 1.95e-105: tmp = math.sqrt((th * th)) elif ky <= 2.1e+29: tmp = math.sin(th) elif ky <= 6e+175: 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.62e-305) tmp = t_1; elseif (ky <= 1.95e-105) tmp = sqrt(Float64(th * th)); elseif (ky <= 2.1e+29) tmp = sin(th); elseif (ky <= 6e+175) 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.62e-305) tmp = t_1; elseif (ky <= 1.95e-105) tmp = sqrt((th * th)); elseif (ky <= 2.1e+29) tmp = sin(th); elseif (ky <= 6e+175) 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.62e-305], t$95$1, If[LessEqual[ky, 1.95e-105], N[Sqrt[N[(th * th), $MachinePrecision]], $MachinePrecision], If[LessEqual[ky, 2.1e+29], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 6e+175], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -1.62 \cdot 10^{-305}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 1.95 \cdot 10^{-105}:\\
\;\;\;\;\sqrt{th \cdot th}\\
\mathbf{elif}\;ky \leq 2.1 \cdot 10^{+29}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 6 \cdot 10^{+175}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.61999999999999999e-305 or 2.1000000000000002e29 < ky < 6.0000000000000003e175Initial program 94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 43.1%
Taylor expanded in ky around 0 56.1%
Taylor expanded in ky around -inf 35.7%
neg-mul-135.7%
Simplified35.7%
if -1.61999999999999999e-305 < ky < 1.95e-105Initial program 85.2%
+-commutative85.2%
unpow285.2%
unpow285.2%
hypot-def99.7%
Simplified99.7%
associate-/r/99.7%
div-inv99.4%
associate-/r*99.5%
Applied egg-rr99.5%
Taylor expanded in kx around 0 9.9%
Taylor expanded in th around 0 8.7%
remove-double-div8.7%
add-sqr-sqrt4.6%
sqrt-unprod29.6%
Applied egg-rr29.6%
if 1.95e-105 < ky < 2.1000000000000002e29 or 6.0000000000000003e175 < ky Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 39.9%
Final simplification35.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (- (sin th))))
(if (<= ky -1.85e-230)
t_1
(if (<= ky 1.8e-104)
(* (sin th) (/ ky kx))
(if (<= ky 2.1e+29) (sin th) (if (<= ky 6e+175) t_1 (sin th)))))))
double code(double kx, double ky, double th) {
double t_1 = -sin(th);
double tmp;
if (ky <= -1.85e-230) {
tmp = t_1;
} else if (ky <= 1.8e-104) {
tmp = sin(th) * (ky / kx);
} else if (ky <= 2.1e+29) {
tmp = sin(th);
} else if (ky <= 6e+175) {
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.85d-230)) then
tmp = t_1
else if (ky <= 1.8d-104) then
tmp = sin(th) * (ky / kx)
else if (ky <= 2.1d+29) then
tmp = sin(th)
else if (ky <= 6d+175) 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.85e-230) {
tmp = t_1;
} else if (ky <= 1.8e-104) {
tmp = Math.sin(th) * (ky / kx);
} else if (ky <= 2.1e+29) {
tmp = Math.sin(th);
} else if (ky <= 6e+175) {
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.85e-230: tmp = t_1 elif ky <= 1.8e-104: tmp = math.sin(th) * (ky / kx) elif ky <= 2.1e+29: tmp = math.sin(th) elif ky <= 6e+175: 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.85e-230) tmp = t_1; elseif (ky <= 1.8e-104) tmp = Float64(sin(th) * Float64(ky / kx)); elseif (ky <= 2.1e+29) tmp = sin(th); elseif (ky <= 6e+175) 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.85e-230) tmp = t_1; elseif (ky <= 1.8e-104) tmp = sin(th) * (ky / kx); elseif (ky <= 2.1e+29) tmp = sin(th); elseif (ky <= 6e+175) 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.85e-230], t$95$1, If[LessEqual[ky, 1.8e-104], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision], If[LessEqual[ky, 2.1e+29], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 6e+175], t$95$1, N[Sin[th], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\sin th\\
\mathbf{if}\;ky \leq -1.85 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 1.8 \cdot 10^{-104}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{elif}\;ky \leq 2.1 \cdot 10^{+29}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 6 \cdot 10^{+175}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -1.84999999999999991e-230 or 2.1000000000000002e29 < ky < 6.0000000000000003e175Initial program 95.3%
+-commutative95.3%
unpow295.3%
unpow295.3%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 36.8%
Taylor expanded in ky around 0 51.2%
Taylor expanded in ky around -inf 38.5%
neg-mul-138.5%
Simplified38.5%
if -1.84999999999999991e-230 < ky < 1.7999999999999999e-104Initial program 85.7%
+-commutative85.7%
unpow285.7%
unpow285.7%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in ky around 0 99.7%
Taylor expanded in kx around 0 71.1%
Taylor expanded in ky around 0 46.1%
if 1.7999999999999999e-104 < ky < 2.1000000000000002e29 or 6.0000000000000003e175 < ky Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 40.4%
Final simplification40.9%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -3e-308) (and (not (<= ky 2.1e+29)) (<= ky 6e+175))) (- (sin th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -3e-308) || (!(ky <= 2.1e+29) && (ky <= 6e+175))) {
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 <= (-3d-308)) .or. (.not. (ky <= 2.1d+29)) .and. (ky <= 6d+175)) 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 <= -3e-308) || (!(ky <= 2.1e+29) && (ky <= 6e+175))) {
tmp = -Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -3e-308) or (not (ky <= 2.1e+29) and (ky <= 6e+175)): tmp = -math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -3e-308) || (!(ky <= 2.1e+29) && (ky <= 6e+175))) tmp = Float64(-sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -3e-308) || (~((ky <= 2.1e+29)) && (ky <= 6e+175))) tmp = -sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -3e-308], And[N[Not[LessEqual[ky, 2.1e+29]], $MachinePrecision], LessEqual[ky, 6e+175]]], (-N[Sin[th], $MachinePrecision]), N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -3 \cdot 10^{-308} \lor \neg \left(ky \leq 2.1 \cdot 10^{+29}\right) \land ky \leq 6 \cdot 10^{+175}:\\
\;\;\;\;-\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -3.00000000000000022e-308 or 2.1000000000000002e29 < ky < 6.0000000000000003e175Initial program 94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 43.1%
Taylor expanded in ky around 0 56.1%
Taylor expanded in ky around -inf 35.7%
neg-mul-135.7%
Simplified35.7%
if -3.00000000000000022e-308 < ky < 2.1000000000000002e29 or 6.0000000000000003e175 < ky Initial program 93.2%
+-commutative93.2%
unpow293.2%
unpow293.2%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 26.6%
Final simplification31.8%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return 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(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 21.0%
Final simplification21.0%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (+ (/ 1.0 th) (* th 0.16666666666666666))))
double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = 1.0d0 / ((1.0d0 / th) + (th * 0.16666666666666666d0))
end function
public static double code(double kx, double ky, double th) {
return 1.0 / ((1.0 / th) + (th * 0.16666666666666666));
}
def code(kx, ky, th): return 1.0 / ((1.0 / th) + (th * 0.16666666666666666))
function code(kx, ky, th) return Float64(1.0 / Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666))) end
function tmp = code(kx, ky, th) tmp = 1.0 / ((1.0 / th) + (th * 0.16666666666666666)); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{1}{th} + th \cdot 0.16666666666666666}
\end{array}
Initial program 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-def99.7%
Simplified99.7%
associate-/r/99.6%
div-inv99.4%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 21.0%
Taylor expanded in th around 0 12.1%
*-commutative12.1%
Simplified12.1%
Final simplification12.1%
(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 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-def99.7%
Simplified99.7%
associate-/r/99.6%
div-inv99.4%
associate-/r*99.6%
Applied egg-rr99.6%
Taylor expanded in kx around 0 21.0%
Taylor expanded in th around 0 11.6%
Final simplification11.6%
herbie shell --seed 2023230
(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)))