
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 92.5%
+-commutative92.5%
unpow292.5%
unpow292.5%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin th) -0.04)
(/ (sin th) (/ (sin kx) (sin ky)))
(if (<= (sin th) 5e-6)
(* th (/ (sin ky) (hypot (sin kx) (sin ky))))
(if (<= (sin th) 0.915) (sin th) (* (sin th) (/ (sin ky) (sin kx)))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(th) <= -0.04) {
tmp = sin(th) / (sin(kx) / sin(ky));
} else if (sin(th) <= 5e-6) {
tmp = th * (sin(ky) / hypot(sin(kx), sin(ky)));
} else if (sin(th) <= 0.915) {
tmp = sin(th);
} 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(th) <= -0.04) {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
} else if (Math.sin(th) <= 5e-6) {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky)));
} else if (Math.sin(th) <= 0.915) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.sin(ky) / Math.sin(kx));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(th) <= -0.04: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) elif math.sin(th) <= 5e-6: tmp = th * (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) elif math.sin(th) <= 0.915: tmp = math.sin(th) else: tmp = math.sin(th) * (math.sin(ky) / math.sin(kx)) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(th) <= -0.04) tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); elseif (sin(th) <= 5e-6) tmp = Float64(th * Float64(sin(ky) / hypot(sin(kx), sin(ky)))); elseif (sin(th) <= 0.915) tmp = sin(th); 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(th) <= -0.04) tmp = sin(th) / (sin(kx) / sin(ky)); elseif (sin(th) <= 5e-6) tmp = th * (sin(ky) / hypot(sin(kx), sin(ky))); elseif (sin(th) <= 0.915) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[th], $MachinePrecision], -0.04], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 5e-6], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 0.915], N[Sin[th], $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 th \leq -0.04:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\mathbf{elif}\;\sin th \leq 5 \cdot 10^{-6}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{elif}\;\sin th \leq 0.915:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 th) < -0.0400000000000000008Initial program 88.3%
+-commutative88.3%
unpow288.3%
unpow288.3%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.4%
un-div-inv99.6%
hypot-udef88.4%
unpow288.4%
unpow288.4%
+-commutative88.4%
unpow288.4%
unpow288.4%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 18.8%
if -0.0400000000000000008 < (sin.f64 th) < 5.00000000000000041e-6Initial program 93.5%
associate-/r/93.4%
+-commutative93.4%
unpow293.4%
sqr-neg93.4%
sin-neg93.4%
sin-neg93.4%
unpow293.4%
+-commutative93.4%
Simplified99.6%
frac-2neg99.6%
div-inv99.4%
distribute-neg-frac99.4%
hypot-udef93.2%
unpow293.2%
unpow293.2%
+-commutative93.2%
unpow293.2%
unpow293.2%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 92.2%
mul-1-neg92.2%
associate-*r/92.8%
distribute-neg-frac92.8%
Simplified99.1%
expm1-log1p-u99.1%
expm1-udef20.5%
Applied egg-rr20.5%
expm1-def99.3%
expm1-log1p99.3%
associate-/r/99.3%
hypot-def93.1%
unpow293.1%
unpow293.1%
+-commutative93.1%
unpow293.1%
unpow293.1%
hypot-def99.3%
Simplified99.3%
if 5.00000000000000041e-6 < (sin.f64 th) < 0.91500000000000004Initial program 95.1%
+-commutative95.1%
unpow295.1%
unpow295.1%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 35.6%
if 0.91500000000000004 < (sin.f64 th) Initial program 92.1%
Taylor expanded in ky around 0 25.8%
Final simplification65.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (/ (- (sin th)) (/ (sin kx) (sin ky))) (if (<= (sin kx) 2e-93) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = -sin(th) / (sin(kx) / sin(ky));
} else if (sin(kx) <= 2e-93) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.02d0)) then
tmp = -sin(th) / (sin(kx) / sin(ky))
else if (sin(kx) <= 2d-93) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = -Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
} else if (Math.sin(kx) <= 2e-93) {
tmp = Math.sin(th);
} 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.02: tmp = -math.sin(th) / (math.sin(kx) / math.sin(ky)) elif math.sin(kx) <= 2e-93: tmp = math.sin(th) 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.02) tmp = Float64(Float64(-sin(th)) / Float64(sin(kx) / sin(ky))); elseif (sin(kx) <= 2e-93) tmp = sin(th); 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.02) tmp = -sin(th) / (sin(kx) / sin(ky)); elseif (sin(kx) <= 2e-93) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[((-N[Sin[th], $MachinePrecision]) / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-93], N[Sin[th], $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.02:\\
\;\;\;\;\frac{-\sin th}{\frac{\sin kx}{\sin ky}}\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-93}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
associate-/r/99.2%
+-commutative99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in ky around 0 15.9%
Taylor expanded in ky around inf 15.9%
*-commutative15.9%
associate-*r/15.9%
Simplified15.9%
Applied egg-rr57.9%
div057.9%
neg-sub057.9%
associate-*r/57.9%
*-commutative57.9%
associate-/l*57.9%
Simplified57.9%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999998e-93Initial program 84.7%
+-commutative84.7%
unpow284.7%
unpow284.7%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 43.5%
if 1.9999999999999998e-93 < (sin.f64 kx) Initial program 99.6%
Taylor expanded in ky around 0 52.1%
Final simplification49.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (* (sin th) (/ (- (sin ky)) (sin kx))) (if (<= (sin kx) 2e-93) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = sin(th) * (-sin(ky) / sin(kx));
} else if (sin(kx) <= 2e-93) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.02d0)) then
tmp = sin(th) * (-sin(ky) / sin(kx))
else if (sin(kx) <= 2d-93) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.sin(th) * (-Math.sin(ky) / Math.sin(kx));
} else if (Math.sin(kx) <= 2e-93) {
tmp = Math.sin(th);
} 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.02: tmp = math.sin(th) * (-math.sin(ky) / math.sin(kx)) elif math.sin(kx) <= 2e-93: tmp = math.sin(th) 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.02) tmp = Float64(sin(th) * Float64(Float64(-sin(ky)) / sin(kx))); elseif (sin(kx) <= 2e-93) tmp = sin(th); 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.02) tmp = sin(th) * (-sin(ky) / sin(kx)); elseif (sin(kx) <= 2e-93) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(N[Sin[th], $MachinePrecision] * N[((-N[Sin[ky], $MachinePrecision]) / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-93], N[Sin[th], $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.02:\\
\;\;\;\;\sin th \cdot \frac{-\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-93}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
associate-/r/99.2%
+-commutative99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in ky around 0 15.9%
Taylor expanded in ky around inf 15.9%
*-commutative15.9%
associate-*r/15.9%
Simplified15.9%
Applied egg-rr57.9%
div057.9%
neg-sub057.9%
associate-*r/57.9%
associate-/l*57.9%
associate-/r/57.9%
distribute-lft-neg-in57.9%
distribute-frac-neg57.9%
Simplified57.9%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999998e-93Initial program 84.7%
+-commutative84.7%
unpow284.7%
unpow284.7%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 43.5%
if 1.9999999999999998e-93 < (sin.f64 kx) Initial program 99.6%
Taylor expanded in ky around 0 52.1%
Final simplification49.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (* (sin ky) (/ (- (sin th)) (sin kx))) (if (<= (sin kx) 2e-93) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = sin(ky) * (-sin(th) / sin(kx));
} else if (sin(kx) <= 2e-93) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.02d0)) then
tmp = sin(ky) * (-sin(th) / sin(kx))
else if (sin(kx) <= 2d-93) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.sin(ky) * (-Math.sin(th) / Math.sin(kx));
} else if (Math.sin(kx) <= 2e-93) {
tmp = Math.sin(th);
} 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.02: tmp = math.sin(ky) * (-math.sin(th) / math.sin(kx)) elif math.sin(kx) <= 2e-93: tmp = math.sin(th) 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.02) tmp = Float64(sin(ky) * Float64(Float64(-sin(th)) / sin(kx))); elseif (sin(kx) <= 2e-93) tmp = sin(th); 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.02) tmp = sin(ky) * (-sin(th) / sin(kx)); elseif (sin(kx) <= 2e-93) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[((-N[Sin[th], $MachinePrecision]) / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-93], N[Sin[th], $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.02:\\
\;\;\;\;\sin ky \cdot \frac{-\sin th}{\sin kx}\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-93}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
associate-/r/99.2%
+-commutative99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in ky around 0 15.9%
frac-2neg15.9%
neg-sub015.9%
metadata-eval15.9%
div-sub15.9%
metadata-eval15.9%
distribute-neg-frac15.9%
add-sqr-sqrt4.4%
sqrt-prod31.3%
sqr-neg31.3%
sqrt-unprod33.3%
add-sqr-sqrt57.9%
frac-2neg57.9%
div-inv57.9%
clear-num57.9%
Applied egg-rr57.9%
div057.9%
neg-sub057.9%
*-commutative57.9%
distribute-rgt-neg-in57.9%
Simplified57.9%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999998e-93Initial program 84.7%
+-commutative84.7%
unpow284.7%
unpow284.7%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 43.5%
if 1.9999999999999998e-93 < (sin.f64 kx) Initial program 99.6%
Taylor expanded in ky around 0 52.1%
Final simplification49.5%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) -0.02) (* (sin ky) (/ 1.0 (/ (- (sin kx)) (sin th)))) (if (<= (sin kx) 2e-93) (sin th) (* (sin th) (/ (sin ky) (sin kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.02) {
tmp = sin(ky) * (1.0 / (-sin(kx) / sin(th)));
} else if (sin(kx) <= 2e-93) {
tmp = sin(th);
} else {
tmp = sin(th) * (sin(ky) / sin(kx));
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(kx) <= (-0.02d0)) then
tmp = sin(ky) * (1.0d0 / (-sin(kx) / sin(th)))
else if (sin(kx) <= 2d-93) then
tmp = sin(th)
else
tmp = sin(th) * (sin(ky) / sin(kx))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(kx) <= -0.02) {
tmp = Math.sin(ky) * (1.0 / (-Math.sin(kx) / Math.sin(th)));
} else if (Math.sin(kx) <= 2e-93) {
tmp = Math.sin(th);
} 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.02: tmp = math.sin(ky) * (1.0 / (-math.sin(kx) / math.sin(th))) elif math.sin(kx) <= 2e-93: tmp = math.sin(th) 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.02) tmp = Float64(sin(ky) * Float64(1.0 / Float64(Float64(-sin(kx)) / sin(th)))); elseif (sin(kx) <= 2e-93) tmp = sin(th); 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.02) tmp = sin(ky) * (1.0 / (-sin(kx) / sin(th))); elseif (sin(kx) <= 2e-93) tmp = sin(th); else tmp = sin(th) * (sin(ky) / sin(kx)); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.02], N[(N[Sin[ky], $MachinePrecision] * N[(1.0 / N[((-N[Sin[kx], $MachinePrecision]) / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 2e-93], N[Sin[th], $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.02:\\
\;\;\;\;\sin ky \cdot \frac{1}{\frac{-\sin kx}{\sin th}}\\
\mathbf{elif}\;\sin kx \leq 2 \cdot 10^{-93}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.0200000000000000004Initial program 99.3%
associate-/r/99.2%
+-commutative99.2%
unpow299.2%
sqr-neg99.2%
sin-neg99.2%
sin-neg99.2%
unpow299.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in ky around 0 15.9%
frac-2neg15.9%
div-inv15.9%
add-sqr-sqrt11.4%
sqrt-unprod26.0%
sqr-neg26.0%
sqrt-prod24.5%
add-sqr-sqrt57.9%
distribute-neg-frac57.9%
Applied egg-rr57.9%
if -0.0200000000000000004 < (sin.f64 kx) < 1.9999999999999998e-93Initial program 84.7%
+-commutative84.7%
unpow284.7%
unpow284.7%
hypot-def99.9%
Simplified99.9%
Taylor expanded in kx around 0 43.5%
if 1.9999999999999998e-93 < (sin.f64 kx) Initial program 99.6%
Taylor expanded in ky around 0 52.1%
Final simplification49.5%
(FPCore (kx ky th) :precision binary64 (if (or (<= th -260.0) (not (<= th 0.00155))) (/ (* ky (sin th)) (hypot (sin ky) (sin kx))) (* th (/ (sin ky) (hypot (sin kx) (sin ky))))))
double code(double kx, double ky, double th) {
double tmp;
if ((th <= -260.0) || !(th <= 0.00155)) {
tmp = (ky * sin(th)) / hypot(sin(ky), sin(kx));
} else {
tmp = th * (sin(ky) / hypot(sin(kx), sin(ky)));
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if ((th <= -260.0) || !(th <= 0.00155)) {
tmp = (ky * Math.sin(th)) / Math.hypot(Math.sin(ky), Math.sin(kx));
} else {
tmp = th * (Math.sin(ky) / Math.hypot(Math.sin(kx), Math.sin(ky)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (th <= -260.0) or not (th <= 0.00155): tmp = (ky * math.sin(th)) / math.hypot(math.sin(ky), math.sin(kx)) else: tmp = th * (math.sin(ky) / math.hypot(math.sin(kx), math.sin(ky))) return tmp
function code(kx, ky, th) tmp = 0.0 if ((th <= -260.0) || !(th <= 0.00155)) tmp = Float64(Float64(ky * sin(th)) / hypot(sin(ky), sin(kx))); else tmp = Float64(th * Float64(sin(ky) / hypot(sin(kx), sin(ky)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((th <= -260.0) || ~((th <= 0.00155))) tmp = (ky * sin(th)) / hypot(sin(ky), sin(kx)); else tmp = th * (sin(ky) / hypot(sin(kx), sin(ky))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[th, -260.0], N[Not[LessEqual[th, 0.00155]], $MachinePrecision]], N[(N[(ky * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(th * N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq -260 \lor \neg \left(th \leq 0.00155\right):\\
\;\;\;\;\frac{ky \cdot \sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{else}:\\
\;\;\;\;th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\end{array}
\end{array}
if th < -260 or 0.00154999999999999995 < th Initial program 91.4%
associate-*l/91.3%
+-commutative91.3%
unpow291.3%
unpow291.3%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 55.5%
if -260 < th < 0.00154999999999999995Initial program 93.5%
associate-/r/93.4%
+-commutative93.4%
unpow293.4%
sqr-neg93.4%
sin-neg93.4%
sin-neg93.4%
unpow293.4%
+-commutative93.4%
Simplified99.6%
frac-2neg99.6%
div-inv99.4%
distribute-neg-frac99.4%
hypot-udef93.3%
unpow293.3%
unpow293.3%
+-commutative93.3%
unpow293.3%
unpow293.3%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 91.5%
mul-1-neg91.5%
associate-*r/92.2%
distribute-neg-frac92.2%
Simplified98.3%
expm1-log1p-u98.3%
expm1-udef20.4%
Applied egg-rr20.4%
expm1-def98.5%
expm1-log1p98.5%
associate-/r/98.6%
hypot-def92.4%
unpow292.4%
unpow292.4%
+-commutative92.4%
unpow292.4%
unpow292.4%
hypot-def98.6%
Simplified98.6%
Final simplification78.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-210) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-210) {
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) <= 1d-210) 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) <= 1e-210) {
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) <= 1e-210: 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) <= 1e-210) 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) <= 1e-210) 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], 1e-210], 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 10^{-210}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-210Initial program 91.8%
associate-/r/91.7%
+-commutative91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
+-commutative91.7%
Simplified99.6%
Taylor expanded in ky around 0 29.8%
Taylor expanded in ky around inf 28.8%
*-commutative28.8%
associate-*r/29.7%
Simplified29.7%
if 1e-210 < (sin.f64 ky) Initial program 93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 60.9%
Final simplification41.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-210) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-210) {
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) <= 1d-210) 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) <= 1e-210) {
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) <= 1e-210: 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) <= 1e-210) 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) <= 1e-210) 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], 1e-210], 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 10^{-210}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-210Initial program 91.8%
Taylor expanded in ky around 0 29.7%
if 1e-210 < (sin.f64 ky) Initial program 93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 60.9%
Final simplification41.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-210) (/ (sin th) (/ (sin kx) (sin ky))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-210) {
tmp = sin(th) / (sin(kx) / sin(ky));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-210) then
tmp = sin(th) / (sin(kx) / sin(ky))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-210) {
tmp = Math.sin(th) / (Math.sin(kx) / Math.sin(ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-210: tmp = math.sin(th) / (math.sin(kx) / math.sin(ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-210) tmp = Float64(sin(th) / Float64(sin(kx) / sin(ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-210) tmp = sin(th) / (sin(kx) / sin(ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-210], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-210}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-210Initial program 91.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.6%
hypot-udef91.8%
unpow291.8%
unpow291.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-def99.6%
Applied egg-rr99.6%
Taylor expanded in ky around 0 29.7%
if 1e-210 < (sin.f64 ky) Initial program 93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 60.9%
Final simplification41.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-210) (* (sin ky) (/ (sin th) kx)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-210) {
tmp = sin(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) <= 1d-210) then
tmp = sin(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) <= 1e-210) {
tmp = Math.sin(ky) * (Math.sin(th) / kx);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-210: tmp = math.sin(ky) * (math.sin(th) / kx) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-210) tmp = Float64(sin(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) <= 1e-210) tmp = sin(ky) * (sin(th) / kx); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-210], N[(N[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / kx), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-210}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-210Initial program 91.8%
associate-/r/91.7%
+-commutative91.7%
unpow291.7%
sqr-neg91.7%
sin-neg91.7%
sin-neg91.7%
unpow291.7%
+-commutative91.7%
Simplified99.6%
Taylor expanded in ky around 0 29.8%
Taylor expanded in ky around inf 28.8%
*-commutative28.8%
associate-*r/29.7%
Simplified29.7%
Taylor expanded in kx around 0 21.6%
if 1e-210 < (sin.f64 ky) Initial program 93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 60.9%
Final simplification36.6%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-210) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-210) {
tmp = sin(th) * (ky / sin(kx));
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-210) then
tmp = sin(th) * (ky / sin(kx))
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-210) {
tmp = Math.sin(th) * (ky / Math.sin(kx));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-210: tmp = math.sin(th) * (ky / math.sin(kx)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-210) tmp = Float64(sin(th) * Float64(ky / sin(kx))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-210) tmp = sin(th) * (ky / sin(kx)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-210], N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Sin[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-210}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-210Initial program 91.8%
Taylor expanded in ky around 0 27.4%
if 1e-210 < (sin.f64 ky) Initial program 93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 60.9%
Final simplification40.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-210) (/ (sin th) (/ (sin kx) ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-210) {
tmp = sin(th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 1d-210) then
tmp = sin(th) / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 1e-210) {
tmp = Math.sin(th) / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-210: tmp = math.sin(th) / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-210) tmp = Float64(sin(th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-210) tmp = sin(th) / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-210], N[(N[Sin[th], $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-210}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1e-210Initial program 91.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 26.4%
associate-/l*27.4%
Simplified27.4%
if 1e-210 < (sin.f64 ky) Initial program 93.8%
+-commutative93.8%
unpow293.8%
unpow293.8%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 60.9%
Final simplification40.2%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 5e-214) (/ th (/ (sin kx) ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 5e-214) {
tmp = th / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (sin(ky) <= 5d-214) then
tmp = th / (sin(kx) / ky)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= 5e-214) {
tmp = th / (Math.sin(kx) / ky);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 5e-214: tmp = th / (math.sin(kx) / ky) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 5e-214) tmp = Float64(th / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 5e-214) tmp = th / (sin(kx) / ky); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 5e-214], N[(th / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-214}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 4.9999999999999998e-214Initial program 92.3%
associate-/r/92.3%
+-commutative92.3%
unpow292.3%
sqr-neg92.3%
sin-neg92.3%
sin-neg92.3%
unpow292.3%
+-commutative92.3%
Simplified99.6%
frac-2neg99.6%
div-inv99.4%
distribute-neg-frac99.4%
hypot-udef92.1%
unpow292.1%
unpow292.1%
+-commutative92.1%
unpow292.1%
unpow292.1%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 51.9%
mul-1-neg51.9%
associate-*r/52.0%
distribute-neg-frac52.0%
Simplified55.5%
Taylor expanded in ky around 0 18.5%
*-commutative18.5%
associate-/l*19.5%
Simplified19.5%
if 4.9999999999999998e-214 < (sin.f64 ky) Initial program 92.9%
+-commutative92.9%
unpow292.9%
unpow292.9%
hypot-def99.8%
Simplified99.8%
Taylor expanded in kx around 0 60.7%
Final simplification35.6%
(FPCore (kx ky th) :precision binary64 (if (<= ky -6.6e+15) (sin th) (if (<= ky 1.9e-212) (/ ky (/ (sin kx) th)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (ky <= -6.6e+15) {
tmp = sin(th);
} else if (ky <= 1.9e-212) {
tmp = ky / (sin(kx) / th);
} else {
tmp = sin(th);
}
return tmp;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (ky <= (-6.6d+15)) then
tmp = sin(th)
else if (ky <= 1.9d-212) then
tmp = ky / (sin(kx) / th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (ky <= -6.6e+15) {
tmp = Math.sin(th);
} else if (ky <= 1.9e-212) {
tmp = ky / (Math.sin(kx) / th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ky <= -6.6e+15: tmp = math.sin(th) elif ky <= 1.9e-212: tmp = ky / (math.sin(kx) / th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (ky <= -6.6e+15) tmp = sin(th); elseif (ky <= 1.9e-212) tmp = Float64(ky / Float64(sin(kx) / th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (ky <= -6.6e+15) tmp = sin(th); elseif (ky <= 1.9e-212) tmp = ky / (sin(kx) / th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[ky, -6.6e+15], N[Sin[th], $MachinePrecision], If[LessEqual[ky, 1.9e-212], N[(ky / N[(N[Sin[kx], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -6.6 \cdot 10^{+15}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.9 \cdot 10^{-212}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if ky < -6.6e15 or 1.90000000000000011e-212 < ky Initial program 95.6%
+-commutative95.6%
unpow295.6%
unpow295.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 37.5%
if -6.6e15 < ky < 1.90000000000000011e-212Initial program 86.7%
associate-/r/86.7%
+-commutative86.7%
unpow286.7%
sqr-neg86.7%
sin-neg86.7%
sin-neg86.7%
unpow286.7%
+-commutative86.7%
Simplified99.7%
Taylor expanded in ky around 0 46.7%
Taylor expanded in th around 0 30.6%
associate-/l*32.3%
Simplified32.3%
Taylor expanded in ky around 0 30.6%
associate-/l*32.3%
Simplified32.3%
Final simplification35.7%
(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 92.5%
+-commutative92.5%
unpow292.5%
unpow292.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 26.3%
Final simplification26.3%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 92.5%
associate-/r/92.4%
+-commutative92.4%
unpow292.4%
sqr-neg92.4%
sin-neg92.4%
sin-neg92.4%
unpow292.4%
+-commutative92.4%
Simplified99.6%
frac-2neg99.6%
div-inv99.4%
distribute-neg-frac99.4%
hypot-udef92.3%
unpow292.3%
unpow292.3%
+-commutative92.3%
unpow292.3%
unpow292.3%
hypot-def99.4%
Applied egg-rr99.4%
Taylor expanded in th around 0 50.4%
mul-1-neg50.4%
associate-*r/50.8%
distribute-neg-frac50.8%
Simplified54.1%
Taylor expanded in kx around 0 14.7%
Final simplification14.7%
herbie shell --seed 2023279
(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)))