Average Error: 13.7 → 0.2
Time: 1.2m
Precision: 64
\[\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 -2.7396043277771866 \cdot 10^{+21}:\\ \;\;\;\;\left(\frac{1}{\sin B \cdot \left(F \cdot F\right)} - \frac{1}{\sin B}\right) - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 31691.124748333856:\\ \;\;\;\;\frac{F \cdot {\left(x \cdot 2 + \left(2 + F \cdot F\right)\right)}^{\frac{-1}{2}}}{\sin B} - \frac{x}{\sin B} \cdot \cos B\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{\frac{1}{\sin B}}{F \cdot F}\right) - \frac{x}{\tan B}\\ \end{array}\]
\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 -2.7396043277771866 \cdot 10^{+21}:\\
\;\;\;\;\left(\frac{1}{\sin B \cdot \left(F \cdot F\right)} - \frac{1}{\sin B}\right) - \frac{x}{\tan B}\\

\mathbf{elif}\;F \le 31691.124748333856:\\
\;\;\;\;\frac{F \cdot {\left(x \cdot 2 + \left(2 + F \cdot F\right)\right)}^{\frac{-1}{2}}}{\sin B} - \frac{x}{\sin B} \cdot \cos B\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sin B} - \frac{\frac{1}{\sin B}}{F \cdot F}\right) - \frac{x}{\tan B}\\

\end{array}
double f(double F, double B, double x) {
        double r3702643 = x;
        double r3702644 = 1.0;
        double r3702645 = B;
        double r3702646 = tan(r3702645);
        double r3702647 = r3702644 / r3702646;
        double r3702648 = r3702643 * r3702647;
        double r3702649 = -r3702648;
        double r3702650 = F;
        double r3702651 = sin(r3702645);
        double r3702652 = r3702650 / r3702651;
        double r3702653 = r3702650 * r3702650;
        double r3702654 = 2.0;
        double r3702655 = r3702653 + r3702654;
        double r3702656 = r3702654 * r3702643;
        double r3702657 = r3702655 + r3702656;
        double r3702658 = r3702644 / r3702654;
        double r3702659 = -r3702658;
        double r3702660 = pow(r3702657, r3702659);
        double r3702661 = r3702652 * r3702660;
        double r3702662 = r3702649 + r3702661;
        return r3702662;
}

double f(double F, double B, double x) {
        double r3702663 = F;
        double r3702664 = -2.7396043277771866e+21;
        bool r3702665 = r3702663 <= r3702664;
        double r3702666 = 1.0;
        double r3702667 = B;
        double r3702668 = sin(r3702667);
        double r3702669 = r3702663 * r3702663;
        double r3702670 = r3702668 * r3702669;
        double r3702671 = r3702666 / r3702670;
        double r3702672 = r3702666 / r3702668;
        double r3702673 = r3702671 - r3702672;
        double r3702674 = x;
        double r3702675 = tan(r3702667);
        double r3702676 = r3702674 / r3702675;
        double r3702677 = r3702673 - r3702676;
        double r3702678 = 31691.124748333856;
        bool r3702679 = r3702663 <= r3702678;
        double r3702680 = 2.0;
        double r3702681 = r3702674 * r3702680;
        double r3702682 = r3702680 + r3702669;
        double r3702683 = r3702681 + r3702682;
        double r3702684 = -0.5;
        double r3702685 = pow(r3702683, r3702684);
        double r3702686 = r3702663 * r3702685;
        double r3702687 = r3702686 / r3702668;
        double r3702688 = r3702674 / r3702668;
        double r3702689 = cos(r3702667);
        double r3702690 = r3702688 * r3702689;
        double r3702691 = r3702687 - r3702690;
        double r3702692 = r3702672 / r3702669;
        double r3702693 = r3702672 - r3702692;
        double r3702694 = r3702693 - r3702676;
        double r3702695 = r3702679 ? r3702691 : r3702694;
        double r3702696 = r3702665 ? r3702677 : r3702695;
        return r3702696;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if F < -2.7396043277771866e+21

    1. Initial program 24.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. Simplified19.8

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

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

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

    if -2.7396043277771866e+21 < F < 31691.124748333856

    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 tan-quot0.3

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

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

    if 31691.124748333856 < F

    1. Initial program 25.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. Simplified20.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 0.1

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

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

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

Reproduce

herbie shell --seed 2019120 
(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))))))