Average Error: 1.1 → 0.3
Time: 5.1min
Precision: binary64
Cost: 79809
\[\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 1.8079115660273032 \cdot 10^{+264}:\\ \;\;\;\;\sqrt{0.5 + \log \left(e^{\frac{0.5}{\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 \cdot \left(1 + \frac{1}{\frac{\sqrt{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}{Om} + 0.5 \cdot \left(Om \cdot \sqrt{\frac{1}{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}\right)}\right)}\\ \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 1.8079115660273032 \cdot 10^{+264}:\\
\;\;\;\;\sqrt{0.5 + \log \left(e^{\frac{0.5}{\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 \cdot \left(1 + \frac{1}{\frac{\sqrt{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}{Om} + 0.5 \cdot \left(Om \cdot \sqrt{\frac{1}{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}\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))))))))))
(FPCore (l Om kx ky)
 :precision binary64
 (if (<= (pow (/ (* 2.0 l) Om) 2.0) 1.8079115660273032e+264)
   (sqrt
    (+
     0.5
     (log
      (exp
       (/
        0.5
        (sqrt
         (+
          1.0
          (*
           (pow (/ (* 2.0 l) Om) 2.0)
           (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))
   (sqrt
    (*
     0.5
     (+
      1.0
      (/
       1.0
       (+
        (/
         (sqrt (* 4.0 (* l (* l (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
         Om)
        (*
         0.5
         (*
          Om
          (sqrt
           (/
            1.0
            (*
             4.0
             (* l (* l (+ (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)))))));
}
double code(double l, double Om, double kx, double ky) {
	double tmp;
	if (pow(((2.0 * l) / Om), 2.0) <= 1.8079115660273032e+264) {
		tmp = sqrt(0.5 + log(exp(0.5 / sqrt(1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))));
	} else {
		tmp = sqrt(0.5 * (1.0 + (1.0 / ((sqrt(4.0 * (l * (l * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))) / Om) + (0.5 * (Om * sqrt(1.0 / (4.0 * (l * (l * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0))))))))))));
	}
	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

Alternatives

Alternative 1
Error0.5
Cost112513
\[\begin{array}{l} \mathbf{if}\;\frac{2 \cdot \ell}{Om} \leq -4.5054868222471203 \cdot 10^{+229}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\frac{\sqrt{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}{Om} + 0.5 \cdot \left(Om \cdot \sqrt{\frac{1}{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{2 \cdot \ell}{Om} \cdot \left(\sqrt[3]{\frac{2 \cdot \ell}{Om} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \left(\sqrt[3]{\frac{2 \cdot \ell}{Om} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \cdot \sqrt[3]{\frac{2 \cdot \ell}{Om} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}\right)\right)}}\right)}\\ \end{array}\]
Alternative 2
Error0.8
Cost39872
\[\sqrt{0.5 + \frac{0.5}{\sqrt{1 + \frac{2 \cdot \ell}{Om} \cdot \left(\frac{2 \cdot \ell}{Om} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)}}}\]
Alternative 3
Error1.1
Cost39744
\[\sqrt{0.5 + \frac{0.5}{\sqrt{1 + \left({\sin kx}^{2} + {\sin ky}^{2}\right) \cdot \left(4 \cdot \left(\frac{\ell}{Om} \cdot \frac{\ell}{Om}\right)\right)}}}\]
Alternative 4
Error1.6
Cost40450
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -9.755346650897043 \cdot 10^{-154}:\\ \;\;\;\;\sqrt{0.5 + \frac{0.5}{1 + 2 \cdot \left(\frac{\ell}{\frac{Om}{\ell}} \cdot \left(\frac{{\sin ky}^{2}}{Om} + \frac{{\sin kx}^{2}}{Om}\right)\right)}}\\ \mathbf{elif}\;\sin ky \leq 2.985362870515833 \cdot 10^{-102}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{2 \cdot \ell}{Om} \cdot \left(\frac{2 \cdot \ell}{Om} \cdot {\sin kx}^{2}\right)}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{2 \cdot \ell}{Om} \cdot \left(\frac{2 \cdot \ell}{Om} \cdot {\sin ky}^{2}\right)}}\right)}\\ \end{array}\]
Alternative 5
Error1.8
Cost40136
\[\begin{array}{l} \mathbf{if}\;\sin ky \leq -9.755346650897043 \cdot 10^{-154} \lor \neg \left(\sin ky \leq 2.985362870515833 \cdot 10^{-102}\right):\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{2 \cdot \ell}{Om} \cdot \left(\frac{2 \cdot \ell}{Om} \cdot {\sin ky}^{2}\right)}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{2 \cdot \ell}{Om} \cdot \left(\frac{2 \cdot \ell}{Om} \cdot {\sin kx}^{2}\right)}}\right)}\\ \end{array}\]
Alternative 6
Error4.4
Cost40136
\[\begin{array}{l} \mathbf{if}\;\sin kx \leq -2.7032954679589283 \cdot 10^{-163} \lor \neg \left(\sin kx \leq 6.972013279243029 \cdot 10^{-190}\right):\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{2 \cdot \ell}{Om} \cdot \left(\frac{2 \cdot \ell}{Om} \cdot {\sin kx}^{2}\right)}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{4 \cdot \left(\ell \cdot \left(\ell \cdot {\sin ky}^{2}\right)\right)}{Om \cdot Om}}}\right)}\\ \end{array}\]
Alternative 7
Error10.7
Cost28164
\[\begin{array}{l} \mathbf{if}\;\ell \leq -4.9196336260896123 \cdot 10^{+204}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{4 \cdot \left(\ell \cdot \left(\ell \cdot {\sin ky}^{2}\right)\right)}{Om \cdot Om}}}\right)}\\ \mathbf{elif}\;\ell \leq -1.7015588124713997 \cdot 10^{-147}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \left(\frac{{\sin kx}^{2}}{Om} \cdot \frac{4}{Om}\right) \cdot \left(\ell \cdot \ell\right)}}\right)}\\ \mathbf{elif}\;\ell \leq 1.7177684397412795 \cdot 10^{-204}:\\ \;\;\;\;1\\ \mathbf{elif}\;\ell \leq 5.230022574008346 \cdot 10^{+176}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \left(\frac{{\sin kx}^{2}}{Om} \cdot \frac{4}{Om}\right) \cdot \left(\ell \cdot \ell\right)}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{4 \cdot \left(\ell \cdot \left(\ell \cdot {\sin ky}^{2}\right)\right)}{Om \cdot Om}}}\right)}\\ \end{array}\]
Alternative 8
Error11.5
Cost27843
\[\begin{array}{l} \mathbf{if}\;\ell \leq -5.524097090692549 \cdot 10^{+204}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{4 \cdot \left(\ell \cdot \left(\ell \cdot {\sin ky}^{2}\right)\right)}{Om \cdot Om}}}\right)}\\ \mathbf{elif}\;\ell \leq -2.1004755517664194 \cdot 10^{-146}:\\ \;\;\;\;\sqrt{0.5 + \frac{0.5}{\sqrt{1 + 4 \cdot \frac{{\sin kx}^{2} \cdot \left(\ell \cdot \ell\right)}{Om \cdot Om}}}}\\ \mathbf{elif}\;\ell \leq 1.7177684397412795 \cdot 10^{-204}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 \cdot \left(1 + \frac{1}{\sqrt{1 + \frac{4 \cdot \left(\ell \cdot \left(\ell \cdot {\sin ky}^{2}\right)\right)}{Om \cdot Om}}}\right)}\\ \end{array}\]
Alternative 9
Error11.2
Cost27715
\[\begin{array}{l} \mathbf{if}\;ky \leq -2.0017555155169974 \cdot 10^{-158}:\\ \;\;\;\;\sqrt{0.5 + \frac{0.5}{\sqrt{1 + 4 \cdot \frac{{\sin ky}^{2} \cdot \left(\ell \cdot \ell\right)}{Om \cdot Om}}}}\\ \mathbf{elif}\;ky \leq 4.535938700067649 \cdot 10^{-306}:\\ \;\;\;\;1\\ \mathbf{elif}\;ky \leq 3.040136823878769 \cdot 10^{-102}:\\ \;\;\;\;\sqrt{0.5 + \frac{0.5}{\sqrt{1 + 4 \cdot \frac{{\sin kx}^{2} \cdot \left(\ell \cdot \ell\right)}{Om \cdot Om}}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{0.5 + \frac{0.5}{\sqrt{1 + 4 \cdot \frac{{\sin ky}^{2} \cdot \left(\ell \cdot \ell\right)}{Om \cdot Om}}}}\\ \end{array}\]
Alternative 10
Error13.0
Cost27080
\[\begin{array}{l} \mathbf{if}\;\ell \leq -2.8558940119130246 \cdot 10^{-146} \lor \neg \left(\ell \leq 1.7177684397412795 \cdot 10^{-204}\right):\\ \;\;\;\;\sqrt{0.5 + \frac{0.5}{\sqrt{1 + 4 \cdot \frac{{\sin kx}^{2} \cdot \left(\ell \cdot \ell\right)}{Om \cdot Om}}}}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 11
Error23.9
Cost64
\[1\]

Error

Time

Derivation

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

    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-log-exp_binary64_4580.0

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

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

    if 1.8079115660273032e264 < (pow.f64 (/.f64 (*.f64 2 l) Om) 2)

    1. Initial program 3.6

      \[\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. Using strategy rm
    3. Applied unpow2_binary64_4843.6

      \[\leadsto \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + \color{blue}{\left(\frac{2 \cdot \ell}{Om} \cdot \frac{2 \cdot \ell}{Om}\right)} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}\]
    4. Applied associate-*l*_binary64_3602.6

      \[\leadsto \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + \color{blue}{\frac{2 \cdot \ell}{Om} \cdot \left(\frac{2 \cdot \ell}{Om} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)}}}\right)}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt_binary64_4542.6

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

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

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

      \[\leadsto \color{blue}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\frac{\sqrt{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}{Om} + 0.5 \cdot \left(Om \cdot \sqrt{\frac{1}{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}\right)}\right)}}\]
  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 1.8079115660273032 \cdot 10^{+264}:\\ \;\;\;\;\sqrt{0.5 + \log \left(e^{\frac{0.5}{\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 \cdot \left(1 + \frac{1}{\frac{\sqrt{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}{Om} + 0.5 \cdot \left(Om \cdot \sqrt{\frac{1}{4 \cdot \left(\ell \cdot \left(\ell \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)\right)\right)}}\right)}\right)}\\ \end{array}\]

Reproduce

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