Average Error: 13.7 → 0.6
Time: 2.0m
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 -4.0853995695925616 \cdot 10^{+111}:\\ \;\;\;\;\frac{\frac{1}{F \cdot F} - 1}{\sin B} - \frac{x}{\sin B} \cdot \cos B\\ \mathbf{elif}\;F \le 1.5512682635884736 \cdot 10^{+35}:\\ \;\;\;\;\frac{{\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}}{\frac{\sin B}{F}} - \frac{\cos B \cdot x}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{\frac{1}{\sin B}}{F \cdot F}\right) - \frac{x}{\sin B} \cdot \cos 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 < -4.0853995695925616e+111

    1. Initial program 34.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. Simplified33.2

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

      \[\leadsto \frac{{\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}}{\color{blue}{\sin B \cdot \frac{1}{F}}} - \frac{x}{\tan B}\]
    5. Applied *-un-lft-identity33.2

      \[\leadsto \frac{\color{blue}{1 \cdot {\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}}}{\sin B \cdot \frac{1}{F}} - \frac{x}{\tan B}\]
    6. Applied times-frac28.5

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

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

      \[\leadsto \frac{1}{\sin B} \cdot \left({\left((x \cdot 2 + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}} \cdot F\right) - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}}\]
    10. Applied associate-/r/28.6

      \[\leadsto \frac{1}{\sin B} \cdot \left({\left((x \cdot 2 + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}} \cdot F\right) - \color{blue}{\frac{x}{\sin B} \cdot \cos B}\]
    11. Using strategy rm
    12. Applied associate-*l/28.6

      \[\leadsto \color{blue}{\frac{1 \cdot \left({\left((x \cdot 2 + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}} \cdot F\right)}{\sin B}} - \frac{x}{\sin B} \cdot \cos B\]
    13. Simplified28.6

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

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

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

    if -4.0853995695925616e+111 < F < 1.5512682635884736e+35

    1. Initial program 1.1

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

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

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

    if 1.5512682635884736e+35 < F

    1. Initial program 27.6

      \[\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. Simplified27.0

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

      \[\leadsto \frac{{\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}}{\color{blue}{\sin B \cdot \frac{1}{F}}} - \frac{x}{\tan B}\]
    5. Applied *-un-lft-identity27.0

      \[\leadsto \frac{\color{blue}{1 \cdot {\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}}}{\sin B \cdot \frac{1}{F}} - \frac{x}{\tan B}\]
    6. Applied times-frac21.8

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

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

      \[\leadsto \frac{1}{\sin B} \cdot \left({\left((x \cdot 2 + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}} \cdot F\right) - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}}\]
    10. Applied associate-/r/21.9

      \[\leadsto \frac{1}{\sin B} \cdot \left({\left((x \cdot 2 + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}} \cdot F\right) - \color{blue}{\frac{x}{\sin B} \cdot \cos B}\]
    11. Using strategy rm
    12. Applied associate-*l/21.9

      \[\leadsto \color{blue}{\frac{1 \cdot \left({\left((x \cdot 2 + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}} \cdot F\right)}{\sin B}} - \frac{x}{\sin B} \cdot \cos B\]
    13. Simplified21.9

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

      \[\leadsto \color{blue}{\left(\frac{1}{\sin B} - \frac{1}{{F}^{2} \cdot \sin B}\right)} - \frac{x}{\sin B} \cdot \cos B\]
    15. Simplified0.2

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

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

Reproduce

herbie shell --seed 2019094 +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))))))