Average Error: 13.6 → 0.4
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 -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 r31220 = x;
        double r31221 = 1.0;
        double r31222 = B;
        double r31223 = tan(r31222);
        double r31224 = r31221 / r31223;
        double r31225 = r31220 * r31224;
        double r31226 = -r31225;
        double r31227 = F;
        double r31228 = sin(r31222);
        double r31229 = r31227 / r31228;
        double r31230 = r31227 * r31227;
        double r31231 = 2.0;
        double r31232 = r31230 + r31231;
        double r31233 = r31231 * r31220;
        double r31234 = r31232 + r31233;
        double r31235 = r31221 / r31231;
        double r31236 = -r31235;
        double r31237 = pow(r31234, r31236);
        double r31238 = r31229 * r31237;
        double r31239 = r31226 + r31238;
        return r31239;
}

double f(double F, double B, double x) {
        double r31240 = F;
        double r31241 = -3.1594869711048735e+59;
        bool r31242 = r31240 <= r31241;
        double r31243 = 1.0;
        double r31244 = x;
        double r31245 = B;
        double r31246 = sin(r31245);
        double r31247 = 2.0;
        double r31248 = pow(r31240, r31247);
        double r31249 = r31246 * r31248;
        double r31250 = r31244 / r31249;
        double r31251 = cos(r31245);
        double r31252 = r31244 * r31251;
        double r31253 = r31252 / r31246;
        double r31254 = 1.0;
        double r31255 = r31254 / r31246;
        double r31256 = fma(r31243, r31253, r31255);
        double r31257 = -r31256;
        double r31258 = fma(r31243, r31250, r31257);
        double r31259 = 72554681.34259959;
        bool r31260 = r31240 <= r31259;
        double r31261 = r31240 / r31246;
        double r31262 = r31240 * r31240;
        double r31263 = 2.0;
        double r31264 = r31262 + r31263;
        double r31265 = r31263 * r31244;
        double r31266 = r31264 + r31265;
        double r31267 = r31243 / r31263;
        double r31268 = -r31267;
        double r31269 = pow(r31266, r31268);
        double r31270 = 3.0;
        double r31271 = pow(r31269, r31270);
        double r31272 = cbrt(r31271);
        double r31273 = r31244 * r31243;
        double r31274 = tan(r31245);
        double r31275 = r31273 / r31274;
        double r31276 = -r31275;
        double r31277 = fma(r31261, r31272, r31276);
        double r31278 = -r31243;
        double r31279 = r31253 + r31250;
        double r31280 = fma(r31278, r31279, r31255);
        double r31281 = r31260 ? r31277 : r31280;
        double r31282 = r31242 ? r31258 : r31281;
        return r31282;
}

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))))))