Average Error: 13.8 → 13.0
Time: 34.6s
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}\;x \le -1.1083546556239622 \cdot 10^{-05}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;(\left({\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}\right) \cdot \left(\frac{1}{\sin B} \cdot F\right) + \left(\frac{-1}{\frac{\tan B}{x}}\right))_*\\ \end{array}\]

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -1.1083546556239622e-05

    1. Initial program 11.9

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

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

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

      \[\leadsto (\left({\color{blue}{\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*} \cdot \sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}}^{\frac{-1}{2}}\right) \cdot \left(F \cdot \frac{1}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\]
    7. Applied unpow-prod-down11.7

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}}\]
    9. Simplified4.5

      \[\leadsto \color{blue}{\frac{\cos B \cdot \left(-x\right)}{\sin B}}\]

    if -1.1083546556239622e-05 < x

    1. Initial program 14.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. Simplified13.9

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

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

      \[\leadsto (\left({\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}\right) \cdot \left(F \cdot \frac{1}{\sin B}\right) + \left(\frac{\color{blue}{-1 \cdot x}}{\tan B}\right))_*\]
    7. Applied associate-/l*14.0

      \[\leadsto (\left({\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}\right) \cdot \left(F \cdot \frac{1}{\sin B}\right) + \color{blue}{\left(\frac{-1}{\frac{\tan B}{x}}\right)})_*\]
  3. Recombined 2 regimes into one program.
  4. Final simplification13.0

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

Reproduce

herbie shell --seed 2019026 +o rules:numerics
(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))))))