
(FPCore (l Om kx ky)
:precision binary64
(sqrt
(*
(/ 1.0 2.0)
(+
1.0
(/
1.0
(sqrt
(+
1.0
(*
(pow (/ (* 2.0 l) Om) 2.0)
(+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))
double code(double l, double Om, double kx, double ky) {
return sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))))));
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
code = sqrt(((1.0d0 / 2.0d0) * (1.0d0 + (1.0d0 / sqrt((1.0d0 + ((((2.0d0 * l) / om) ** 2.0d0) * ((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))))))))
end function
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / Math.sqrt((1.0 + (Math.pow(((2.0 * l) / Om), 2.0) * (Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))))))));
}
def code(l, Om, kx, ky): return math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / math.sqrt((1.0 + (math.pow(((2.0 * l) / Om), 2.0) * (math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))))))))
function code(l, Om, kx, ky) return sqrt(Float64(Float64(1.0 / 2.0) * Float64(1.0 + Float64(1.0 / sqrt(Float64(1.0 + Float64((Float64(Float64(2.0 * l) / Om) ^ 2.0) * Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))))))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + ((((2.0 * l) / Om) ^ 2.0) * ((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))))))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(N[(1.0 / 2.0), $MachinePrecision] * N[(1.0 + N[(1.0 / N[Sqrt[N[(1.0 + N[(N[Power[N[(N[(2.0 * l), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (l Om kx ky)
:precision binary64
(sqrt
(*
(/ 1.0 2.0)
(+
1.0
(/
1.0
(sqrt
(+
1.0
(*
(pow (/ (* 2.0 l) Om) 2.0)
(+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))
double code(double l, double Om, double kx, double ky) {
return sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))))));
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
code = sqrt(((1.0d0 / 2.0d0) * (1.0d0 + (1.0d0 / sqrt((1.0d0 + ((((2.0d0 * l) / om) ** 2.0d0) * ((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))))))))
end function
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / Math.sqrt((1.0 + (Math.pow(((2.0 * l) / Om), 2.0) * (Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))))))));
}
def code(l, Om, kx, ky): return math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / math.sqrt((1.0 + (math.pow(((2.0 * l) / Om), 2.0) * (math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))))))))
function code(l, Om, kx, ky) return sqrt(Float64(Float64(1.0 / 2.0) * Float64(1.0 + Float64(1.0 / sqrt(Float64(1.0 + Float64((Float64(Float64(2.0 * l) / Om) ^ 2.0) * Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))))))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + ((((2.0 * l) / Om) ^ 2.0) * ((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))))))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(N[(1.0 / 2.0), $MachinePrecision] * N[(1.0 + N[(1.0 / N[Sqrt[N[(1.0 + N[(N[Power[N[(N[(2.0 * l), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}
\end{array}
(FPCore (l Om kx ky)
:precision binary64
(sqrt
(+
0.5
(*
0.5
(/ 1.0 (hypot 1.0 (* (* l (/ 2.0 Om)) (hypot (sin kx) (sin ky)))))))))
double code(double l, double Om, double kx, double ky) {
return sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((l * (2.0 / Om)) * hypot(sin(kx), sin(ky))))))));
}
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt((0.5 + (0.5 * (1.0 / Math.hypot(1.0, ((l * (2.0 / Om)) * Math.hypot(Math.sin(kx), Math.sin(ky))))))));
}
def code(l, Om, kx, ky): return math.sqrt((0.5 + (0.5 * (1.0 / math.hypot(1.0, ((l * (2.0 / Om)) * math.hypot(math.sin(kx), math.sin(ky))))))))
function code(l, Om, kx, ky) return sqrt(Float64(0.5 + Float64(0.5 * Float64(1.0 / hypot(1.0, Float64(Float64(l * Float64(2.0 / Om)) * hypot(sin(kx), sin(ky)))))))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((l * (2.0 / Om)) * hypot(sin(kx), sin(ky)))))))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(l * N[(2.0 / Om), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}
\end{array}
Initial program 98.5%
Simplified98.5%
add-sqr-sqrt98.5%
hypot-1-def98.5%
sqrt-prod98.5%
unpow298.5%
sqrt-prod54.5%
add-sqr-sqrt98.8%
associate-/r/98.8%
*-commutative98.8%
unpow298.8%
unpow298.8%
hypot-def100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (l Om kx ky) :precision binary64 (sqrt (+ 0.5 (/ 0.5 (hypot 1.0 (* l (* (/ 2.0 Om) (sin ky))))))))
double code(double l, double Om, double kx, double ky) {
return sqrt((0.5 + (0.5 / hypot(1.0, (l * ((2.0 / Om) * sin(ky)))))));
}
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt((0.5 + (0.5 / Math.hypot(1.0, (l * ((2.0 / Om) * Math.sin(ky)))))));
}
def code(l, Om, kx, ky): return math.sqrt((0.5 + (0.5 / math.hypot(1.0, (l * ((2.0 / Om) * math.sin(ky)))))))
function code(l, Om, kx, ky) return sqrt(Float64(0.5 + Float64(0.5 / hypot(1.0, Float64(l * Float64(Float64(2.0 / Om) * sin(ky))))))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt((0.5 + (0.5 / hypot(1.0, (l * ((2.0 / Om) * sin(ky))))))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 / N[Sqrt[1.0 ^ 2 + N[(l * N[(N[(2.0 / Om), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \ell \cdot \left(\frac{2}{Om} \cdot \sin ky\right)\right)}}
\end{array}
Initial program 98.5%
Simplified98.5%
add-sqr-sqrt98.5%
hypot-1-def98.5%
sqrt-prod98.5%
unpow298.5%
sqrt-prod54.5%
add-sqr-sqrt98.8%
associate-/r/98.8%
*-commutative98.8%
unpow298.8%
unpow298.8%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in kx around 0 94.0%
*-un-lft-identity94.0%
un-div-inv94.0%
Applied egg-rr94.0%
*-lft-identity94.0%
associate-*l*94.0%
Simplified94.0%
Final simplification94.0%
(FPCore (l Om kx ky) :precision binary64 (if (<= l 9e-178) 1.0 (sqrt (+ 0.5 (* 0.5 (/ 1.0 (hypot 1.0 (* (* l (/ 2.0 Om)) ky))))))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (l <= 9e-178) {
tmp = 1.0;
} else {
tmp = sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((l * (2.0 / Om)) * ky))))));
}
return tmp;
}
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if (l <= 9e-178) {
tmp = 1.0;
} else {
tmp = Math.sqrt((0.5 + (0.5 * (1.0 / Math.hypot(1.0, ((l * (2.0 / Om)) * ky))))));
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if l <= 9e-178: tmp = 1.0 else: tmp = math.sqrt((0.5 + (0.5 * (1.0 / math.hypot(1.0, ((l * (2.0 / Om)) * ky)))))) return tmp
function code(l, Om, kx, ky) tmp = 0.0 if (l <= 9e-178) tmp = 1.0; else tmp = sqrt(Float64(0.5 + Float64(0.5 * Float64(1.0 / hypot(1.0, Float64(Float64(l * Float64(2.0 / Om)) * ky)))))); end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if (l <= 9e-178) tmp = 1.0; else tmp = sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((l * (2.0 / Om)) * ky)))))); end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[l, 9e-178], 1.0, N[Sqrt[N[(0.5 + N[(0.5 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(l * N[(2.0 / Om), $MachinePrecision]), $MachinePrecision] * ky), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 9 \cdot 10^{-178}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(\ell \cdot \frac{2}{Om}\right) \cdot ky\right)}}\\
\end{array}
\end{array}
if l < 8.99999999999999957e-178Initial program 97.8%
Simplified97.8%
add-sqr-sqrt97.8%
hypot-1-def97.8%
sqrt-prod97.8%
unpow297.8%
sqrt-prod59.8%
add-sqr-sqrt98.2%
associate-/r/98.2%
*-commutative98.2%
unpow298.2%
unpow298.2%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in l around 0 71.4%
if 8.99999999999999957e-178 < l Initial program 99.3%
Simplified99.3%
add-sqr-sqrt99.3%
hypot-1-def99.3%
sqrt-prod99.3%
unpow299.3%
sqrt-prod47.8%
add-sqr-sqrt99.6%
associate-/r/99.6%
*-commutative99.6%
unpow299.6%
unpow299.6%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in kx around 0 93.7%
Taylor expanded in ky around 0 85.7%
Final simplification77.8%
(FPCore (l Om kx ky)
:precision binary64
(if (<= Om 9.5e-170)
(sqrt 0.5)
(if (<= Om 6e+72)
(sqrt
(+
0.5
(* 0.5 (/ 1.0 (+ 1.0 (* 2.0 (/ (* ky ky) (/ (* Om Om) (* l l)))))))))
1.0)))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (Om <= 9.5e-170) {
tmp = sqrt(0.5);
} else if (Om <= 6e+72) {
tmp = sqrt((0.5 + (0.5 * (1.0 / (1.0 + (2.0 * ((ky * ky) / ((Om * Om) / (l * l)))))))));
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8) :: tmp
if (om <= 9.5d-170) then
tmp = sqrt(0.5d0)
else if (om <= 6d+72) then
tmp = sqrt((0.5d0 + (0.5d0 * (1.0d0 / (1.0d0 + (2.0d0 * ((ky * ky) / ((om * om) / (l * l)))))))))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if (Om <= 9.5e-170) {
tmp = Math.sqrt(0.5);
} else if (Om <= 6e+72) {
tmp = Math.sqrt((0.5 + (0.5 * (1.0 / (1.0 + (2.0 * ((ky * ky) / ((Om * Om) / (l * l)))))))));
} else {
tmp = 1.0;
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if Om <= 9.5e-170: tmp = math.sqrt(0.5) elif Om <= 6e+72: tmp = math.sqrt((0.5 + (0.5 * (1.0 / (1.0 + (2.0 * ((ky * ky) / ((Om * Om) / (l * l))))))))) else: tmp = 1.0 return tmp
function code(l, Om, kx, ky) tmp = 0.0 if (Om <= 9.5e-170) tmp = sqrt(0.5); elseif (Om <= 6e+72) tmp = sqrt(Float64(0.5 + Float64(0.5 * Float64(1.0 / Float64(1.0 + Float64(2.0 * Float64(Float64(ky * ky) / Float64(Float64(Om * Om) / Float64(l * l))))))))); else tmp = 1.0; end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if (Om <= 9.5e-170) tmp = sqrt(0.5); elseif (Om <= 6e+72) tmp = sqrt((0.5 + (0.5 * (1.0 / (1.0 + (2.0 * ((ky * ky) / ((Om * Om) / (l * l))))))))); else tmp = 1.0; end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[Om, 9.5e-170], N[Sqrt[0.5], $MachinePrecision], If[LessEqual[Om, 6e+72], N[Sqrt[N[(0.5 + N[(0.5 * N[(1.0 / N[(1.0 + N[(2.0 * N[(N[(ky * ky), $MachinePrecision] / N[(N[(Om * Om), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;Om \leq 9.5 \cdot 10^{-170}:\\
\;\;\;\;\sqrt{0.5}\\
\mathbf{elif}\;Om \leq 6 \cdot 10^{+72}:\\
\;\;\;\;\sqrt{0.5 + 0.5 \cdot \frac{1}{1 + 2 \cdot \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}}}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if Om < 9.5000000000000001e-170Initial program 99.3%
Simplified99.3%
Taylor expanded in Om around 0 51.1%
unpow251.1%
unpow251.1%
hypot-def51.8%
Simplified51.8%
Taylor expanded in l around inf 60.0%
if 9.5000000000000001e-170 < Om < 6.00000000000000006e72Initial program 95.6%
Simplified95.6%
Taylor expanded in kx around 0 83.3%
*-commutative83.3%
associate-/l*80.8%
associate-*l/80.8%
unpow280.8%
unpow280.8%
Simplified80.8%
Taylor expanded in ky around 0 71.9%
associate-/l*71.4%
unpow271.4%
unpow271.4%
unpow271.4%
Simplified71.4%
if 6.00000000000000006e72 < Om Initial program 98.2%
Simplified98.2%
add-sqr-sqrt98.2%
hypot-1-def98.2%
sqrt-prod98.2%
unpow298.2%
sqrt-prod67.9%
add-sqr-sqrt98.6%
associate-/r/98.6%
*-commutative98.6%
unpow298.6%
unpow298.6%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in l around 0 91.9%
Final simplification68.8%
(FPCore (l Om kx ky) :precision binary64 (if (or (<= l 5.8e+83) (and (not (<= l 6.6e+142)) (<= l 1.22e+165))) (+ 1.0 (* (* (/ l (/ Om l)) (/ kx (/ Om kx))) -0.5)) (sqrt 0.5)))
double code(double l, double Om, double kx, double ky) {
double tmp;
if ((l <= 5.8e+83) || (!(l <= 6.6e+142) && (l <= 1.22e+165))) {
tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
} else {
tmp = sqrt(0.5);
}
return tmp;
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8) :: tmp
if ((l <= 5.8d+83) .or. (.not. (l <= 6.6d+142)) .and. (l <= 1.22d+165)) then
tmp = 1.0d0 + (((l / (om / l)) * (kx / (om / kx))) * (-0.5d0))
else
tmp = sqrt(0.5d0)
end if
code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if ((l <= 5.8e+83) || (!(l <= 6.6e+142) && (l <= 1.22e+165))) {
tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
} else {
tmp = Math.sqrt(0.5);
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if (l <= 5.8e+83) or (not (l <= 6.6e+142) and (l <= 1.22e+165)): tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5) else: tmp = math.sqrt(0.5) return tmp
function code(l, Om, kx, ky) tmp = 0.0 if ((l <= 5.8e+83) || (!(l <= 6.6e+142) && (l <= 1.22e+165))) tmp = Float64(1.0 + Float64(Float64(Float64(l / Float64(Om / l)) * Float64(kx / Float64(Om / kx))) * -0.5)); else tmp = sqrt(0.5); end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if ((l <= 5.8e+83) || (~((l <= 6.6e+142)) && (l <= 1.22e+165))) tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5); else tmp = sqrt(0.5); end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[Or[LessEqual[l, 5.8e+83], And[N[Not[LessEqual[l, 6.6e+142]], $MachinePrecision], LessEqual[l, 1.22e+165]]], N[(1.0 + N[(N[(N[(l / N[(Om / l), $MachinePrecision]), $MachinePrecision] * N[(kx / N[(Om / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[Sqrt[0.5], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.8 \cdot 10^{+83} \lor \neg \left(\ell \leq 6.6 \cdot 10^{+142}\right) \land \ell \leq 1.22 \cdot 10^{+165}:\\
\;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\
\end{array}
\end{array}
if l < 5.79999999999999999e83 or 6.6000000000000004e142 < l < 1.2199999999999999e165Initial program 98.2%
Simplified98.2%
add-sqr-sqrt98.2%
hypot-1-def98.2%
sqrt-prod98.2%
unpow298.2%
sqrt-prod56.3%
add-sqr-sqrt98.6%
associate-/r/98.6%
*-commutative98.6%
unpow298.6%
unpow298.6%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in ky around 0 92.8%
associate-*r/92.8%
Simplified92.8%
Taylor expanded in kx around 0 44.7%
*-commutative44.7%
*-commutative44.7%
unpow244.7%
unpow244.7%
unpow244.7%
Simplified44.7%
Taylor expanded in l around 0 44.7%
unpow244.7%
*-commutative44.7%
unpow244.7%
times-frac48.2%
unpow248.2%
associate-/l*50.5%
associate-/l*53.7%
Simplified53.7%
if 5.79999999999999999e83 < l < 6.6000000000000004e142 or 1.2199999999999999e165 < l Initial program 100.0%
Simplified100.0%
Taylor expanded in Om around 0 86.5%
unpow286.5%
unpow286.5%
hypot-def86.5%
Simplified86.5%
Taylor expanded in l around inf 88.2%
Final simplification59.4%
(FPCore (l Om kx ky) :precision binary64 (if (<= l 6.5e+88) 1.0 (if (<= l 1.04e+142) (sqrt 0.5) (if (<= l 1.5e+165) 1.0 (sqrt 0.5)))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (l <= 6.5e+88) {
tmp = 1.0;
} else if (l <= 1.04e+142) {
tmp = sqrt(0.5);
} else if (l <= 1.5e+165) {
tmp = 1.0;
} else {
tmp = sqrt(0.5);
}
return tmp;
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8) :: tmp
if (l <= 6.5d+88) then
tmp = 1.0d0
else if (l <= 1.04d+142) then
tmp = sqrt(0.5d0)
else if (l <= 1.5d+165) then
tmp = 1.0d0
else
tmp = sqrt(0.5d0)
end if
code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if (l <= 6.5e+88) {
tmp = 1.0;
} else if (l <= 1.04e+142) {
tmp = Math.sqrt(0.5);
} else if (l <= 1.5e+165) {
tmp = 1.0;
} else {
tmp = Math.sqrt(0.5);
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if l <= 6.5e+88: tmp = 1.0 elif l <= 1.04e+142: tmp = math.sqrt(0.5) elif l <= 1.5e+165: tmp = 1.0 else: tmp = math.sqrt(0.5) return tmp
function code(l, Om, kx, ky) tmp = 0.0 if (l <= 6.5e+88) tmp = 1.0; elseif (l <= 1.04e+142) tmp = sqrt(0.5); elseif (l <= 1.5e+165) tmp = 1.0; else tmp = sqrt(0.5); end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if (l <= 6.5e+88) tmp = 1.0; elseif (l <= 1.04e+142) tmp = sqrt(0.5); elseif (l <= 1.5e+165) tmp = 1.0; else tmp = sqrt(0.5); end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[l, 6.5e+88], 1.0, If[LessEqual[l, 1.04e+142], N[Sqrt[0.5], $MachinePrecision], If[LessEqual[l, 1.5e+165], 1.0, N[Sqrt[0.5], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6.5 \cdot 10^{+88}:\\
\;\;\;\;1\\
\mathbf{elif}\;\ell \leq 1.04 \cdot 10^{+142}:\\
\;\;\;\;\sqrt{0.5}\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+165}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\
\end{array}
\end{array}
if l < 6.5000000000000002e88 or 1.04e142 < l < 1.49999999999999995e165Initial program 98.2%
Simplified98.2%
add-sqr-sqrt98.2%
hypot-1-def98.2%
sqrt-prod98.2%
unpow298.2%
sqrt-prod56.5%
add-sqr-sqrt98.6%
associate-/r/98.6%
*-commutative98.6%
unpow298.6%
unpow298.6%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in l around 0 72.2%
if 6.5000000000000002e88 < l < 1.04e142 or 1.49999999999999995e165 < l Initial program 100.0%
Simplified100.0%
Taylor expanded in Om around 0 88.5%
unpow288.5%
unpow288.5%
hypot-def88.5%
Simplified88.5%
Taylor expanded in l around inf 89.9%
Final simplification75.0%
(FPCore (l Om kx ky) :precision binary64 (if (<= l 1.7e+186) (+ 1.0 (* (* (/ l (/ Om l)) (/ kx (/ Om kx))) -0.5)) (+ 1.0 (* -0.5 (* (* l (* l (* kx kx))) (/ 1.0 (* Om Om)))))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (l <= 1.7e+186) {
tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
} else {
tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) * (1.0 / (Om * Om))));
}
return tmp;
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8) :: tmp
if (l <= 1.7d+186) then
tmp = 1.0d0 + (((l / (om / l)) * (kx / (om / kx))) * (-0.5d0))
else
tmp = 1.0d0 + ((-0.5d0) * ((l * (l * (kx * kx))) * (1.0d0 / (om * om))))
end if
code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if (l <= 1.7e+186) {
tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
} else {
tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) * (1.0 / (Om * Om))));
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if l <= 1.7e+186: tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5) else: tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) * (1.0 / (Om * Om)))) return tmp
function code(l, Om, kx, ky) tmp = 0.0 if (l <= 1.7e+186) tmp = Float64(1.0 + Float64(Float64(Float64(l / Float64(Om / l)) * Float64(kx / Float64(Om / kx))) * -0.5)); else tmp = Float64(1.0 + Float64(-0.5 * Float64(Float64(l * Float64(l * Float64(kx * kx))) * Float64(1.0 / Float64(Om * Om))))); end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if (l <= 1.7e+186) tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5); else tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) * (1.0 / (Om * Om)))); end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[l, 1.7e+186], N[(1.0 + N[(N[(N[(l / N[(Om / l), $MachinePrecision]), $MachinePrecision] * N[(kx / N[(Om / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(N[(l * N[(l * N[(kx * kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(Om * Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.7 \cdot 10^{+186}:\\
\;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(\left(\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)\right) \cdot \frac{1}{Om \cdot Om}\right)\\
\end{array}
\end{array}
if l < 1.70000000000000003e186Initial program 98.3%
Simplified98.3%
add-sqr-sqrt98.3%
hypot-1-def98.3%
sqrt-prod98.3%
unpow298.3%
sqrt-prod55.4%
add-sqr-sqrt98.6%
associate-/r/98.6%
*-commutative98.6%
unpow298.6%
unpow298.6%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in ky around 0 92.9%
associate-*r/92.9%
Simplified92.9%
Taylor expanded in kx around 0 42.1%
*-commutative42.1%
*-commutative42.1%
unpow242.1%
unpow242.1%
unpow242.1%
Simplified42.1%
Taylor expanded in l around 0 42.1%
unpow242.1%
*-commutative42.1%
unpow242.1%
times-frac45.4%
unpow245.4%
associate-/l*47.6%
associate-/l*50.6%
Simplified50.6%
if 1.70000000000000003e186 < l Initial program 100.0%
Simplified100.0%
add-sqr-sqrt100.0%
hypot-1-def100.0%
sqrt-prod100.0%
unpow2100.0%
sqrt-prod46.2%
add-sqr-sqrt100.0%
associate-/r/100.0%
*-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in ky around 0 93.3%
associate-*r/93.3%
Simplified93.3%
Taylor expanded in kx around 0 0.4%
*-commutative0.4%
*-commutative0.4%
unpow20.4%
unpow20.4%
unpow20.4%
Simplified0.4%
div-inv0.4%
associate-*l*2.7%
Applied egg-rr2.7%
Final simplification45.7%
(FPCore (l Om kx ky) :precision binary64 (if (<= l 7.5e+185) (+ 1.0 (* (* (/ l (/ Om l)) (/ kx (/ Om kx))) -0.5)) (+ 1.0 (* -0.5 (/ (* l (* l (* kx kx))) (* Om Om))))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (l <= 7.5e+185) {
tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
} else {
tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) / (Om * Om)));
}
return tmp;
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8) :: tmp
if (l <= 7.5d+185) then
tmp = 1.0d0 + (((l / (om / l)) * (kx / (om / kx))) * (-0.5d0))
else
tmp = 1.0d0 + ((-0.5d0) * ((l * (l * (kx * kx))) / (om * om)))
end if
code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if (l <= 7.5e+185) {
tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
} else {
tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) / (Om * Om)));
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if l <= 7.5e+185: tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5) else: tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) / (Om * Om))) return tmp
function code(l, Om, kx, ky) tmp = 0.0 if (l <= 7.5e+185) tmp = Float64(1.0 + Float64(Float64(Float64(l / Float64(Om / l)) * Float64(kx / Float64(Om / kx))) * -0.5)); else tmp = Float64(1.0 + Float64(-0.5 * Float64(Float64(l * Float64(l * Float64(kx * kx))) / Float64(Om * Om)))); end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if (l <= 7.5e+185) tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5); else tmp = 1.0 + (-0.5 * ((l * (l * (kx * kx))) / (Om * Om))); end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[l, 7.5e+185], N[(1.0 + N[(N[(N[(l / N[(Om / l), $MachinePrecision]), $MachinePrecision] * N[(kx / N[(Om / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(N[(l * N[(l * N[(kx * kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(Om * Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 7.5 \cdot 10^{+185}:\\
\;\;\;\;1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \frac{\ell \cdot \left(\ell \cdot \left(kx \cdot kx\right)\right)}{Om \cdot Om}\\
\end{array}
\end{array}
if l < 7.49999999999999955e185Initial program 98.3%
Simplified98.3%
add-sqr-sqrt98.3%
hypot-1-def98.3%
sqrt-prod98.3%
unpow298.3%
sqrt-prod55.4%
add-sqr-sqrt98.6%
associate-/r/98.6%
*-commutative98.6%
unpow298.6%
unpow298.6%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in ky around 0 92.9%
associate-*r/92.9%
Simplified92.9%
Taylor expanded in kx around 0 42.1%
*-commutative42.1%
*-commutative42.1%
unpow242.1%
unpow242.1%
unpow242.1%
Simplified42.1%
Taylor expanded in l around 0 42.1%
unpow242.1%
*-commutative42.1%
unpow242.1%
times-frac45.4%
unpow245.4%
associate-/l*47.6%
associate-/l*50.6%
Simplified50.6%
if 7.49999999999999955e185 < l Initial program 100.0%
Simplified100.0%
add-sqr-sqrt100.0%
hypot-1-def100.0%
sqrt-prod100.0%
unpow2100.0%
sqrt-prod46.2%
add-sqr-sqrt100.0%
associate-/r/100.0%
*-commutative100.0%
unpow2100.0%
unpow2100.0%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in ky around 0 93.3%
associate-*r/93.3%
Simplified93.3%
Taylor expanded in kx around 0 0.4%
*-commutative0.4%
*-commutative0.4%
unpow20.4%
unpow20.4%
unpow20.4%
Simplified0.4%
Taylor expanded in l around 0 0.4%
unpow20.4%
*-commutative0.4%
unpow20.4%
associate-*r*2.7%
Simplified2.7%
Final simplification45.7%
(FPCore (l Om kx ky) :precision binary64 (+ 1.0 (* (/ (* ky ky) (/ (* Om Om) (* l l))) -0.5)))
double code(double l, double Om, double kx, double ky) {
return 1.0 + (((ky * ky) / ((Om * Om) / (l * l))) * -0.5);
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
code = 1.0d0 + (((ky * ky) / ((om * om) / (l * l))) * (-0.5d0))
end function
public static double code(double l, double Om, double kx, double ky) {
return 1.0 + (((ky * ky) / ((Om * Om) / (l * l))) * -0.5);
}
def code(l, Om, kx, ky): return 1.0 + (((ky * ky) / ((Om * Om) / (l * l))) * -0.5)
function code(l, Om, kx, ky) return Float64(1.0 + Float64(Float64(Float64(ky * ky) / Float64(Float64(Om * Om) / Float64(l * l))) * -0.5)) end
function tmp = code(l, Om, kx, ky) tmp = 1.0 + (((ky * ky) / ((Om * Om) / (l * l))) * -0.5); end
code[l_, Om_, kx_, ky_] := N[(1.0 + N[(N[(N[(ky * ky), $MachinePrecision] / N[(N[(Om * Om), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{ky \cdot ky}{\frac{Om \cdot Om}{\ell \cdot \ell}} \cdot -0.5
\end{array}
Initial program 98.5%
Simplified98.5%
add-sqr-sqrt98.5%
hypot-1-def98.5%
sqrt-prod98.5%
unpow298.5%
sqrt-prod54.5%
add-sqr-sqrt98.8%
associate-/r/98.8%
*-commutative98.8%
unpow298.8%
unpow298.8%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in kx around 0 94.0%
Taylor expanded in ky around 0 36.5%
associate-/l*36.6%
unpow236.6%
unpow236.6%
unpow236.6%
Simplified36.6%
Final simplification36.6%
(FPCore (l Om kx ky) :precision binary64 (+ 1.0 (* -0.5 (* (* kx kx) (* (/ l Om) (/ l Om))))))
double code(double l, double Om, double kx, double ky) {
return 1.0 + (-0.5 * ((kx * kx) * ((l / Om) * (l / Om))));
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
code = 1.0d0 + ((-0.5d0) * ((kx * kx) * ((l / om) * (l / om))))
end function
public static double code(double l, double Om, double kx, double ky) {
return 1.0 + (-0.5 * ((kx * kx) * ((l / Om) * (l / Om))));
}
def code(l, Om, kx, ky): return 1.0 + (-0.5 * ((kx * kx) * ((l / Om) * (l / Om))))
function code(l, Om, kx, ky) return Float64(1.0 + Float64(-0.5 * Float64(Float64(kx * kx) * Float64(Float64(l / Om) * Float64(l / Om))))) end
function tmp = code(l, Om, kx, ky) tmp = 1.0 + (-0.5 * ((kx * kx) * ((l / Om) * (l / Om)))); end
code[l_, Om_, kx_, ky_] := N[(1.0 + N[(-0.5 * N[(N[(kx * kx), $MachinePrecision] * N[(N[(l / Om), $MachinePrecision] * N[(l / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + -0.5 \cdot \left(\left(kx \cdot kx\right) \cdot \left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)\right)
\end{array}
Initial program 98.5%
Simplified98.5%
add-sqr-sqrt98.5%
hypot-1-def98.5%
sqrt-prod98.5%
unpow298.5%
sqrt-prod54.5%
add-sqr-sqrt98.8%
associate-/r/98.8%
*-commutative98.8%
unpow298.8%
unpow298.8%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in ky around 0 93.0%
associate-*r/93.0%
Simplified93.0%
Taylor expanded in kx around 0 37.9%
*-commutative37.9%
*-commutative37.9%
unpow237.9%
unpow237.9%
unpow237.9%
Simplified37.9%
*-un-lft-identity37.9%
associate-/l*36.7%
Applied egg-rr36.7%
*-lft-identity36.7%
unpow236.7%
unpow236.7%
associate-/r/37.7%
unpow237.7%
unpow237.7%
times-frac43.6%
Simplified43.6%
Final simplification43.6%
(FPCore (l Om kx ky) :precision binary64 (+ 1.0 (* (* (/ l (/ Om l)) (/ kx (/ Om kx))) -0.5)))
double code(double l, double Om, double kx, double ky) {
return 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
code = 1.0d0 + (((l / (om / l)) * (kx / (om / kx))) * (-0.5d0))
end function
public static double code(double l, double Om, double kx, double ky) {
return 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5);
}
def code(l, Om, kx, ky): return 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5)
function code(l, Om, kx, ky) return Float64(1.0 + Float64(Float64(Float64(l / Float64(Om / l)) * Float64(kx / Float64(Om / kx))) * -0.5)) end
function tmp = code(l, Om, kx, ky) tmp = 1.0 + (((l / (Om / l)) * (kx / (Om / kx))) * -0.5); end
code[l_, Om_, kx_, ky_] := N[(1.0 + N[(N[(N[(l / N[(Om / l), $MachinePrecision]), $MachinePrecision] * N[(kx / N[(Om / kx), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \frac{kx}{\frac{Om}{kx}}\right) \cdot -0.5
\end{array}
Initial program 98.5%
Simplified98.5%
add-sqr-sqrt98.5%
hypot-1-def98.5%
sqrt-prod98.5%
unpow298.5%
sqrt-prod54.5%
add-sqr-sqrt98.8%
associate-/r/98.8%
*-commutative98.8%
unpow298.8%
unpow298.8%
hypot-def100.0%
Applied egg-rr100.0%
Taylor expanded in ky around 0 93.0%
associate-*r/93.0%
Simplified93.0%
Taylor expanded in kx around 0 37.9%
*-commutative37.9%
*-commutative37.9%
unpow237.9%
unpow237.9%
unpow237.9%
Simplified37.9%
Taylor expanded in l around 0 37.9%
unpow237.9%
*-commutative37.9%
unpow237.9%
times-frac40.8%
unpow240.8%
associate-/l*42.8%
associate-/l*45.5%
Simplified45.5%
Final simplification45.5%
herbie shell --seed 2023293
(FPCore (l Om kx ky)
:name "Toniolo and Linder, Equation (3a)"
:precision binary64
(sqrt (* (/ 1.0 2.0) (+ 1.0 (/ 1.0 (sqrt (+ 1.0 (* (pow (/ (* 2.0 l) Om) 2.0) (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))