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

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

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

\end{array}
double code(double F, double B, double x) {
	return (-(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))));
}
double code(double F, double B, double x) {
	double VAR;
	if ((F <= -38775297.75075261)) {
		VAR = (((1.0 * (1.0 / (sin(B) * pow(F, 2.0)))) - (1.0 / sin(B))) + -((x * 1.0) / tan(B)));
	} else {
		double VAR_1;
		if ((F <= 15208.598667716566)) {
			VAR_1 = (((pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)) / sin(B)) * F) + -((x * 1.0) / tan(B)));
		} else {
			VAR_1 = (((1.0 / sin(B)) - (1.0 * (1.0 / (sin(B) * pow(F, 2.0))))) + -((x * 1.0) / tan(B)));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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

    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. Simplified25.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/25.6

      \[\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 clear-num25.6

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

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

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

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

    if -38775297.75075261 < F < 15208.598667716566

    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. Simplified0.4

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

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

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

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

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

    if 15208.598667716566 < F

    1. Initial program 24.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. Simplified24.8

      \[\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/24.7

      \[\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 clear-num24.7

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

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

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

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

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

Reproduce

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