Average Error: 14.2 → 0.3
Time: 33.1s
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}\;F \le -852337449331949.0:\\ \;\;\;\;\frac{\frac{x}{F}}{\sin B \cdot F} - (\left(\frac{\cos B}{\sin B}\right) \cdot x + \left(\frac{1}{\sin B}\right))_*\\ \mathbf{if}\;F \le 57778313.6592572:\\ \;\;\;\;(\left({\left(\sqrt{(F \cdot F + \left((2 \cdot x + 2)_*\right))_*}\right)}^{\left(-\frac{1}{2}\right)} \cdot {\left(\sqrt{(F \cdot F + \left((2 \cdot x + 2)_*\right))_*}\right)}^{\left(-\frac{1}{2}\right)}\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \left(\frac{x}{{F}^{2} \cdot \left(\sin B + \frac{\sin B}{F}\right)} + \left(\frac{x}{{F}^{3} \cdot \left(\sin B + \frac{\sin B}{F}\right)} + \frac{\cos B \cdot x}{\sin B}\right)\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 F < -852337449331949.0

    1. Initial program 25.7

      \[\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 simplify25.6

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

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

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

    if -852337449331949.0 < F < 57778313.6592572

    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. Applied simplify0.3

      \[\leadsto \color{blue}{(\left({\left((F \cdot F + \left((2 \cdot x + 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 add-sqr-sqrt0.3

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

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

    if 57778313.6592572 < F

    1. Initial program 26.7

      \[\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 simplify26.6

      \[\leadsto \color{blue}{(\left({\left((F \cdot F + \left((2 \cdot x + 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 expm1-log1p-u26.6

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

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

Runtime

Time bar (total: 33.1s)Debug logProfile

herbie shell --seed '#(1070227846 1561819246 480764335 4016816270 2602869839 2117310382)' +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))))))