Average Error: 1.0 → 0.4
Time: 16.4s
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} t_0 := {\sin kx}^{2}\\ t_1 := {\sin ky}^{2}\\ t_2 := t_0 + t_1\\ t_3 := {\left(\frac{2 \cdot \ell}{Om}\right)}^{2}\\ \mathbf{if}\;t_3 \leq 2.145001788284356 \cdot 10^{+238}:\\ \;\;\;\;\begin{array}{l} t_4 := \sqrt[3]{\sqrt{1 + t_3 \cdot t_2}}\\ \sqrt{0.5 + \frac{0.5}{t_4 \cdot \left(t_4 \cdot t_4\right)}} \end{array}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 + \frac{0.5}{\ell \cdot \left(-2 \cdot \left(\frac{1}{Om} \cdot \sqrt{t_2}\right)\right) + 0.5 \cdot \frac{\sqrt{\frac{1}{\frac{4}{Om} \cdot \left(\frac{t_1}{Om} + \frac{t_0}{Om}\right)}}}{\ell}}}\\ \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}
t_0 := {\sin kx}^{2}\\
t_1 := {\sin ky}^{2}\\
t_2 := t_0 + t_1\\
t_3 := {\left(\frac{2 \cdot \ell}{Om}\right)}^{2}\\
\mathbf{if}\;t_3 \leq 2.145001788284356 \cdot 10^{+238}:\\
\;\;\;\;\begin{array}{l}
t_4 := \sqrt[3]{\sqrt{1 + t_3 \cdot t_2}}\\
\sqrt{0.5 + \frac{0.5}{t_4 \cdot \left(t_4 \cdot t_4\right)}}
\end{array}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{\ell \cdot \left(-2 \cdot \left(\frac{1}{Om} \cdot \sqrt{t_2}\right)\right) + 0.5 \cdot \frac{\sqrt{\frac{1}{\frac{4}{Om} \cdot \left(\frac{t_1}{Om} + \frac{t_0}{Om}\right)}}}{\ell}}}\\


\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
 (let* ((t_0 (pow (sin kx) 2.0))
        (t_1 (pow (sin ky) 2.0))
        (t_2 (+ t_0 t_1))
        (t_3 (pow (/ (* 2.0 l) Om) 2.0)))
   (if (<= t_3 2.145001788284356e+238)
     (let* ((t_4 (cbrt (sqrt (+ 1.0 (* t_3 t_2))))))
       (sqrt (+ 0.5 (/ 0.5 (* t_4 (* t_4 t_4))))))
     (sqrt
      (+
       0.5
       (/
        0.5
        (+
         (* l (* -2.0 (* (/ 1.0 Om) (sqrt t_2))))
         (*
          0.5
          (/ (sqrt (/ 1.0 (* (/ 4.0 Om) (+ (/ t_1 Om) (/ t_0 Om))))) l)))))))))
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 t_0 = pow(sin(kx), 2.0);
	double t_1 = pow(sin(ky), 2.0);
	double t_2 = t_0 + t_1;
	double t_3 = pow(((2.0 * l) / Om), 2.0);
	double tmp;
	if (t_3 <= 2.145001788284356e+238) {
		double t_4_1 = cbrt(sqrt(1.0 + (t_3 * t_2)));
		tmp = sqrt(0.5 + (0.5 / (t_4_1 * (t_4_1 * t_4_1))));
	} else {
		tmp = sqrt(0.5 + (0.5 / ((l * (-2.0 * ((1.0 / Om) * sqrt(t_2)))) + (0.5 * (sqrt(1.0 / ((4.0 / Om) * ((t_1 / Om) + (t_0 / Om)))) / l)))));
	}
	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) < 2.14500178828435595e238

    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-cube-cbrt_binary640.0

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

    if 2.14500178828435595e238 < (pow.f64 (/.f64 (*.f64 2 l) Om) 2)

    1. Initial program 2.9

      \[\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. Simplified2.9

      \[\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 inf 14.6

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

      \[\leadsto \sqrt{0.5 + \frac{0.5}{\color{blue}{\ell \cdot \sqrt{\frac{4}{Om} \cdot \left(\frac{{\sin ky}^{2}}{Om} + \frac{{\sin kx}^{2}}{Om}\right)} + 0.5 \cdot \frac{\sqrt{\frac{1}{\frac{4}{Om} \cdot \left(\frac{{\sin ky}^{2}}{Om} + \frac{{\sin kx}^{2}}{Om}\right)}}}{\ell}}}} \]
    5. Taylor expanded around -inf 1.1

      \[\leadsto \sqrt{0.5 + \frac{0.5}{\ell \cdot \color{blue}{\left(-2 \cdot \left(\frac{1}{Om} \cdot \sqrt{{\sin kx}^{2} + {\sin ky}^{2}}\right)\right)} + 0.5 \cdot \frac{\sqrt{\frac{1}{\frac{4}{Om} \cdot \left(\frac{{\sin ky}^{2}}{Om} + \frac{{\sin kx}^{2}}{Om}\right)}}}{\ell}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.4

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

Reproduce

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