Average Error: 13.5 → 0.2
Time: 13.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 -4.5387025600841076 \cdot 10^{39}:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \left(1 \cdot \frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right)\\ \mathbf{elif}\;F \le 2.9297323268839495 \cdot 10^{129}:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + F \cdot \frac{1}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \left(\frac{1}{\sin B} - 1 \cdot \frac{1}{\sin B \cdot {F}^{2}}\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 -4.5387025600841076 \cdot 10^{39}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \left(1 \cdot \frac{1}{\sin B \cdot {F}^{2}} - \frac{1}{\sin B}\right)\\

\mathbf{elif}\;F \le 2.9297323268839495 \cdot 10^{129}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + F \cdot \frac{1}{\sin B \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{1}{2}\right)}}\\

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

\end{array}
double f(double F, double B, double x) {
        double r53207 = x;
        double r53208 = 1.0;
        double r53209 = B;
        double r53210 = tan(r53209);
        double r53211 = r53208 / r53210;
        double r53212 = r53207 * r53211;
        double r53213 = -r53212;
        double r53214 = F;
        double r53215 = sin(r53209);
        double r53216 = r53214 / r53215;
        double r53217 = r53214 * r53214;
        double r53218 = 2.0;
        double r53219 = r53217 + r53218;
        double r53220 = r53218 * r53207;
        double r53221 = r53219 + r53220;
        double r53222 = r53208 / r53218;
        double r53223 = -r53222;
        double r53224 = pow(r53221, r53223);
        double r53225 = r53216 * r53224;
        double r53226 = r53213 + r53225;
        return r53226;
}

double f(double F, double B, double x) {
        double r53227 = F;
        double r53228 = -4.5387025600841076e+39;
        bool r53229 = r53227 <= r53228;
        double r53230 = x;
        double r53231 = 1.0;
        double r53232 = r53230 * r53231;
        double r53233 = B;
        double r53234 = tan(r53233);
        double r53235 = r53232 / r53234;
        double r53236 = -r53235;
        double r53237 = 1.0;
        double r53238 = sin(r53233);
        double r53239 = 2.0;
        double r53240 = pow(r53227, r53239);
        double r53241 = r53238 * r53240;
        double r53242 = r53237 / r53241;
        double r53243 = r53231 * r53242;
        double r53244 = r53237 / r53238;
        double r53245 = r53243 - r53244;
        double r53246 = r53236 + r53245;
        double r53247 = 2.9297323268839495e+129;
        bool r53248 = r53227 <= r53247;
        double r53249 = r53227 * r53227;
        double r53250 = 2.0;
        double r53251 = r53249 + r53250;
        double r53252 = r53250 * r53230;
        double r53253 = r53251 + r53252;
        double r53254 = r53231 / r53250;
        double r53255 = pow(r53253, r53254);
        double r53256 = r53238 * r53255;
        double r53257 = r53237 / r53256;
        double r53258 = r53227 * r53257;
        double r53259 = r53236 + r53258;
        double r53260 = r53244 - r53243;
        double r53261 = r53236 + r53260;
        double r53262 = r53248 ? r53259 : r53261;
        double r53263 = r53229 ? r53246 : r53262;
        return r53263;
}

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 < -4.5387025600841076e+39

    1. Initial program 27.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. Using strategy rm
    3. Applied div-inv27.9

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(F \cdot \frac{1}{\sin B}\right)} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    4. Applied associate-*l*22.4

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + F \cdot \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}}\]
    6. Using strategy rm
    7. Applied associate-*r/22.4

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

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

    if -4.5387025600841076e+39 < F < 2.9297323268839495e+129

    1. Initial program 1.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. Using strategy rm
    3. Applied div-inv1.2

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(F \cdot \frac{1}{\sin B}\right)} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    4. Applied associate-*l*0.4

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + F \cdot \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}}\]
    6. Using strategy rm
    7. Applied associate-*r/0.3

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + F \cdot \frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}\]
    8. Using strategy rm
    9. Applied pow-neg0.3

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

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

    if 2.9297323268839495e+129 < F

    1. Initial program 37.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. Using strategy rm
    3. Applied div-inv37.8

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(F \cdot \frac{1}{\sin B}\right)} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
    4. Applied associate-*l*31.0

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + F \cdot \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}}\]
    6. Using strategy rm
    7. Applied associate-*r/31.0

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

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

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

Reproduce

herbie shell --seed 2020024 +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))))))