
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (/ (sin th) (/ (hypot (sin ky) (sin kx)) (sin ky))))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) / Math.sin(ky));
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) / math.sin(ky))
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) / sin(ky))) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(sin(ky), sin(kx)) / sin(ky)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin ky}}
\end{array}
Initial program 94.3%
unpow294.3%
sqr-neg94.3%
sin-neg94.3%
sin-neg94.3%
unpow294.3%
associate-*l/93.7%
associate-/l*94.3%
unpow294.3%
Simplified99.7%
associate-*r/96.8%
hypot-undefine93.7%
unpow293.7%
unpow293.7%
+-commutative93.7%
associate-*l/94.3%
*-commutative94.3%
clear-num94.3%
un-div-inv94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-undefine99.7%
Applied egg-rr99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (- (sin th)) (if (<= (sin ky) 0.0001) (* ky (/ (sin th) (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.0001) {
tmp = ky * (sin(th) / 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.0001) {
tmp = ky * (Math.sin(th) / 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.0001: tmp = ky * (math.sin(th) / 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.0001) tmp = Float64(ky * Float64(sin(th) / 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.0001) tmp = ky * (sin(th) / 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.0001], N[(ky * N[(N[Sin[th], $MachinePrecision] / 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.0001:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 2.2%
log1p-expm1-u2.2%
log1p-undefine2.9%
Applied egg-rr2.9%
log1p-define2.2%
log1p-expm1-u2.2%
add-sqr-sqrt1.1%
sqrt-unprod31.6%
sqr-neg31.6%
sqrt-unprod33.1%
add-sqr-sqrt63.3%
neg-sub063.3%
Applied egg-rr63.3%
neg-sub063.3%
Simplified63.3%
if -0.0100000000000000002 < (sin.f64 ky) < 1.00000000000000005e-4Initial program 88.4%
unpow288.4%
sqr-neg88.4%
sin-neg88.4%
sin-neg88.4%
unpow288.4%
associate-*l/87.0%
associate-/l*88.4%
unpow288.4%
Simplified99.7%
Taylor expanded in ky around 0 99.2%
Taylor expanded in ky around 0 99.2%
if 1.00000000000000005e-4 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 67.2%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.02)
(- (sin th))
(if (<= (sin ky) 5e-97)
(* (sin th) (/ (sin ky) (sin kx)))
(/ (* (sin th) (sin ky)) (sin ky)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-97) {
tmp = sin(th) * (sin(ky) / sin(kx));
} else {
tmp = (sin(th) * sin(ky)) / sin(ky);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-97) then
tmp = sin(th) * (sin(ky) / sin(kx))
else
tmp = (sin(th) * sin(ky)) / sin(ky)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-97) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = (Math.sin(th) * Math.sin(ky)) / Math.sin(ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = -math.sin(th) elif math.sin(ky) <= 5e-97: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = (math.sin(th) * math.sin(ky)) / math.sin(ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-97) tmp = Float64(sin(th) * Float64(sin(ky) / sin(kx))); else tmp = Float64(Float64(sin(th) * sin(ky)) / sin(ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = -sin(th); elseif (sin(ky) <= 5e-97) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = (sin(th) * sin(ky)) / sin(ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-97], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-97}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot \sin ky}{\sin ky}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 2.2%
log1p-expm1-u2.2%
log1p-undefine2.9%
Applied egg-rr2.9%
log1p-define2.2%
log1p-expm1-u2.2%
add-sqr-sqrt1.1%
sqrt-unprod31.6%
sqr-neg31.6%
sqrt-unprod33.1%
add-sqr-sqrt63.3%
neg-sub063.3%
Applied egg-rr63.3%
neg-sub063.3%
Simplified63.3%
if -0.0200000000000000004 < (sin.f64 ky) < 4.9999999999999995e-97Initial program 86.4%
Taylor expanded in ky around 0 48.0%
if 4.9999999999999995e-97 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 62.8%
associate-*r/64.1%
*-commutative64.1%
Applied egg-rr64.1%
Final simplification57.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (- (sin th)) (if (<= (sin ky) 5e-89) (* (sin th) (/ (sin ky) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-89) {
tmp = sin(th) * (sin(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) <= (-0.02d0)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-89) then
tmp = sin(th) * (sin(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) <= -0.02) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-89) {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = -math.sin(th) elif math.sin(ky) <= 5e-89: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-89) tmp = Float64(sin(th) * Float64(sin(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.02) tmp = -sin(th); elseif (sin(ky) <= 5e-89) tmp = sin(th) * (sin(ky) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-89], N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-89}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 2.2%
log1p-expm1-u2.2%
log1p-undefine2.9%
Applied egg-rr2.9%
log1p-define2.2%
log1p-expm1-u2.2%
add-sqr-sqrt1.1%
sqrt-unprod31.6%
sqr-neg31.6%
sqrt-unprod33.1%
add-sqr-sqrt63.3%
neg-sub063.3%
Applied egg-rr63.3%
neg-sub063.3%
Simplified63.3%
if -0.0200000000000000004 < (sin.f64 ky) < 4.99999999999999967e-89Initial program 86.8%
Taylor expanded in ky around 0 48.6%
if 4.99999999999999967e-89 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 65.3%
Final simplification57.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.02) (- (sin th)) (if (<= (sin ky) 5e-89) (* (sin ky) (/ (sin th) (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.02) {
tmp = -sin(th);
} else if (sin(ky) <= 5e-89) {
tmp = sin(ky) * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.02d0)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-89) then
tmp = sin(ky) * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.02) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-89) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.02: tmp = -math.sin(th) elif math.sin(ky) <= 5e-89: tmp = math.sin(ky) * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.02) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-89) tmp = Float64(sin(ky) * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.02) tmp = -sin(th); elseif (sin(ky) <= 5e-89) tmp = sin(ky) * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.02], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-89], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-89}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0200000000000000004Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 2.2%
log1p-expm1-u2.2%
log1p-undefine2.9%
Applied egg-rr2.9%
log1p-define2.2%
log1p-expm1-u2.2%
add-sqr-sqrt1.1%
sqrt-unprod31.6%
sqr-neg31.6%
sqrt-unprod33.1%
add-sqr-sqrt63.3%
neg-sub063.3%
Applied egg-rr63.3%
neg-sub063.3%
Simplified63.3%
if -0.0200000000000000004 < (sin.f64 ky) < 4.99999999999999967e-89Initial program 86.8%
unpow286.8%
sqr-neg86.8%
sin-neg86.8%
sin-neg86.8%
unpow286.8%
associate-*l/85.2%
associate-/l*86.8%
unpow286.8%
Simplified99.6%
Taylor expanded in ky around 0 48.5%
if 4.99999999999999967e-89 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 65.3%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ (sin ky) (hypot (sin ky) (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (sin(ky) / hypot(sin(ky), sin(kx)));
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(sin(ky) / hypot(sin(ky), sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (sin(ky) / hypot(sin(ky), sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\end{array}
Initial program 94.3%
+-commutative94.3%
unpow294.3%
unpow294.3%
hypot-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(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 94.3%
unpow294.3%
sqr-neg94.3%
sin-neg94.3%
sin-neg94.3%
unpow294.3%
associate-*l/93.7%
associate-/l*94.3%
unpow294.3%
Simplified99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (- (sin th)) (if (<= (sin ky) 5e-89) (* (sin th) (/ 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) <= 5e-89) {
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) <= (-0.01d0)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-89) 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) <= -0.01) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-89) {
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) <= -0.01: tmp = -math.sin(th) elif math.sin(ky) <= 5e-89: 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) <= -0.01) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-89) 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) <= -0.01) tmp = -sin(th); elseif (sin(ky) <= 5e-89) 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], -0.01], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-89], 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 -0.01:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-89}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 2.2%
log1p-expm1-u2.2%
log1p-undefine2.9%
Applied egg-rr2.9%
log1p-define2.2%
log1p-expm1-u2.2%
add-sqr-sqrt1.1%
sqrt-unprod31.6%
sqr-neg31.6%
sqrt-unprod33.1%
add-sqr-sqrt63.3%
neg-sub063.3%
Applied egg-rr63.3%
neg-sub063.3%
Simplified63.3%
if -0.0100000000000000002 < (sin.f64 ky) < 4.99999999999999967e-89Initial program 86.8%
Taylor expanded in ky around 0 48.6%
if 4.99999999999999967e-89 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 65.3%
Final simplification57.8%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (- (sin th)) (if (<= (sin ky) 5e-89) (* ky (/ (sin th) (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) <= 5e-89) {
tmp = ky * (sin(th) / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.01d0)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-89) then
tmp = ky * (sin(th) / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-89) {
tmp = ky * (Math.sin(th) / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = -math.sin(th) elif math.sin(ky) <= 5e-89: tmp = ky * (math.sin(th) / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(-sin(th)); elseif (sin(ky) <= 5e-89) tmp = Float64(ky * Float64(sin(th) / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = -sin(th); elseif (sin(ky) <= 5e-89) tmp = ky * (sin(th) / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], (-N[Sin[th], $MachinePrecision]), If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-89], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;-\sin th\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-89}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 2.2%
log1p-expm1-u2.2%
log1p-undefine2.9%
Applied egg-rr2.9%
log1p-define2.2%
log1p-expm1-u2.2%
add-sqr-sqrt1.1%
sqrt-unprod31.6%
sqr-neg31.6%
sqrt-unprod33.1%
add-sqr-sqrt63.3%
neg-sub063.3%
Applied egg-rr63.3%
neg-sub063.3%
Simplified63.3%
if -0.0100000000000000002 < (sin.f64 ky) < 4.99999999999999967e-89Initial program 86.8%
unpow286.8%
sqr-neg86.8%
sin-neg86.8%
sin-neg86.8%
unpow286.8%
associate-*l/85.2%
associate-/l*86.8%
unpow286.8%
Simplified99.6%
Taylor expanded in ky around 0 45.0%
associate-/l*48.5%
Simplified48.5%
if 4.99999999999999967e-89 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 65.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 0.000112) (* (sin ky) (/ (sin th) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.000112) {
tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 0.000112) {
tmp = Math.sin(ky) * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 0.000112: tmp = math.sin(ky) * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 0.000112) tmp = Float64(sin(ky) * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 0.000112) tmp = sin(ky) * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 0.000112], 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[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 0.000112:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 1.11999999999999998e-4Initial program 92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
associate-*l/91.4%
associate-/l*92.4%
unpow292.4%
Simplified99.7%
Taylor expanded in ky around 0 66.9%
if 1.11999999999999998e-4 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 34.9%
add-sqr-sqrt33.5%
sqrt-prod64.9%
rem-sqrt-square64.9%
Applied egg-rr64.9%
(FPCore (kx ky th) :precision binary64 (if (<= ky 2.4) (* ky (/ (sin th) (hypot ky (sin kx)))) (* (sin ky) (/ (sin th) (fabs (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.4) {
tmp = ky * (sin(th) / hypot(ky, sin(kx)));
} else {
tmp = sin(ky) * (sin(th) / fabs(sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 2.4) {
tmp = ky * (Math.sin(th) / Math.hypot(ky, Math.sin(kx)));
} else {
tmp = Math.sin(ky) * (Math.sin(th) / Math.abs(Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 2.4: tmp = ky * (math.sin(th) / math.hypot(ky, math.sin(kx))) else: tmp = math.sin(ky) * (math.sin(th) / math.fabs(math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 2.4) tmp = Float64(ky * Float64(sin(th) / hypot(ky, sin(kx)))); else tmp = Float64(sin(ky) * Float64(sin(th) / abs(sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 2.4) tmp = ky * (sin(th) / hypot(ky, sin(kx))); else tmp = sin(ky) * (sin(th) / abs(sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 2.4], N[(ky * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[ky], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 2.4:\\
\;\;\;\;ky \cdot \frac{\sin th}{\mathsf{hypot}\left(ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\left|\sin ky\right|}\\
\end{array}
\end{array}
if ky < 2.39999999999999991Initial program 92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
associate-*l/91.5%
associate-/l*92.4%
unpow292.4%
Simplified99.7%
Taylor expanded in ky around 0 66.9%
Taylor expanded in ky around 0 78.3%
if 2.39999999999999991 < ky Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.6%
associate-/l*99.6%
unpow299.6%
Simplified99.6%
Taylor expanded in kx around 0 34.0%
add-sqr-sqrt32.6%
sqrt-prod64.4%
rem-sqrt-square64.4%
Applied egg-rr64.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) -0.01) (- (sin th)) (if (<= (sin ky) 5e-89) (* ky (/ (sin th) 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) <= 5e-89) {
tmp = ky * (sin(th) / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= (-0.01d0)) then
tmp = -sin(th)
else if (sin(ky) <= 5d-89) then
tmp = ky * (sin(th) / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -0.01) {
tmp = -Math.sin(th);
} else if (Math.sin(ky) <= 5e-89) {
tmp = ky * (Math.sin(th) / 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) <= 5e-89: tmp = ky * (math.sin(th) / 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) <= 5e-89) tmp = Float64(ky * Float64(sin(th) / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -0.01) tmp = -sin(th); elseif (sin(ky) <= 5e-89) tmp = ky * (sin(th) / 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], 5e-89], N[(ky * N[(N[Sin[th], $MachinePrecision] / kx), $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 5 \cdot 10^{-89}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.6%
unpow299.6%
sqr-neg99.6%
sin-neg99.6%
sin-neg99.6%
unpow299.6%
associate-*l/99.7%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 2.2%
log1p-expm1-u2.2%
log1p-undefine2.9%
Applied egg-rr2.9%
log1p-define2.2%
log1p-expm1-u2.2%
add-sqr-sqrt1.1%
sqrt-unprod31.6%
sqr-neg31.6%
sqrt-unprod33.1%
add-sqr-sqrt63.3%
neg-sub063.3%
Applied egg-rr63.3%
neg-sub063.3%
Simplified63.3%
if -0.0100000000000000002 < (sin.f64 ky) < 4.99999999999999967e-89Initial program 86.8%
unpow286.8%
sqr-neg86.8%
sin-neg86.8%
sin-neg86.8%
unpow286.8%
associate-*l/85.2%
associate-/l*86.8%
unpow286.8%
Simplified99.6%
Taylor expanded in kx around 0 69.1%
Taylor expanded in ky around 0 36.6%
associate-/l*40.1%
Simplified40.1%
if 4.99999999999999967e-89 < (sin.f64 ky) Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.5%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 65.3%
(FPCore (kx ky th) :precision binary64 (if (<= ky 5e-182) (* ky (/ th kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5e-182) {
tmp = ky * (th / kx);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= 5d-182) then
tmp = ky * (th / kx)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 5e-182) {
tmp = ky * (th / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 5e-182: tmp = ky * (th / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 5e-182) tmp = Float64(ky * Float64(th / kx)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 5e-182) tmp = ky * (th / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 5e-182], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 5 \cdot 10^{-182}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < 5.00000000000000024e-182Initial program 92.0%
unpow292.0%
sqr-neg92.0%
sin-neg92.0%
sin-neg92.0%
unpow292.0%
associate-*l/90.9%
associate-/l*92.0%
unpow292.0%
Simplified99.6%
Taylor expanded in kx around 0 65.1%
Taylor expanded in th around 0 37.4%
Taylor expanded in ky around 0 16.7%
associate-/l*19.2%
Simplified19.2%
if 5.00000000000000024e-182 < ky Initial program 97.7%
unpow297.7%
sqr-neg97.7%
sin-neg97.7%
sin-neg97.7%
unpow297.7%
associate-*l/97.6%
associate-/l*97.8%
unpow297.8%
Simplified99.7%
Taylor expanded in kx around 0 34.8%
(FPCore (kx ky th) :precision binary64 (if (<= ky 7.2e-89) (* ky (/ th kx)) th))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.2e-89) {
tmp = ky * (th / 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 <= 7.2d-89) then
tmp = ky * (th / kx)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= 7.2e-89) {
tmp = ky * (th / kx);
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= 7.2e-89: tmp = ky * (th / kx) else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= 7.2e-89) tmp = Float64(ky * Float64(th / kx)); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= 7.2e-89) tmp = ky * (th / kx); else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, 7.2e-89], N[(ky * N[(th / kx), $MachinePrecision]), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.2 \cdot 10^{-89}:\\
\;\;\;\;ky \cdot \frac{th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if ky < 7.20000000000000014e-89Initial program 91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
associate-*l/90.7%
associate-/l*91.7%
unpow291.7%
Simplified99.7%
Taylor expanded in kx around 0 65.1%
Taylor expanded in th around 0 35.9%
Taylor expanded in ky around 0 17.1%
associate-/l*19.3%
Simplified19.3%
if 7.20000000000000014e-89 < ky Initial program 99.7%
unpow299.7%
sqr-neg99.7%
sin-neg99.7%
sin-neg99.7%
unpow299.7%
associate-*l/99.6%
associate-/l*99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in kx around 0 39.0%
Taylor expanded in th around 0 18.2%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.3%
unpow294.3%
sqr-neg94.3%
sin-neg94.3%
sin-neg94.3%
unpow294.3%
associate-*l/93.7%
associate-/l*94.3%
unpow294.3%
Simplified99.7%
Taylor expanded in kx around 0 21.4%
Taylor expanded in th around 0 10.1%
herbie shell --seed 2024148
(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)))