Average Error: 0.9 → 0.3
Time: 12.9s
Precision: binary64
\[\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)}\]
\[\begin{array}{l} \mathbf{if}\;{\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \leq 6.582775082776307 \cdot 10^{+292}:\\ \;\;\;\;\sqrt{0.5 + \sqrt[3]{{\left(\frac{0.5}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5}\\ \end{array}\]
\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)}
\begin{array}{l}
\mathbf{if}\;{\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \leq 6.582775082776307 \cdot 10^{+292}:\\
\;\;\;\;\sqrt{0.5 + \sqrt[3]{{\left(\frac{0.5}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}^{3}}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\

\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))))))))))
(FPCore (l Om kx ky)
 :precision binary64
 (if (<= (pow (/ (* 2.0 l) Om) 2.0) 6.582775082776307e+292)
   (sqrt
    (+
     0.5
     (cbrt
      (pow
       (/
        0.5
        (sqrt
         (+
          1.0
          (*
           (pow (/ (* 2.0 l) Om) 2.0)
           (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
       3.0))))
   (sqrt 0.5)))
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)))))));
}
double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (pow(((2.0 * l) / Om), 2.0) <= 6.582775082776307e+292) {
		tmp = sqrt(0.5 + cbrt(pow((0.5 / sqrt(1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))), 3.0)));
	} else {
		tmp = sqrt(0.5);
	}
	return tmp;
}

Error

Bits error versus l

Bits error versus Om

Bits error versus kx

Bits error versus ky

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (pow.f64 (/.f64 (*.f64 2 l) Om) 2) < 6.5827750827763074e292

    1. Initial program 0.0

      \[\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)}\]
    2. Simplified0.0

      \[\leadsto \color{blue}{\sqrt{0.5 + \frac{0.5}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube_binary640.0

      \[\leadsto \sqrt{0.5 + \color{blue}{\sqrt[3]{\left(\frac{0.5}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}} \cdot \frac{0.5}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right) \cdot \frac{0.5}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}}\]
    5. Simplified0.0

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

    if 6.5827750827763074e292 < (pow.f64 (/.f64 (*.f64 2 l) Om) 2)

    1. Initial program 3.1

      \[\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)}\]
    2. Simplified3.1

      \[\leadsto \color{blue}{\sqrt{0.5 + \frac{0.5}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}}}\]
    3. Taylor expanded around 0 0.9

      \[\leadsto \sqrt{0.5 + \color{blue}{0}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \leq 6.582775082776307 \cdot 10^{+292}:\\ \;\;\;\;\sqrt{0.5 + \sqrt[3]{{\left(\frac{0.5}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5}\\ \end{array}\]

Reproduce

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