
(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 14 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 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-def99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(/
(sin ky)
(* (hypot (sin kx) (sin ky)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= (sin ky) 0.04)
(/
(sin th)
(* (hypot (sin ky) (sin kx)) (+ (* ky 0.16666666666666666) (/ 1.0 ky))))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (sin(ky) <= 0.04) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) * ((ky * 0.16666666666666666) + (1.0 / ky)));
} 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(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (Math.sin(ky) <= 0.04) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) * ((ky * 0.16666666666666666) + (1.0 / ky)));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))) elif math.sin(ky) <= 0.04: tmp = math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) * ((ky * 0.16666666666666666) + (1.0 / ky))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (sin(ky) <= 0.04) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) * Float64(Float64(ky * 0.16666666666666666) + Float64(1.0 / ky)))); 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(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))); elseif (sin(ky) <= 0.04) tmp = sin(th) / (hypot(sin(ky), sin(kx)) * ((ky * 0.16666666666666666) + (1.0 / ky))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.04], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(ky * 0.16666666666666666), $MachinePrecision] + N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;\sin ky \leq 0.04:\\
\;\;\;\;\frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right) \cdot \left(ky \cdot 0.16666666666666666 + \frac{1}{ky}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
associate-*l/99.6%
*-commutative99.6%
expm1-log1p-u99.6%
associate-*l/99.6%
expm1-udef55.0%
associate-*l/55.1%
*-commutative55.1%
Applied egg-rr55.1%
expm1-def99.6%
expm1-log1p99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in th around 0 49.2%
+-commutative49.2%
+-commutative49.2%
unpow249.2%
unpow249.2%
hypot-def49.2%
associate-*r*49.2%
+-commutative49.2%
unpow249.2%
unpow249.2%
hypot-def49.2%
distribute-rgt-out49.2%
Simplified49.2%
if -0.0100000000000000002 < (sin.f64 ky) < 0.0400000000000000008Initial program 87.8%
+-commutative87.8%
unpow287.8%
unpow287.8%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 98.4%
if 0.0400000000000000008 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 57.8%
Final simplification74.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -5e-14)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(if (<= (sin ky) 0.04)
(/ (sin th) (* (hypot (sin ky) (sin kx)) (/ 1.0 ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -5e-14) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else if (sin(ky) <= 0.04) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) * (1.0 / ky));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.sin(ky) <= -5e-14) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else if (Math.sin(ky) <= 0.04) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) * (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -5e-14: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) elif math.sin(ky) <= 0.04: tmp = math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) * (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -5e-14) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); elseif (sin(ky) <= 0.04) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) * Float64(1.0 / ky))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= -5e-14) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); elseif (sin(ky) <= 0.04) tmp = sin(th) / (hypot(sin(ky), sin(kx)) * (1.0 / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -5e-14], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.04], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] * N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -5 \cdot 10^{-14}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin ky \leq 0.04:\\
\;\;\;\;\frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right) \cdot \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -5.0000000000000002e-14Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
associate-*l/99.6%
*-commutative99.6%
expm1-log1p-u99.6%
associate-*l/99.6%
expm1-udef54.4%
associate-*l/54.4%
*-commutative54.4%
Applied egg-rr54.4%
expm1-def99.6%
expm1-log1p99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in th around 0 49.3%
associate-*l/49.3%
+-commutative49.3%
unpow249.3%
unpow249.3%
hypot-def49.3%
*-lft-identity49.3%
hypot-def49.3%
unpow249.3%
unpow249.3%
+-commutative49.3%
unpow249.3%
unpow249.3%
hypot-def49.3%
Simplified49.3%
if -5.0000000000000002e-14 < (sin.f64 ky) < 0.0400000000000000008Initial program 87.7%
+-commutative87.7%
unpow287.7%
unpow287.7%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 98.2%
if 0.0400000000000000008 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 57.8%
Final simplification74.5%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin ky) -0.01)
(/
(sin ky)
(* (hypot (sin kx) (sin ky)) (+ (/ 1.0 th) (* th 0.16666666666666666))))
(if (<= (sin ky) 0.04)
(/ (sin th) (* (hypot (sin ky) (sin kx)) (/ 1.0 ky)))
(sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= -0.01) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (sin(ky) <= 0.04) {
tmp = sin(th) / (hypot(sin(ky), sin(kx)) * (1.0 / ky));
} 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(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666)));
} else if (Math.sin(ky) <= 0.04) {
tmp = Math.sin(th) / (Math.hypot(Math.sin(ky), Math.sin(kx)) * (1.0 / ky));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= -0.01: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))) elif math.sin(ky) <= 0.04: tmp = math.sin(th) / (math.hypot(math.sin(ky), math.sin(kx)) * (1.0 / ky)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= -0.01) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) * Float64(Float64(1.0 / th) + Float64(th * 0.16666666666666666)))); elseif (sin(ky) <= 0.04) tmp = Float64(sin(th) / Float64(hypot(sin(ky), sin(kx)) * Float64(1.0 / ky))); 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(ky) / (hypot(sin(kx), sin(ky)) * ((1.0 / th) + (th * 0.16666666666666666))); elseif (sin(ky) <= 0.04) tmp = sin(th) / (hypot(sin(ky), sin(kx)) * (1.0 / ky)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], -0.01], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[(1.0 / th), $MachinePrecision] + N[(th * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Sin[ky], $MachinePrecision], 0.04], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] * N[(1.0 / ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right) \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;\sin ky \leq 0.04:\\
\;\;\;\;\frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right) \cdot \frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.0100000000000000002Initial program 99.7%
+-commutative99.7%
unpow299.7%
unpow299.7%
hypot-def99.7%
Simplified99.7%
associate-*l/99.6%
*-commutative99.6%
expm1-log1p-u99.6%
associate-*l/99.6%
expm1-udef55.0%
associate-*l/55.1%
*-commutative55.1%
Applied egg-rr55.1%
expm1-def99.6%
expm1-log1p99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in th around 0 49.2%
+-commutative49.2%
+-commutative49.2%
unpow249.2%
unpow249.2%
hypot-def49.2%
associate-*r*49.2%
+-commutative49.2%
unpow249.2%
unpow249.2%
hypot-def49.2%
distribute-rgt-out49.2%
Simplified49.2%
if -0.0100000000000000002 < (sin.f64 ky) < 0.0400000000000000008Initial program 87.8%
+-commutative87.8%
unpow287.8%
unpow287.8%
hypot-def99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
div-inv99.5%
Applied egg-rr99.5%
Taylor expanded in ky around 0 98.2%
if 0.0400000000000000008 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 57.8%
Final simplification74.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin th) (sin kx))))
(if (<= (sin th) -0.001)
(* (sin ky) t_1)
(if (<= (sin th) 1e-8)
(/ (sin ky) (/ (hypot (sin kx) (sin ky)) th))
(* (sin ky) (fabs t_1))))))
double code(double kx, double ky, double th) {
double t_1 = sin(th) / sin(kx);
double tmp;
if (sin(th) <= -0.001) {
tmp = sin(ky) * t_1;
} else if (sin(th) <= 1e-8) {
tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th);
} else {
tmp = sin(ky) * fabs(t_1);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sin(kx);
double tmp;
if (Math.sin(th) <= -0.001) {
tmp = Math.sin(ky) * t_1;
} else if (Math.sin(th) <= 1e-8) {
tmp = Math.sin(ky) / (Math.hypot(Math.sin(kx), Math.sin(ky)) / th);
} else {
tmp = Math.sin(ky) * Math.abs(t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sin(kx) tmp = 0 if math.sin(th) <= -0.001: tmp = math.sin(ky) * t_1 elif math.sin(th) <= 1e-8: tmp = math.sin(ky) / (math.hypot(math.sin(kx), math.sin(ky)) / th) else: tmp = math.sin(ky) * math.fabs(t_1) return tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sin(kx)) tmp = 0.0 if (sin(th) <= -0.001) tmp = Float64(sin(ky) * t_1); elseif (sin(th) <= 1e-8) tmp = Float64(sin(ky) / Float64(hypot(sin(kx), sin(ky)) / th)); else tmp = Float64(sin(ky) * abs(t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sin(kx); tmp = 0.0; if (sin(th) <= -0.001) tmp = sin(ky) * t_1; elseif (sin(th) <= 1e-8) tmp = sin(ky) / (hypot(sin(kx), sin(ky)) / th); else tmp = sin(ky) * abs(t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sin[th], $MachinePrecision], -0.001], N[(N[Sin[ky], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[N[Sin[th], $MachinePrecision], 1e-8], N[(N[Sin[ky], $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / th), $MachinePrecision]), $MachinePrecision], N[(N[Sin[ky], $MachinePrecision] * N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin th \leq -0.001:\\
\;\;\;\;\sin ky \cdot t_1\\
\mathbf{elif}\;\sin th \leq 10^{-8}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \left|t_1\right|\\
\end{array}
\end{array}
if (sin.f64 th) < -1e-3Initial program 94.4%
associate-*l/94.3%
*-commutative94.3%
associate-*l/94.4%
+-commutative94.4%
unpow294.4%
unpow294.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 18.2%
if -1e-3 < (sin.f64 th) < 1e-8Initial program 91.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-def99.7%
Simplified99.7%
associate-*l/89.2%
*-commutative89.2%
expm1-log1p-u89.2%
associate-*l/99.6%
expm1-udef18.4%
associate-*l/18.4%
*-commutative18.4%
Applied egg-rr18.4%
expm1-def89.2%
expm1-log1p89.2%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in th around 0 91.6%
associate-*l/91.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-def99.7%
*-lft-identity99.7%
hypot-def91.8%
unpow291.8%
unpow291.8%
+-commutative91.8%
unpow291.8%
unpow291.8%
hypot-def99.7%
Simplified99.7%
if 1e-8 < (sin.f64 th) Initial program 97.1%
associate-*l/97.0%
*-commutative97.0%
associate-*l/97.0%
+-commutative97.0%
unpow297.0%
unpow297.0%
hypot-def99.5%
Simplified99.5%
Taylor expanded in ky around 0 21.7%
add-sqr-sqrt20.8%
sqrt-unprod33.5%
pow233.5%
Applied egg-rr33.5%
unpow233.5%
rem-sqrt-square35.1%
Simplified35.1%
Final simplification62.2%
(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 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-def99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-114) (* (sin th) (/ (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-114) {
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-114) 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-114) {
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-114: 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-114) 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-114) 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-114], 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^{-114}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.0000000000000001e-114Initial program 91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 30.3%
if 1.0000000000000001e-114 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 56.8%
Final simplification38.3%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-114) (* (sin ky) (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-114) {
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-114) 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-114) {
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-114: 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-114) 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-114) 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-114], 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^{-114}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.0000000000000001e-114Initial program 91.5%
associate-*l/88.7%
*-commutative88.7%
associate-*l/91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 30.3%
if 1.0000000000000001e-114 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 56.8%
Final simplification38.4%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-114) (* (sin th) (/ ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-114) {
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-114) 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-114) {
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-114: 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-114) 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-114) 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-114], 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^{-114}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.0000000000000001e-114Initial program 91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 25.7%
associate-/l*28.4%
associate-/r/28.4%
Simplified28.4%
if 1.0000000000000001e-114 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 56.8%
Final simplification37.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-114) (* ky (/ (sin th) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-114) {
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) <= 1d-114) 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) <= 1e-114) {
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) <= 1e-114: 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) <= 1e-114) 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) <= 1e-114) 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], 1e-114], 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 10^{-114}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.0000000000000001e-114Initial program 91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 25.7%
associate-/l*28.4%
associate-/r/28.4%
Simplified28.4%
associate-*l/25.7%
clear-num25.5%
Applied egg-rr25.5%
associate-/r/25.7%
*-commutative25.7%
associate-*r*28.4%
associate-/r/28.4%
clear-num28.4%
Applied egg-rr28.4%
if 1.0000000000000001e-114 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 56.8%
Final simplification37.0%
(FPCore (kx ky th) :precision binary64 (if (<= (sin ky) 1e-114) (/ ky (/ kx (sin th))) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if (sin(ky) <= 1e-114) {
tmp = ky / (kx / 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 (sin(ky) <= 1d-114) then
tmp = ky / (kx / 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 (Math.sin(ky) <= 1e-114) {
tmp = ky / (kx / Math.sin(th));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.sin(ky) <= 1e-114: tmp = ky / (kx / math.sin(th)) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (sin(ky) <= 1e-114) tmp = Float64(ky / Float64(kx / sin(th))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (sin(ky) <= 1e-114) tmp = ky / (kx / sin(th)); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[ky], $MachinePrecision], 1e-114], N[(ky / N[(kx / N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-114}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (sin.f64 ky) < 1.0000000000000001e-114Initial program 91.5%
+-commutative91.5%
unpow291.5%
unpow291.5%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 25.7%
associate-/l*28.4%
associate-/r/28.4%
Simplified28.4%
Taylor expanded in kx around 0 15.8%
associate-/l*18.5%
Simplified18.5%
if 1.0000000000000001e-114 < (sin.f64 ky) Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.6%
Simplified99.6%
Taylor expanded in kx around 0 56.8%
Final simplification30.2%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -1800000.0) (not (<= ky 1.05e-114))) (sin th) (* (sin th) (/ ky kx))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1800000.0) || !(ky <= 1.05e-114)) {
tmp = sin(th);
} else {
tmp = sin(th) * (ky / 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 ((ky <= (-1800000.0d0)) .or. (.not. (ky <= 1.05d-114))) then
tmp = sin(th)
else
tmp = sin(th) * (ky / kx)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1800000.0) || !(ky <= 1.05e-114)) {
tmp = Math.sin(th);
} else {
tmp = Math.sin(th) * (ky / kx);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -1800000.0) or not (ky <= 1.05e-114): tmp = math.sin(th) else: tmp = math.sin(th) * (ky / kx) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -1800000.0) || !(ky <= 1.05e-114)) tmp = sin(th); else tmp = Float64(sin(th) * Float64(ky / kx)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -1800000.0) || ~((ky <= 1.05e-114))) tmp = sin(th); else tmp = sin(th) * (ky / kx); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -1800000.0], N[Not[LessEqual[ky, 1.05e-114]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(ky / kx), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1800000 \lor \neg \left(ky \leq 1.05 \cdot 10^{-114}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\end{array}
\end{array}
if ky < -1.8e6 or 1.04999999999999996e-114 < ky Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 30.0%
if -1.8e6 < ky < 1.04999999999999996e-114Initial program 85.4%
+-commutative85.4%
unpow285.4%
unpow285.4%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 42.7%
associate-/l*47.3%
associate-/r/47.3%
Simplified47.3%
Taylor expanded in kx around 0 29.7%
Final simplification29.9%
(FPCore (kx ky th) :precision binary64 (if (or (<= ky -1800000.0) (not (<= ky 1e-147))) (sin th) (/ ky (/ kx th))))
double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1800000.0) || !(ky <= 1e-147)) {
tmp = sin(th);
} else {
tmp = ky / (kx / 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 <= (-1800000.0d0)) .or. (.not. (ky <= 1d-147))) then
tmp = sin(th)
else
tmp = ky / (kx / th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((ky <= -1800000.0) || !(ky <= 1e-147)) {
tmp = Math.sin(th);
} else {
tmp = ky / (kx / th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (ky <= -1800000.0) or not (ky <= 1e-147): tmp = math.sin(th) else: tmp = ky / (kx / th) return tmp
function code(kx, ky, th) tmp = 0.0 if ((ky <= -1800000.0) || !(ky <= 1e-147)) tmp = sin(th); else tmp = Float64(ky / Float64(kx / th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((ky <= -1800000.0) || ~((ky <= 1e-147))) tmp = sin(th); else tmp = ky / (kx / th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[Or[LessEqual[ky, -1800000.0], N[Not[LessEqual[ky, 1e-147]], $MachinePrecision]], N[Sin[th], $MachinePrecision], N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq -1800000 \lor \neg \left(ky \leq 10^{-147}\right):\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\frac{kx}{th}}\\
\end{array}
\end{array}
if ky < -1.8e6 or 9.9999999999999997e-148 < ky Initial program 99.6%
+-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def99.7%
Simplified99.7%
Taylor expanded in kx around 0 29.8%
if -1.8e6 < ky < 9.9999999999999997e-148Initial program 84.7%
+-commutative84.7%
unpow284.7%
unpow284.7%
hypot-def99.6%
Simplified99.6%
Taylor expanded in ky around 0 42.7%
associate-/l*47.7%
associate-/r/47.6%
Simplified47.6%
Taylor expanded in kx around 0 29.1%
Taylor expanded in th around 0 20.0%
associate-/l*24.8%
Simplified24.8%
Final simplification27.9%
(FPCore (kx ky th) :precision binary64 (/ ky (/ kx th)))
double code(double kx, double ky, double th) {
return ky / (kx / th);
}
real(8) function code(kx, ky, th)
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = ky / (kx / th)
end function
public static double code(double kx, double ky, double th) {
return ky / (kx / th);
}
def code(kx, ky, th): return ky / (kx / th)
function code(kx, ky, th) return Float64(ky / Float64(kx / th)) end
function tmp = code(kx, ky, th) tmp = ky / (kx / th); end
code[kx_, ky_, th_] := N[(ky / N[(kx / th), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{ky}{\frac{kx}{th}}
\end{array}
Initial program 93.9%
+-commutative93.9%
unpow293.9%
unpow293.9%
hypot-def99.7%
Simplified99.7%
Taylor expanded in ky around 0 20.3%
associate-/l*22.1%
associate-/r/22.1%
Simplified22.1%
Taylor expanded in kx around 0 14.0%
Taylor expanded in th around 0 10.2%
associate-/l*12.1%
Simplified12.1%
Final simplification12.1%
herbie shell --seed 2023309
(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)))