Average Error: 13.6 → 0.4
Time: 10.8s
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 -3.159486971104873466430937838153896212471 \cdot 10^{59}:\\ \;\;\;\;\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 72554681.34259958565235137939453125:\\ \;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, \sqrt[3]{{\left({\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\right)}^{3}}, -\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 -3.159486971104873466430937838153896212471 \cdot 10^{59}:\\
\;\;\;\;\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 72554681.34259958565235137939453125:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, \sqrt[3]{{\left({\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\right)}^{3}}, -\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 r31236 = x;
        double r31237 = 1.0;
        double r31238 = B;
        double r31239 = tan(r31238);
        double r31240 = r31237 / r31239;
        double r31241 = r31236 * r31240;
        double r31242 = -r31241;
        double r31243 = F;
        double r31244 = sin(r31238);
        double r31245 = r31243 / r31244;
        double r31246 = r31243 * r31243;
        double r31247 = 2.0;
        double r31248 = r31246 + r31247;
        double r31249 = r31247 * r31236;
        double r31250 = r31248 + r31249;
        double r31251 = r31237 / r31247;
        double r31252 = -r31251;
        double r31253 = pow(r31250, r31252);
        double r31254 = r31245 * r31253;
        double r31255 = r31242 + r31254;
        return r31255;
}

double f(double F, double B, double x) {
        double r31256 = F;
        double r31257 = -3.1594869711048735e+59;
        bool r31258 = r31256 <= r31257;
        double r31259 = 1.0;
        double r31260 = x;
        double r31261 = B;
        double r31262 = sin(r31261);
        double r31263 = 2.0;
        double r31264 = pow(r31256, r31263);
        double r31265 = r31262 * r31264;
        double r31266 = r31260 / r31265;
        double r31267 = cos(r31261);
        double r31268 = r31260 * r31267;
        double r31269 = r31268 / r31262;
        double r31270 = 1.0;
        double r31271 = r31270 / r31262;
        double r31272 = fma(r31259, r31269, r31271);
        double r31273 = -r31272;
        double r31274 = fma(r31259, r31266, r31273);
        double r31275 = 72554681.34259959;
        bool r31276 = r31256 <= r31275;
        double r31277 = r31256 / r31262;
        double r31278 = r31256 * r31256;
        double r31279 = 2.0;
        double r31280 = r31278 + r31279;
        double r31281 = r31279 * r31260;
        double r31282 = r31280 + r31281;
        double r31283 = r31259 / r31279;
        double r31284 = -r31283;
        double r31285 = pow(r31282, r31284);
        double r31286 = 3.0;
        double r31287 = pow(r31285, r31286);
        double r31288 = cbrt(r31287);
        double r31289 = r31260 * r31259;
        double r31290 = tan(r31261);
        double r31291 = r31289 / r31290;
        double r31292 = -r31291;
        double r31293 = fma(r31277, r31288, r31292);
        double r31294 = -r31259;
        double r31295 = r31269 + r31266;
        double r31296 = fma(r31294, r31295, r31271);
        double r31297 = r31276 ? r31293 : r31296;
        double r31298 = r31258 ? r31274 : r31297;
        return r31298;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -3.1594869711048735e+59

    1. Initial program 28.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. Simplified28.0

      \[\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 -3.1594869711048735e+59 < F < 72554681.34259959

    1. Initial program 0.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. Simplified0.6

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

      \[\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 add-cbrt-cube0.5

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

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

    if 72554681.34259959 < F

    1. Initial program 25.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -3.159486971104873466430937838153896212471 \cdot 10^{59}:\\ \;\;\;\;\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 72554681.34259958565235137939453125:\\ \;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, \sqrt[3]{{\left({\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\right)}^{3}}, -\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 2019353 +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))))))