Average Error: 13.4 → 0.9
Time: 1.5m
Precision: 64
Internal Precision: 384
\[\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}\;\frac{1}{F} \le -3.94548205725522 \cdot 10^{-09}:\\ \;\;\;\;(\left({\left((x \cdot 2 + \left((F \cdot F + 2)_*\right))_*\right)}^{\left(-\frac{1}{2}\right)}\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\sin B} \cdot \cos B\right))_*\\ \mathbf{if}\;\frac{1}{F} \le -9.880484796742745 \cdot 10^{-292}:\\ \;\;\;\;\frac{1}{F} \cdot \frac{\frac{1}{F}}{\sin B} - \left(\frac{1}{\sin B} + \frac{x}{\tan B}\right)\\ \mathbf{if}\;\frac{1}{F} \le 5.81140079924632 \cdot 10^{-43}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{x}{\tan B}\right) - \frac{\frac{1}{F}}{\sin B \cdot F}\\ \mathbf{else}:\\ \;\;\;\;(\left({\left((x \cdot 2 + \left((F \cdot F + 2)_*\right))_*\right)}^{\left(-\frac{1}{2}\right)}\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\sin B} \cdot \cos B\right))_*\\ \end{array}\]

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if (/ 1 F) < -3.94548205725522e-09 or 5.81140079924632e-43 < (/ 1 F)

    1. Initial program 0.5

      \[\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. Applied simplify0.4

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

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

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

    if -3.94548205725522e-09 < (/ 1 F) < -9.880484796742745e-292

    1. Initial program 23.2

      \[\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. Taylor expanded around -inf 11.7

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

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

    if -9.880484796742745e-292 < (/ 1 F) < 5.81140079924632e-43

    1. Initial program 28.8

      \[\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. Taylor expanded around inf 16.5

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\left(\frac{1}{F} - \frac{1}{{F}^{3}}\right)}\]
    3. Applied simplify2.5

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

Runtime

Time bar (total: 1.5m)Debug logProfile

herbie shell --seed '#(1070864556 424010669 783715395 1203517814 4070606583 4107618214)' +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))))))