Toniolo and Linder, Equation (3a)

Percentage Accurate: 98.5% → 98.5%
Time: 19.1s
Alternatives: 4
Speedup: 1.0×

Specification

?
\[\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 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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 4 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 98.5% accurate, 1.0× speedup?

\[\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 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}

Alternative 1: 98.5% accurate, 1.0× speedup?

\[\begin{array}{l} l = |l|\\ Om = |Om|\\ kx = |kx|\\ ky = |ky|\\ [kx, ky] = \mathsf{sort}([kx, ky])\\ \\ \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} \]
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
(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))))))))))
l = abs(l);
Om = abs(Om);
kx = abs(kx);
ky = abs(ky);
assert(kx < ky);
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)))))))));
}
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
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
l = Math.abs(l);
Om = Math.abs(Om);
kx = Math.abs(kx);
ky = Math.abs(ky);
assert kx < ky;
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)))))))));
}
l = abs(l)
Om = abs(Om)
kx = abs(kx)
ky = abs(ky)
[kx, ky] = sort([kx, ky])
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)))))))))
l = abs(l)
Om = abs(Om)
kx = abs(kx)
ky = abs(ky)
kx, ky = sort([kx, ky])
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
l = abs(l)
Om = abs(Om)
kx = abs(kx)
ky = abs(ky)
kx, ky = num2cell(sort([kx, ky])){:}
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
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
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}
l = |l|\\
Om = |Om|\\
kx = |kx|\\
ky = |ky|\\
[kx, ky] = \mathsf{sort}([kx, ky])\\
\\
\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}
Derivation
  1. Initial program 98.4%

    \[\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)} \]

Alternative 2: 98.5% accurate, 1.0× speedup?

\[\begin{array}{l} l = |l|\\ Om = |Om|\\ kx = |kx|\\ ky = |ky|\\ [kx, ky] = \mathsf{sort}([kx, ky])\\ \\ \sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}} \end{array} \]
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
(FPCore (l Om kx ky)
 :precision binary64
 (sqrt
  (+
   0.5
   (*
    0.5
    (/
     1.0
     (sqrt
      (+
       1.0
       (*
        (pow (/ 2.0 (/ Om l)) 2.0)
        (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))
l = abs(l);
Om = abs(Om);
kx = abs(kx);
ky = abs(ky);
assert(kx < ky);
double code(double l, double Om, double kx, double ky) {
	return sqrt((0.5 + (0.5 * (1.0 / sqrt((1.0 + (pow((2.0 / (Om / l)), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))))));
}
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
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 + (0.5d0 * (1.0d0 / sqrt((1.0d0 + (((2.0d0 / (om / l)) ** 2.0d0) * ((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))))))))
end function
l = Math.abs(l);
Om = Math.abs(Om);
kx = Math.abs(kx);
ky = Math.abs(ky);
assert kx < ky;
public static double code(double l, double Om, double kx, double ky) {
	return Math.sqrt((0.5 + (0.5 * (1.0 / Math.sqrt((1.0 + (Math.pow((2.0 / (Om / l)), 2.0) * (Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))))))));
}
l = abs(l)
Om = abs(Om)
kx = abs(kx)
ky = abs(ky)
[kx, ky] = sort([kx, ky])
def code(l, Om, kx, ky):
	return math.sqrt((0.5 + (0.5 * (1.0 / math.sqrt((1.0 + (math.pow((2.0 / (Om / l)), 2.0) * (math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))))))))
l = abs(l)
Om = abs(Om)
kx = abs(kx)
ky = abs(ky)
kx, ky = sort([kx, ky])
function code(l, Om, kx, ky)
	return sqrt(Float64(0.5 + Float64(0.5 * Float64(1.0 / sqrt(Float64(1.0 + Float64((Float64(2.0 / Float64(Om / l)) ^ 2.0) * Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))))))))
end
l = abs(l)
Om = abs(Om)
kx = abs(kx)
ky = abs(ky)
kx, ky = num2cell(sort([kx, ky])){:}
function tmp = code(l, Om, kx, ky)
	tmp = sqrt((0.5 + (0.5 * (1.0 / sqrt((1.0 + (((2.0 / (Om / l)) ^ 2.0) * ((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))))))));
end
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 * N[(1.0 / N[Sqrt[N[(1.0 + N[(N[Power[N[(2.0 / N[(Om / l), $MachinePrecision]), $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}
l = |l|\\
Om = |Om|\\
kx = |kx|\\
ky = |ky|\\
[kx, ky] = \mathsf{sort}([kx, ky])\\
\\
\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}
\end{array}
Derivation
  1. Initial program 98.4%

    \[\sqrt{0.5 + 0.5 \cdot \frac{1}{\sqrt{1 + {\left(\frac{2}{\frac{Om}{\ell}}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}} \]

Alternative 3: 98.5% accurate, 0.9× speedup?

\[\begin{array}{l} l = |l|\\ Om = |Om|\\ kx = |kx|\\ ky = |ky|\\ [kx, ky] = \mathsf{sort}([kx, ky])\\ \\ \sqrt{0.5 + \frac{0.5}{\sqrt{\mathsf{fma}\left({\left(\frac{2}{Om} \cdot \ell\right)}^{2}, {\sin kx}^{2} + {\sin ky}^{2}, 1\right)}}} \end{array} \]
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
(FPCore (l Om kx ky)
 :precision binary64
 (sqrt
  (+
   0.5
   (/
    0.5
    (sqrt
     (fma
      (pow (* (/ 2.0 Om) l) 2.0)
      (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))
      1.0))))))
l = abs(l);
Om = abs(Om);
kx = abs(kx);
ky = abs(ky);
assert(kx < ky);
double code(double l, double Om, double kx, double ky) {
	return sqrt((0.5 + (0.5 / sqrt(fma(pow(((2.0 / Om) * l), 2.0), (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)), 1.0)))));
}
l = abs(l)
Om = abs(Om)
kx = abs(kx)
ky = abs(ky)
kx, ky = sort([kx, ky])
function code(l, Om, kx, ky)
	return sqrt(Float64(0.5 + Float64(0.5 / sqrt(fma((Float64(Float64(2.0 / Om) * l) ^ 2.0), Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)), 1.0)))))
end
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 / N[Sqrt[N[(N[Power[N[(N[(2.0 / Om), $MachinePrecision] * l), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
l = |l|\\
Om = |Om|\\
kx = |kx|\\
ky = |ky|\\
[kx, ky] = \mathsf{sort}([kx, ky])\\
\\
\sqrt{0.5 + \frac{0.5}{\sqrt{\mathsf{fma}\left({\left(\frac{2}{Om} \cdot \ell\right)}^{2}, {\sin kx}^{2} + {\sin ky}^{2}, 1\right)}}}
\end{array}
Derivation
  1. Initial program 98.4%

    \[\sqrt{0.5 + \frac{0.5}{\sqrt{\mathsf{fma}\left({\left(\frac{2}{Om} \cdot \ell\right)}^{2}, {\sin kx}^{2} + {\sin ky}^{2}, 1\right)}}} \]

Alternative 4: 98.5% accurate, 0.9× speedup?

\[\begin{array}{l} l = |l|\\ Om = |Om|\\ kx = |kx|\\ ky = |ky|\\ [kx, ky] = \mathsf{sort}([kx, ky])\\ \\ \sqrt{0.5 + \frac{0.5}{\sqrt{\mathsf{fma}\left({\left(\frac{\ell}{Om} \cdot 2\right)}^{2}, {\sin kx}^{2} + {\sin ky}^{2}, 1\right)}}} \end{array} \]
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
(FPCore (l Om kx ky)
 :precision binary64
 (sqrt
  (+
   0.5
   (/
    0.5
    (sqrt
     (fma
      (pow (* (/ l Om) 2.0) 2.0)
      (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))
      1.0))))))
l = abs(l);
Om = abs(Om);
kx = abs(kx);
ky = abs(ky);
assert(kx < ky);
double code(double l, double Om, double kx, double ky) {
	return sqrt((0.5 + (0.5 / sqrt(fma(pow(((l / Om) * 2.0), 2.0), (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)), 1.0)))));
}
l = abs(l)
Om = abs(Om)
kx = abs(kx)
ky = abs(ky)
kx, ky = sort([kx, ky])
function code(l, Om, kx, ky)
	return sqrt(Float64(0.5 + Float64(0.5 / sqrt(fma((Float64(Float64(l / Om) * 2.0) ^ 2.0), Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)), 1.0)))))
end
NOTE: l should be positive before calling this function
NOTE: Om should be positive before calling this function
NOTE: kx should be positive before calling this function
NOTE: ky should be positive before calling this function
NOTE: kx and ky should be sorted in increasing order before calling this function.
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 / N[Sqrt[N[(N[Power[N[(N[(l / Om), $MachinePrecision] * 2.0), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
l = |l|\\
Om = |Om|\\
kx = |kx|\\
ky = |ky|\\
[kx, ky] = \mathsf{sort}([kx, ky])\\
\\
\sqrt{0.5 + \frac{0.5}{\sqrt{\mathsf{fma}\left({\left(\frac{\ell}{Om} \cdot 2\right)}^{2}, {\sin kx}^{2} + {\sin ky}^{2}, 1\right)}}}
\end{array}
Derivation
  1. Initial program 98.4%

    \[\sqrt{0.5 + \frac{0.5}{\sqrt{\mathsf{fma}\left({\left(\frac{\ell}{Om} \cdot 2\right)}^{2}, {\sin kx}^{2} + {\sin ky}^{2}, 1\right)}}} \]

Reproduce

?
herbie shell --seed 2023276 
(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))))))))))