Average Error: 13.2 → 0.2
Time: 40.6s
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 -141259778311901790863360:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \left(\frac{1}{\sin B \cdot {F}^{2}} + \frac{-1}{\sin B}\right)\\ \mathbf{elif}\;F \le 9401.995455885358751402236521244049072266:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\sin B} \cdot \cos B\right) + \frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\frac{1}{2}\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \left(\frac{1}{\sin B} - \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 -141259778311901790863360:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \left(\frac{1}{\sin B \cdot {F}^{2}} + \frac{-1}{\sin B}\right)\\

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

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

\end{array}
double f(double F, double B, double x) {
        double r75115 = x;
        double r75116 = 1.0;
        double r75117 = B;
        double r75118 = tan(r75117);
        double r75119 = r75116 / r75118;
        double r75120 = r75115 * r75119;
        double r75121 = -r75120;
        double r75122 = F;
        double r75123 = sin(r75117);
        double r75124 = r75122 / r75123;
        double r75125 = r75122 * r75122;
        double r75126 = 2.0;
        double r75127 = r75125 + r75126;
        double r75128 = r75126 * r75115;
        double r75129 = r75127 + r75128;
        double r75130 = r75116 / r75126;
        double r75131 = -r75130;
        double r75132 = pow(r75129, r75131);
        double r75133 = r75124 * r75132;
        double r75134 = r75121 + r75133;
        return r75134;
}

double f(double F, double B, double x) {
        double r75135 = F;
        double r75136 = -1.4125977831190179e+23;
        bool r75137 = r75135 <= r75136;
        double r75138 = x;
        double r75139 = 1.0;
        double r75140 = r75138 * r75139;
        double r75141 = B;
        double r75142 = tan(r75141);
        double r75143 = r75140 / r75142;
        double r75144 = -r75143;
        double r75145 = sin(r75141);
        double r75146 = 2.0;
        double r75147 = pow(r75135, r75146);
        double r75148 = r75145 * r75147;
        double r75149 = r75139 / r75148;
        double r75150 = -1.0;
        double r75151 = r75150 / r75145;
        double r75152 = r75149 + r75151;
        double r75153 = r75144 + r75152;
        double r75154 = 9401.995455885359;
        bool r75155 = r75135 <= r75154;
        double r75156 = r75140 / r75145;
        double r75157 = cos(r75141);
        double r75158 = r75156 * r75157;
        double r75159 = -r75158;
        double r75160 = 2.0;
        double r75161 = fma(r75135, r75135, r75160);
        double r75162 = fma(r75160, r75138, r75161);
        double r75163 = r75139 / r75160;
        double r75164 = -r75163;
        double r75165 = pow(r75162, r75164);
        double r75166 = r75145 / r75165;
        double r75167 = r75135 / r75166;
        double r75168 = r75159 + r75167;
        double r75169 = 1.0;
        double r75170 = r75169 / r75145;
        double r75171 = r75170 - r75149;
        double r75172 = r75144 + r75171;
        double r75173 = r75155 ? r75168 : r75172;
        double r75174 = r75137 ? r75153 : r75173;
        return r75174;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -1.4125977831190179e+23

    1. Initial program 25.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. Using strategy rm
    3. Applied *-un-lft-identity25.6

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

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

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

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

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

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

    if -1.4125977831190179e+23 < F < 9401.995455885359

    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. Using strategy rm
    3. Applied *-un-lft-identity0.4

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

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

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

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

    if 9401.995455885359 < F

    1. Initial program 24.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 *-un-lft-identity24.2

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

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

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

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

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

      \[\leadsto \left(-\frac{x \cdot 1}{\tan B}\right) + 1 \cdot \color{blue}{\left(\frac{1}{\sin B} - \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 -141259778311901790863360:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \left(\frac{1}{\sin B \cdot {F}^{2}} + \frac{-1}{\sin B}\right)\\ \mathbf{elif}\;F \le 9401.995455885358751402236521244049072266:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\sin B} \cdot \cos B\right) + \frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\frac{1}{2}\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \left(\frac{1}{\sin B} - \frac{1}{\sin B \cdot {F}^{2}}\right)\\ \end{array}\]

Reproduce

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