Average Error: 13.1 → 0.2
Time: 1.6m
Precision: 64
Internal Precision: 128
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
\[\begin{array}{l} \mathbf{if}\;F \le -47423.13907127136:\\ \;\;\;\;\frac{\frac{1}{F \cdot F} - 1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 54541.36232736842:\\ \;\;\;\;\left(F \cdot \frac{1}{\sin B}\right) \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\frac{-1}{2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{1}{F \cdot F}}{\sin B} - \frac{x \cdot \cos B}{\sin B}\\ \end{array}\]

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -47423.13907127136

    1. Initial program 24.0

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    2. Simplified18.7

      \[\leadsto \color{blue}{\frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\tan B}}\]
    3. Taylor expanded around -inf 0.1

      \[\leadsto \frac{\color{blue}{\frac{1}{{F}^{2}} - 1}}{\sin B} - \frac{x}{\tan B}\]
    4. Simplified0.1

      \[\leadsto \frac{\color{blue}{\frac{1}{F \cdot F} - 1}}{\sin B} - \frac{x}{\tan B}\]

    if -47423.13907127136 < F < 54541.36232736842

    1. Initial program 0.4

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    2. Simplified0.3

      \[\leadsto \color{blue}{\frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\tan B}}\]
    3. Using strategy rm
    4. Applied div-inv0.3

      \[\leadsto \color{blue}{\left({\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F\right) \cdot \frac{1}{\sin B}} - \frac{x}{\tan B}\]
    5. Using strategy rm
    6. Applied associate-*l*0.3

      \[\leadsto \color{blue}{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot \left(F \cdot \frac{1}{\sin B}\right)} - \frac{x}{\tan B}\]

    if 54541.36232736842 < F

    1. Initial program 24.0

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    2. Simplified18.4

      \[\leadsto \color{blue}{\frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \frac{x}{\tan B}}\]
    3. Taylor expanded around -inf 18.5

      \[\leadsto \frac{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F}{\sin B} - \color{blue}{\frac{x \cdot \cos B}{\sin B}}\]
    4. Taylor expanded around inf 0.2

      \[\leadsto \frac{\color{blue}{1 - \frac{1}{{F}^{2}}}}{\sin B} - \frac{x \cdot \cos B}{\sin B}\]
    5. Simplified0.2

      \[\leadsto \frac{\color{blue}{1 - \frac{1}{F \cdot F}}}{\sin B} - \frac{x \cdot \cos B}{\sin B}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -47423.13907127136:\\ \;\;\;\;\frac{\frac{1}{F \cdot F} - 1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 54541.36232736842:\\ \;\;\;\;\left(F \cdot \frac{1}{\sin B}\right) \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\frac{-1}{2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{1}{F \cdot F}}{\sin B} - \frac{x \cdot \cos B}{\sin B}\\ \end{array}\]

Reproduce

herbie shell --seed 2019090 
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))