Average Error: 14.2 → 0.3
Time: 10.9s
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 -194810752.08731681:\\ \;\;\;\;\mathsf{fma}\left(1, \frac{x}{\sin B \cdot {F}^{2}}, -\mathsf{fma}\left(1, \frac{x \cdot \cos B}{\sin B}, \frac{1}{\sin B}\right)\right)\\ \mathbf{elif}\;F \le 1.00327624226024472 \cdot 10^{27}:\\ \;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\left(\frac{1}{2}\right)}, -\frac{x \cdot 1}{\tan B}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-1, \frac{x \cdot \cos B}{\sin B} + \frac{x}{\sin B \cdot {F}^{2}}, \frac{1}{\sin B}\right)\\ \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 -194810752.08731681:\\
\;\;\;\;\mathsf{fma}\left(1, \frac{x}{\sin B \cdot {F}^{2}}, -\mathsf{fma}\left(1, \frac{x \cdot \cos B}{\sin B}, \frac{1}{\sin B}\right)\right)\\

\mathbf{elif}\;F \le 1.00327624226024472 \cdot 10^{27}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\left(\frac{1}{2}\right)}, -\frac{x \cdot 1}{\tan B}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{x \cdot \cos B}{\sin B} + \frac{x}{\sin B \cdot {F}^{2}}, \frac{1}{\sin B}\right)\\

\end{array}
double f(double F, double B, double x) {
        double r34098 = x;
        double r34099 = 1.0;
        double r34100 = B;
        double r34101 = tan(r34100);
        double r34102 = r34099 / r34101;
        double r34103 = r34098 * r34102;
        double r34104 = -r34103;
        double r34105 = F;
        double r34106 = sin(r34100);
        double r34107 = r34105 / r34106;
        double r34108 = r34105 * r34105;
        double r34109 = 2.0;
        double r34110 = r34108 + r34109;
        double r34111 = r34109 * r34098;
        double r34112 = r34110 + r34111;
        double r34113 = r34099 / r34109;
        double r34114 = -r34113;
        double r34115 = pow(r34112, r34114);
        double r34116 = r34107 * r34115;
        double r34117 = r34104 + r34116;
        return r34117;
}

double f(double F, double B, double x) {
        double r34118 = F;
        double r34119 = -194810752.0873168;
        bool r34120 = r34118 <= r34119;
        double r34121 = 1.0;
        double r34122 = x;
        double r34123 = B;
        double r34124 = sin(r34123);
        double r34125 = 2.0;
        double r34126 = pow(r34118, r34125);
        double r34127 = r34124 * r34126;
        double r34128 = r34122 / r34127;
        double r34129 = cos(r34123);
        double r34130 = r34122 * r34129;
        double r34131 = r34130 / r34124;
        double r34132 = 1.0;
        double r34133 = r34132 / r34124;
        double r34134 = fma(r34121, r34131, r34133);
        double r34135 = -r34134;
        double r34136 = fma(r34121, r34128, r34135);
        double r34137 = 1.0032762422602447e+27;
        bool r34138 = r34118 <= r34137;
        double r34139 = r34118 / r34124;
        double r34140 = 2.0;
        double r34141 = fma(r34118, r34118, r34140);
        double r34142 = fma(r34122, r34140, r34141);
        double r34143 = r34132 / r34142;
        double r34144 = r34121 / r34140;
        double r34145 = pow(r34143, r34144);
        double r34146 = r34122 * r34121;
        double r34147 = tan(r34123);
        double r34148 = r34146 / r34147;
        double r34149 = -r34148;
        double r34150 = fma(r34139, r34145, r34149);
        double r34151 = -r34121;
        double r34152 = r34131 + r34128;
        double r34153 = fma(r34151, r34152, r34133);
        double r34154 = r34138 ? r34150 : r34153;
        double r34155 = r34120 ? r34136 : r34154;
        return r34155;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -194810752.0873168

    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. Simplified25.7

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

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

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

    if -194810752.0873168 < F < 1.0032762422602447e+27

    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. Simplified0.5

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}, -x \cdot \frac{1}{\tan B}\right)}\]
    3. Using strategy rm
    4. Applied associate-*r/0.4

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

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sin B}, {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\color{blue}{\left(-1 \cdot \frac{1}{2}\right)}}, -\frac{x \cdot 1}{\tan B}\right)\]
    7. Applied pow-unpow0.4

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

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

    if 1.0032762422602447e+27 < F

    1. Initial program 27.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. Simplified27.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -194810752.08731681:\\ \;\;\;\;\mathsf{fma}\left(1, \frac{x}{\sin B \cdot {F}^{2}}, -\mathsf{fma}\left(1, \frac{x \cdot \cos B}{\sin B}, \frac{1}{\sin B}\right)\right)\\ \mathbf{elif}\;F \le 1.00327624226024472 \cdot 10^{27}:\\ \;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{\left(\frac{1}{2}\right)}, -\frac{x \cdot 1}{\tan B}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-1, \frac{x \cdot \cos B}{\sin B} + \frac{x}{\sin B \cdot {F}^{2}}, \frac{1}{\sin B}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  :precision binary64
  (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))