
(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 10 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
(*
(+
(/
1.0
(sqrt
(+
(+ (pow (* (/ 2.0 Om) (* (sin kx) l)) 2.0) 1.0)
(pow (* (* (sin ky) 2.0) (/ l Om)) 2.0))))
1.0)
(/ 1.0 2.0))))
double code(double l, double Om, double kx, double ky) {
return sqrt((((1.0 / sqrt(((pow(((2.0 / Om) * (sin(kx) * l)), 2.0) + 1.0) + pow(((sin(ky) * 2.0) * (l / Om)), 2.0)))) + 1.0) * (1.0 / 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 / sqrt((((((2.0d0 / om) * (sin(kx) * l)) ** 2.0d0) + 1.0d0) + (((sin(ky) * 2.0d0) * (l / om)) ** 2.0d0)))) + 1.0d0) * (1.0d0 / 2.0d0)))
end function
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt((((1.0 / Math.sqrt(((Math.pow(((2.0 / Om) * (Math.sin(kx) * l)), 2.0) + 1.0) + Math.pow(((Math.sin(ky) * 2.0) * (l / Om)), 2.0)))) + 1.0) * (1.0 / 2.0)));
}
def code(l, Om, kx, ky): return math.sqrt((((1.0 / math.sqrt(((math.pow(((2.0 / Om) * (math.sin(kx) * l)), 2.0) + 1.0) + math.pow(((math.sin(ky) * 2.0) * (l / Om)), 2.0)))) + 1.0) * (1.0 / 2.0)))
function code(l, Om, kx, ky) return sqrt(Float64(Float64(Float64(1.0 / sqrt(Float64(Float64((Float64(Float64(2.0 / Om) * Float64(sin(kx) * l)) ^ 2.0) + 1.0) + (Float64(Float64(sin(ky) * 2.0) * Float64(l / Om)) ^ 2.0)))) + 1.0) * Float64(1.0 / 2.0))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt((((1.0 / sqrt((((((2.0 / Om) * (sin(kx) * l)) ^ 2.0) + 1.0) + (((sin(ky) * 2.0) * (l / Om)) ^ 2.0)))) + 1.0) * (1.0 / 2.0))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(N[(N[(1.0 / N[Sqrt[N[(N[(N[Power[N[(N[(2.0 / Om), $MachinePrecision] * N[(N[Sin[kx], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] + N[Power[N[(N[(N[Sin[ky], $MachinePrecision] * 2.0), $MachinePrecision] * N[(l / Om), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(\frac{1}{\sqrt{\left({\left(\frac{2}{Om} \cdot \left(\sin kx \cdot \ell\right)\right)}^{2} + 1\right) + {\left(\left(\sin ky \cdot 2\right) \cdot \frac{\ell}{Om}\right)}^{2}}} + 1\right) \cdot \frac{1}{2}}
\end{array}
Initial program 97.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
Applied rewrites100.0%
Final simplification100.0%
(FPCore (l Om kx ky)
:precision binary64
(if (<= (pow (sin ky) 2.0) 1e-19)
(sqrt
(*
(+
(/
1.0
(sqrt
(+
(+ (pow (* (/ (* kx l) Om) 2.0) 2.0) 1.0)
(pow (* (* ky (/ l Om)) 2.0) 2.0))))
1.0)
(/ 1.0 2.0)))
(sqrt
(*
(+
(/
1.0
(sqrt
(+
(*
(+ (- 0.5 (* (cos (* ky 2.0)) 0.5)) (pow (sin kx) 2.0))
(pow (/ (* l 2.0) Om) 2.0))
1.0)))
1.0)
(/ 1.0 2.0)))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (pow(sin(ky), 2.0) <= 1e-19) {
tmp = sqrt((((1.0 / sqrt(((pow((((kx * l) / Om) * 2.0), 2.0) + 1.0) + pow(((ky * (l / Om)) * 2.0), 2.0)))) + 1.0) * (1.0 / 2.0)));
} else {
tmp = sqrt((((1.0 / sqrt(((((0.5 - (cos((ky * 2.0)) * 0.5)) + pow(sin(kx), 2.0)) * pow(((l * 2.0) / Om), 2.0)) + 1.0))) + 1.0) * (1.0 / 2.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 ((sin(ky) ** 2.0d0) <= 1d-19) then
tmp = sqrt((((1.0d0 / sqrt(((((((kx * l) / om) * 2.0d0) ** 2.0d0) + 1.0d0) + (((ky * (l / om)) * 2.0d0) ** 2.0d0)))) + 1.0d0) * (1.0d0 / 2.0d0)))
else
tmp = sqrt((((1.0d0 / sqrt(((((0.5d0 - (cos((ky * 2.0d0)) * 0.5d0)) + (sin(kx) ** 2.0d0)) * (((l * 2.0d0) / om) ** 2.0d0)) + 1.0d0))) + 1.0d0) * (1.0d0 / 2.0d0)))
end if
code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if (Math.pow(Math.sin(ky), 2.0) <= 1e-19) {
tmp = Math.sqrt((((1.0 / Math.sqrt(((Math.pow((((kx * l) / Om) * 2.0), 2.0) + 1.0) + Math.pow(((ky * (l / Om)) * 2.0), 2.0)))) + 1.0) * (1.0 / 2.0)));
} else {
tmp = Math.sqrt((((1.0 / Math.sqrt(((((0.5 - (Math.cos((ky * 2.0)) * 0.5)) + Math.pow(Math.sin(kx), 2.0)) * Math.pow(((l * 2.0) / Om), 2.0)) + 1.0))) + 1.0) * (1.0 / 2.0)));
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if math.pow(math.sin(ky), 2.0) <= 1e-19: tmp = math.sqrt((((1.0 / math.sqrt(((math.pow((((kx * l) / Om) * 2.0), 2.0) + 1.0) + math.pow(((ky * (l / Om)) * 2.0), 2.0)))) + 1.0) * (1.0 / 2.0))) else: tmp = math.sqrt((((1.0 / math.sqrt(((((0.5 - (math.cos((ky * 2.0)) * 0.5)) + math.pow(math.sin(kx), 2.0)) * math.pow(((l * 2.0) / Om), 2.0)) + 1.0))) + 1.0) * (1.0 / 2.0))) return tmp
function code(l, Om, kx, ky) tmp = 0.0 if ((sin(ky) ^ 2.0) <= 1e-19) tmp = sqrt(Float64(Float64(Float64(1.0 / sqrt(Float64(Float64((Float64(Float64(Float64(kx * l) / Om) * 2.0) ^ 2.0) + 1.0) + (Float64(Float64(ky * Float64(l / Om)) * 2.0) ^ 2.0)))) + 1.0) * Float64(1.0 / 2.0))); else tmp = sqrt(Float64(Float64(Float64(1.0 / sqrt(Float64(Float64(Float64(Float64(0.5 - Float64(cos(Float64(ky * 2.0)) * 0.5)) + (sin(kx) ^ 2.0)) * (Float64(Float64(l * 2.0) / Om) ^ 2.0)) + 1.0))) + 1.0) * Float64(1.0 / 2.0))); end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if ((sin(ky) ^ 2.0) <= 1e-19) tmp = sqrt((((1.0 / sqrt(((((((kx * l) / Om) * 2.0) ^ 2.0) + 1.0) + (((ky * (l / Om)) * 2.0) ^ 2.0)))) + 1.0) * (1.0 / 2.0))); else tmp = sqrt((((1.0 / sqrt(((((0.5 - (cos((ky * 2.0)) * 0.5)) + (sin(kx) ^ 2.0)) * (((l * 2.0) / Om) ^ 2.0)) + 1.0))) + 1.0) * (1.0 / 2.0))); end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision], 1e-19], N[Sqrt[N[(N[(N[(1.0 / N[Sqrt[N[(N[(N[Power[N[(N[(N[(kx * l), $MachinePrecision] / Om), $MachinePrecision] * 2.0), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] + N[Power[N[(N[(ky * N[(l / Om), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(N[(1.0 / N[Sqrt[N[(N[(N[(N[(0.5 - N[(N[Cos[N[(ky * 2.0), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(l * 2.0), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\sin ky}^{2} \leq 10^{-19}:\\
\;\;\;\;\sqrt{\left(\frac{1}{\sqrt{\left({\left(\frac{kx \cdot \ell}{Om} \cdot 2\right)}^{2} + 1\right) + {\left(\left(ky \cdot \frac{\ell}{Om}\right) \cdot 2\right)}^{2}}} + 1\right) \cdot \frac{1}{2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\frac{1}{\sqrt{\left(\left(0.5 - \cos \left(ky \cdot 2\right) \cdot 0.5\right) + {\sin kx}^{2}\right) \cdot {\left(\frac{\ell \cdot 2}{Om}\right)}^{2} + 1}} + 1\right) \cdot \frac{1}{2}}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 ky) #s(literal 2 binary64)) < 9.9999999999999998e-20Initial program 95.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
Applied rewrites100.0%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6490.2
Applied rewrites90.2%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6490.2
Applied rewrites90.2%
if 9.9999999999999998e-20 < (pow.f64 (sin.f64 ky) #s(literal 2 binary64)) Initial program 100.0%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
metadata-evalN/A
lift-/.f64N/A
lower--.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
count-2N/A
lower-cos.f64N/A
count-2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification95.3%
(FPCore (l Om kx ky)
:precision binary64
(if (<=
(* (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)) (pow (/ (* l 2.0) Om) 2.0))
2e-6)
(sqrt 1.0)
(* (sqrt 0.5) (sqrt (fma (/ Om (* (sin ky) l)) 0.5 1.0)))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)) * pow(((l * 2.0) / Om), 2.0)) <= 2e-6) {
tmp = sqrt(1.0);
} else {
tmp = sqrt(0.5) * sqrt(fma((Om / (sin(ky) * l)), 0.5, 1.0));
}
return tmp;
}
function code(l, Om, kx, ky) tmp = 0.0 if (Float64(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)) * (Float64(Float64(l * 2.0) / Om) ^ 2.0)) <= 2e-6) tmp = sqrt(1.0); else tmp = Float64(sqrt(0.5) * sqrt(fma(Float64(Om / Float64(sin(ky) * l)), 0.5, 1.0))); end return tmp end
code[l_, Om_, kx_, ky_] := If[LessEqual[N[(N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(l * 2.0), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 2e-6], N[Sqrt[1.0], $MachinePrecision], N[(N[Sqrt[0.5], $MachinePrecision] * N[Sqrt[N[(N[(Om / N[(N[Sin[ky], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\sin kx}^{2} + {\sin ky}^{2}\right) \cdot {\left(\frac{\ell \cdot 2}{Om}\right)}^{2} \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\sqrt{1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5} \cdot \sqrt{\mathsf{fma}\left(\frac{Om}{\sin ky \cdot \ell}, 0.5, 1\right)}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) < 1.99999999999999991e-6Initial program 100.0%
Taylor expanded in Om around inf
Applied rewrites99.7%
if 1.99999999999999991e-6 < (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) Initial program 95.3%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.4%
Taylor expanded in l around -inf
Applied rewrites80.6%
Taylor expanded in Om around 0
Applied rewrites80.6%
Final simplification91.0%
(FPCore (l Om kx ky)
:precision binary64
(if (<=
(* (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)) (pow (/ (* l 2.0) Om) 2.0))
5e-17)
(sqrt 1.0)
(*
(sqrt
(+ (sqrt (/ 1.0 (fma (* (/ ky Om) ky) (* (* (/ l Om) l) 4.0) 1.0))) 1.0))
(sqrt 0.5))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)) * pow(((l * 2.0) / Om), 2.0)) <= 5e-17) {
tmp = sqrt(1.0);
} else {
tmp = sqrt((sqrt((1.0 / fma(((ky / Om) * ky), (((l / Om) * l) * 4.0), 1.0))) + 1.0)) * sqrt(0.5);
}
return tmp;
}
function code(l, Om, kx, ky) tmp = 0.0 if (Float64(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)) * (Float64(Float64(l * 2.0) / Om) ^ 2.0)) <= 5e-17) tmp = sqrt(1.0); else tmp = Float64(sqrt(Float64(sqrt(Float64(1.0 / fma(Float64(Float64(ky / Om) * ky), Float64(Float64(Float64(l / Om) * l) * 4.0), 1.0))) + 1.0)) * sqrt(0.5)); end return tmp end
code[l_, Om_, kx_, ky_] := If[LessEqual[N[(N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(l * 2.0), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 5e-17], N[Sqrt[1.0], $MachinePrecision], N[(N[Sqrt[N[(N[Sqrt[N[(1.0 / N[(N[(N[(ky / Om), $MachinePrecision] * ky), $MachinePrecision] * N[(N[(N[(l / Om), $MachinePrecision] * l), $MachinePrecision] * 4.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\sin kx}^{2} + {\sin ky}^{2}\right) \cdot {\left(\frac{\ell \cdot 2}{Om}\right)}^{2} \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\sqrt{\frac{1}{\mathsf{fma}\left(\frac{ky}{Om} \cdot ky, \left(\frac{\ell}{Om} \cdot \ell\right) \cdot 4, 1\right)}} + 1} \cdot \sqrt{0.5}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) < 4.9999999999999999e-17Initial program 100.0%
Taylor expanded in Om around inf
Applied rewrites100.0%
if 4.9999999999999999e-17 < (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) Initial program 95.3%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.2%
Applied rewrites71.7%
Taylor expanded in ky around 0
Applied rewrites71.1%
Applied rewrites75.2%
Final simplification88.7%
(FPCore (l Om kx ky)
:precision binary64
(let* ((t_0 (pow (sin kx) 2.0)))
(if (<= t_0 1e-99)
(sqrt
(+
(/
0.5
(sqrt
(+
(pow (* (* kx (/ l Om)) 2.0) 2.0)
(+ (pow (* (* (/ 2.0 Om) l) (sin ky)) 2.0) 1.0))))
0.5))
(sqrt
(fma
(sqrt (/ 1.0 (fma (/ t_0 Om) (* (* (/ l Om) l) 4.0) 1.0)))
0.5
0.5)))))
double code(double l, double Om, double kx, double ky) {
double t_0 = pow(sin(kx), 2.0);
double tmp;
if (t_0 <= 1e-99) {
tmp = sqrt(((0.5 / sqrt((pow(((kx * (l / Om)) * 2.0), 2.0) + (pow((((2.0 / Om) * l) * sin(ky)), 2.0) + 1.0)))) + 0.5));
} else {
tmp = sqrt(fma(sqrt((1.0 / fma((t_0 / Om), (((l / Om) * l) * 4.0), 1.0))), 0.5, 0.5));
}
return tmp;
}
function code(l, Om, kx, ky) t_0 = sin(kx) ^ 2.0 tmp = 0.0 if (t_0 <= 1e-99) tmp = sqrt(Float64(Float64(0.5 / sqrt(Float64((Float64(Float64(kx * Float64(l / Om)) * 2.0) ^ 2.0) + Float64((Float64(Float64(Float64(2.0 / Om) * l) * sin(ky)) ^ 2.0) + 1.0)))) + 0.5)); else tmp = sqrt(fma(sqrt(Float64(1.0 / fma(Float64(t_0 / Om), Float64(Float64(Float64(l / Om) * l) * 4.0), 1.0))), 0.5, 0.5)); end return tmp end
code[l_, Om_, kx_, ky_] := Block[{t$95$0 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$0, 1e-99], N[Sqrt[N[(N[(0.5 / N[Sqrt[N[(N[Power[N[(N[(kx * N[(l / Om), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[N[(N[(N[(2.0 / Om), $MachinePrecision] * l), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[Sqrt[N[(1.0 / N[(N[(t$95$0 / Om), $MachinePrecision] * N[(N[(N[(l / Om), $MachinePrecision] * l), $MachinePrecision] * 4.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5 + 0.5), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\sin kx}^{2}\\
\mathbf{if}\;t\_0 \leq 10^{-99}:\\
\;\;\;\;\sqrt{\frac{0.5}{\sqrt{{\left(\left(kx \cdot \frac{\ell}{Om}\right) \cdot 2\right)}^{2} + \left({\left(\left(\frac{2}{Om} \cdot \ell\right) \cdot \sin ky\right)}^{2} + 1\right)}} + 0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(\frac{t\_0}{Om}, \left(\frac{\ell}{Om} \cdot \ell\right) \cdot 4, 1\right)}}, 0.5, 0.5\right)}\\
\end{array}
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 1e-99Initial program 94.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
Applied rewrites100.0%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
if 1e-99 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 100.0%
Taylor expanded in ky around 0
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites93.4%
Applied rewrites99.5%
Final simplification99.7%
(FPCore (l Om kx ky)
:precision binary64
(if (<=
(* (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)) (pow (/ (* l 2.0) Om) 2.0))
2e-6)
(sqrt 1.0)
(* (/ (fma (/ Om l) 0.25 ky) ky) (sqrt 0.5))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)) * pow(((l * 2.0) / Om), 2.0)) <= 2e-6) {
tmp = sqrt(1.0);
} else {
tmp = (fma((Om / l), 0.25, ky) / ky) * sqrt(0.5);
}
return tmp;
}
function code(l, Om, kx, ky) tmp = 0.0 if (Float64(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)) * (Float64(Float64(l * 2.0) / Om) ^ 2.0)) <= 2e-6) tmp = sqrt(1.0); else tmp = Float64(Float64(fma(Float64(Om / l), 0.25, ky) / ky) * sqrt(0.5)); end return tmp end
code[l_, Om_, kx_, ky_] := If[LessEqual[N[(N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(l * 2.0), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 2e-6], N[Sqrt[1.0], $MachinePrecision], N[(N[(N[(N[(Om / l), $MachinePrecision] * 0.25 + ky), $MachinePrecision] / ky), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\sin kx}^{2} + {\sin ky}^{2}\right) \cdot {\left(\frac{\ell \cdot 2}{Om}\right)}^{2} \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\sqrt{1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{Om}{\ell}, 0.25, ky\right)}{ky} \cdot \sqrt{0.5}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) < 1.99999999999999991e-6Initial program 100.0%
Taylor expanded in Om around inf
Applied rewrites99.7%
if 1.99999999999999991e-6 < (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) Initial program 95.3%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.4%
Applied rewrites71.9%
Taylor expanded in Om around 0
Applied rewrites80.6%
Taylor expanded in ky around 0
Applied rewrites80.5%
Final simplification91.0%
(FPCore (l Om kx ky)
:precision binary64
(if (<=
(* (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)) (pow (/ (* l 2.0) Om) 2.0))
2e-6)
(sqrt 1.0)
(* (fma (/ Om (* ky l)) 0.25 1.0) (sqrt 0.5))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)) * pow(((l * 2.0) / Om), 2.0)) <= 2e-6) {
tmp = sqrt(1.0);
} else {
tmp = fma((Om / (ky * l)), 0.25, 1.0) * sqrt(0.5);
}
return tmp;
}
function code(l, Om, kx, ky) tmp = 0.0 if (Float64(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)) * (Float64(Float64(l * 2.0) / Om) ^ 2.0)) <= 2e-6) tmp = sqrt(1.0); else tmp = Float64(fma(Float64(Om / Float64(ky * l)), 0.25, 1.0) * sqrt(0.5)); end return tmp end
code[l_, Om_, kx_, ky_] := If[LessEqual[N[(N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(l * 2.0), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 2e-6], N[Sqrt[1.0], $MachinePrecision], N[(N[(N[(Om / N[(ky * l), $MachinePrecision]), $MachinePrecision] * 0.25 + 1.0), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\sin kx}^{2} + {\sin ky}^{2}\right) \cdot {\left(\frac{\ell \cdot 2}{Om}\right)}^{2} \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\sqrt{1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{Om}{ky \cdot \ell}, 0.25, 1\right) \cdot \sqrt{0.5}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) < 1.99999999999999991e-6Initial program 100.0%
Taylor expanded in Om around inf
Applied rewrites99.7%
if 1.99999999999999991e-6 < (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) Initial program 95.3%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.4%
Applied rewrites71.9%
Taylor expanded in Om around 0
Applied rewrites80.6%
Taylor expanded in ky around 0
Applied rewrites80.4%
Final simplification90.9%
(FPCore (l Om kx ky)
:precision binary64
(if (<=
(* (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)) (pow (/ (* l 2.0) Om) 2.0))
3.8)
(sqrt 1.0)
(sqrt 0.5)))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)) * pow(((l * 2.0) / Om), 2.0)) <= 3.8) {
tmp = sqrt(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 ((((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)) * (((l * 2.0d0) / om) ** 2.0d0)) <= 3.8d0) then
tmp = sqrt(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 (((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)) * Math.pow(((l * 2.0) / Om), 2.0)) <= 3.8) {
tmp = Math.sqrt(1.0);
} else {
tmp = Math.sqrt(0.5);
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if ((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)) * math.pow(((l * 2.0) / Om), 2.0)) <= 3.8: tmp = math.sqrt(1.0) else: tmp = math.sqrt(0.5) return tmp
function code(l, Om, kx, ky) tmp = 0.0 if (Float64(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)) * (Float64(Float64(l * 2.0) / Om) ^ 2.0)) <= 3.8) tmp = sqrt(1.0); else tmp = sqrt(0.5); end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if ((((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)) * (((l * 2.0) / Om) ^ 2.0)) <= 3.8) tmp = sqrt(1.0); else tmp = sqrt(0.5); end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[N[(N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(l * 2.0), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 3.8], N[Sqrt[1.0], $MachinePrecision], N[Sqrt[0.5], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left({\sin kx}^{2} + {\sin ky}^{2}\right) \cdot {\left(\frac{\ell \cdot 2}{Om}\right)}^{2} \leq 3.8:\\
\;\;\;\;\sqrt{1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) < 3.7999999999999998Initial program 100.0%
Taylor expanded in Om around inf
Applied rewrites99.7%
if 3.7999999999999998 < (*.f64 (pow.f64 (/.f64 (*.f64 #s(literal 2 binary64) l) Om) #s(literal 2 binary64)) (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64)))) Initial program 95.3%
Taylor expanded in Om around 0
Applied rewrites95.9%
Final simplification97.9%
(FPCore (l Om kx ky)
:precision binary64
(if (<= (/ (* l 2.0) Om) 1e-8)
(sqrt 1.0)
(sqrt
(*
(+
(/
1.0
(sqrt
(+
(+ (pow (* (/ (* kx l) Om) 2.0) 2.0) 1.0)
(pow (* (* ky (/ l Om)) 2.0) 2.0))))
1.0)
(/ 1.0 2.0)))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (((l * 2.0) / Om) <= 1e-8) {
tmp = sqrt(1.0);
} else {
tmp = sqrt((((1.0 / sqrt(((pow((((kx * l) / Om) * 2.0), 2.0) + 1.0) + pow(((ky * (l / Om)) * 2.0), 2.0)))) + 1.0) * (1.0 / 2.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 (((l * 2.0d0) / om) <= 1d-8) then
tmp = sqrt(1.0d0)
else
tmp = sqrt((((1.0d0 / sqrt(((((((kx * l) / om) * 2.0d0) ** 2.0d0) + 1.0d0) + (((ky * (l / om)) * 2.0d0) ** 2.0d0)))) + 1.0d0) * (1.0d0 / 2.0d0)))
end if
code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if (((l * 2.0) / Om) <= 1e-8) {
tmp = Math.sqrt(1.0);
} else {
tmp = Math.sqrt((((1.0 / Math.sqrt(((Math.pow((((kx * l) / Om) * 2.0), 2.0) + 1.0) + Math.pow(((ky * (l / Om)) * 2.0), 2.0)))) + 1.0) * (1.0 / 2.0)));
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if ((l * 2.0) / Om) <= 1e-8: tmp = math.sqrt(1.0) else: tmp = math.sqrt((((1.0 / math.sqrt(((math.pow((((kx * l) / Om) * 2.0), 2.0) + 1.0) + math.pow(((ky * (l / Om)) * 2.0), 2.0)))) + 1.0) * (1.0 / 2.0))) return tmp
function code(l, Om, kx, ky) tmp = 0.0 if (Float64(Float64(l * 2.0) / Om) <= 1e-8) tmp = sqrt(1.0); else tmp = sqrt(Float64(Float64(Float64(1.0 / sqrt(Float64(Float64((Float64(Float64(Float64(kx * l) / Om) * 2.0) ^ 2.0) + 1.0) + (Float64(Float64(ky * Float64(l / Om)) * 2.0) ^ 2.0)))) + 1.0) * Float64(1.0 / 2.0))); end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if (((l * 2.0) / Om) <= 1e-8) tmp = sqrt(1.0); else tmp = sqrt((((1.0 / sqrt(((((((kx * l) / Om) * 2.0) ^ 2.0) + 1.0) + (((ky * (l / Om)) * 2.0) ^ 2.0)))) + 1.0) * (1.0 / 2.0))); end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[N[(N[(l * 2.0), $MachinePrecision] / Om), $MachinePrecision], 1e-8], N[Sqrt[1.0], $MachinePrecision], N[Sqrt[N[(N[(N[(1.0 / N[Sqrt[N[(N[(N[Power[N[(N[(N[(kx * l), $MachinePrecision] / Om), $MachinePrecision] * 2.0), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] + N[Power[N[(N[(ky * N[(l / Om), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\ell \cdot 2}{Om} \leq 10^{-8}:\\
\;\;\;\;\sqrt{1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(\frac{1}{\sqrt{\left({\left(\frac{kx \cdot \ell}{Om} \cdot 2\right)}^{2} + 1\right) + {\left(\left(ky \cdot \frac{\ell}{Om}\right) \cdot 2\right)}^{2}}} + 1\right) \cdot \frac{1}{2}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 2 binary64) l) Om) < 1e-8Initial program 98.5%
Taylor expanded in Om around inf
Applied rewrites77.3%
if 1e-8 < (/.f64 (*.f64 #s(literal 2 binary64) l) Om) Initial program 95.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
Applied rewrites100.0%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6498.9
Applied rewrites98.9%
Final simplification82.7%
(FPCore (l Om kx ky) :precision binary64 (sqrt 0.5))
double code(double l, double Om, double kx, double ky) {
return sqrt(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 = sqrt(0.5d0)
end function
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt(0.5);
}
def code(l, Om, kx, ky): return math.sqrt(0.5)
function code(l, Om, kx, ky) return sqrt(0.5) end
function tmp = code(l, Om, kx, ky) tmp = sqrt(0.5); end
code[l_, Om_, kx_, ky_] := N[Sqrt[0.5], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{0.5}
\end{array}
Initial program 97.9%
Taylor expanded in Om around 0
Applied rewrites54.4%
herbie shell --seed 2024254
(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))))))))))