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

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

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

\end{array}
double f(double F, double B, double x) {
        double r44024 = x;
        double r44025 = 1.0;
        double r44026 = B;
        double r44027 = tan(r44026);
        double r44028 = r44025 / r44027;
        double r44029 = r44024 * r44028;
        double r44030 = -r44029;
        double r44031 = F;
        double r44032 = sin(r44026);
        double r44033 = r44031 / r44032;
        double r44034 = r44031 * r44031;
        double r44035 = 2.0;
        double r44036 = r44034 + r44035;
        double r44037 = r44035 * r44024;
        double r44038 = r44036 + r44037;
        double r44039 = r44025 / r44035;
        double r44040 = -r44039;
        double r44041 = pow(r44038, r44040);
        double r44042 = r44033 * r44041;
        double r44043 = r44030 + r44042;
        return r44043;
}

double f(double F, double B, double x) {
        double r44044 = F;
        double r44045 = -1.4107304062639678e+64;
        bool r44046 = r44044 <= r44045;
        double r44047 = x;
        double r44048 = 1.0;
        double r44049 = r44047 * r44048;
        double r44050 = B;
        double r44051 = tan(r44050);
        double r44052 = r44049 / r44051;
        double r44053 = -r44052;
        double r44054 = 1.0;
        double r44055 = -1.0;
        double r44056 = pow(r44055, r44048);
        double r44057 = pow(r44044, r44048);
        double r44058 = r44056 * r44057;
        double r44059 = r44054 / r44058;
        double r44060 = pow(r44059, r44048);
        double r44061 = r44055 / r44044;
        double r44062 = -1.0;
        double r44063 = pow(r44061, r44062);
        double r44064 = fma(r44060, r44048, r44063);
        double r44065 = r44044 / r44064;
        double r44066 = sin(r44050);
        double r44067 = r44065 / r44066;
        double r44068 = r44053 + r44067;
        double r44069 = 13344.600319091158;
        bool r44070 = r44044 <= r44069;
        double r44071 = r44049 / r44066;
        double r44072 = cos(r44050);
        double r44073 = r44071 * r44072;
        double r44074 = -r44073;
        double r44075 = r44044 * r44044;
        double r44076 = 2.0;
        double r44077 = r44075 + r44076;
        double r44078 = r44076 * r44047;
        double r44079 = r44077 + r44078;
        double r44080 = r44048 / r44076;
        double r44081 = -r44080;
        double r44082 = pow(r44079, r44081);
        double r44083 = r44044 * r44082;
        double r44084 = r44083 / r44066;
        double r44085 = r44074 + r44084;
        double r44086 = r44048 / r44044;
        double r44087 = r44086 / r44044;
        double r44088 = r44054 - r44087;
        double r44089 = r44088 / r44066;
        double r44090 = r44053 + r44089;
        double r44091 = r44070 ? r44085 : r44090;
        double r44092 = r44046 ? r44068 : r44091;
        return r44092;
}

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if F < -1.4107304062639678e+64

    1. Initial program 28.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 associate-*l/22.6

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

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

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

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

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

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

    if -1.4107304062639678e+64 < F < 13344.600319091158

    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. Using strategy rm
    3. Applied associate-*l/0.4

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

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

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

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

    if 13344.600319091158 < F

    1. Initial program 25.1

      \[\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 associate-*l/19.6

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

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

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

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

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

Reproduce

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