Average Error: 1.0 → 0.2
Time: 15.6s
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 1.7807741941626171 \cdot 10^{+308}:\\ \;\;\;\;\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 + \frac{0.5}{\langle \left( \langle \left( \sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \right)_{binary64} \rangle_{posit16} \right)_{posit16} \rangle_{binary64}}}\\ \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.7807741941626171 \cdot 10^{+308}:\\
\;\;\;\;\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 + \frac{0.5}{\langle \left( \langle \left( \sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \right)_{binary64} \rangle_{posit16} \right)_{posit16} \rangle_{binary64}}}\\

\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.7807741941626171e+308)
   (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
     (/
      0.5
      (cast
       (!
        :precision
        posit16
        (cast
         (!
          :precision
          binary64
          (sqrt
           (+
            1.0
            (*
             (pow (/ (* 2.0 l) Om) 2.0)
             (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))))))

Error

Bits error versus l

Bits error versus Om

Bits error versus kx

Bits error versus ky

Derivation

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

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

    if 1.78077419416261711e308 < (pow.f64 (/.f64 (*.f64 2 l) Om) 2)

    1. Initial program 3.5

      \[\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.5

      \[\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 insert-posit160.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \leq 1.7807741941626171 \cdot 10^{+308}:\\ \;\;\;\;\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 + \frac{0.5}{\langle \left( \langle \left( \sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)} \right)_{binary64} \rangle_{posit16} \right)_{posit16} \rangle_{binary64}}}\\ \end{array}\]

Reproduce

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