Average Error: 14.6 → 0.2
Time: 9.8s
Precision: binary64
\[\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 \leq -5.94905980657102 \cdot 10^{+100}:\\ \;\;\;\;\left(\frac{1}{\left(F \cdot F\right) \cdot \sin B} - \frac{1}{\sin B}\right) - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 46213591011832264:\\ \;\;\;\;F \cdot \frac{{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{1}{\left(F \cdot F\right) \cdot \sin B}\right) - \frac{x}{\sin B} \cdot \cos 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 \leq -5.94905980657102 \cdot 10^{+100}:\\
\;\;\;\;\left(\frac{1}{\left(F \cdot F\right) \cdot \sin B} - \frac{1}{\sin B}\right) - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq 46213591011832264:\\
\;\;\;\;F \cdot \frac{{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}\\

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

\end{array}
(FPCore (F B x)
 :precision binary64
 (+
  (- (* x (/ 1.0 (tan B))))
  (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
(FPCore (F B x)
 :precision binary64
 (if (<= F -5.94905980657102e+100)
   (- (- (/ 1.0 (* (* F F) (sin B))) (/ 1.0 (sin B))) (/ x (tan B)))
   (if (<= F 46213591011832264.0)
     (-
      (* F (/ (pow (+ (+ (* F F) 2.0) (* x 2.0)) -0.5) (sin B)))
      (/ x (tan B)))
     (-
      (- (/ 1.0 (sin B)) (/ 1.0 (* (* F F) (sin B))))
      (* (/ x (sin B)) (cos B))))))
double code(double F, double B, double x) {
	return ((double) (((double) -(((double) (x * (1.0 / ((double) tan(B))))))) + ((double) ((F / ((double) sin(B))) * ((double) pow(((double) (((double) (((double) (F * F)) + 2.0)) + ((double) (2.0 * x)))), ((double) -((1.0 / 2.0)))))))));
}
double code(double F, double B, double x) {
	double tmp;
	if ((F <= -5.94905980657102e+100)) {
		tmp = ((double) (((double) ((1.0 / ((double) (((double) (F * F)) * ((double) sin(B))))) - (1.0 / ((double) sin(B))))) - (x / ((double) tan(B)))));
	} else {
		double tmp_1;
		if ((F <= 46213591011832264.0)) {
			tmp_1 = ((double) (((double) (F * (((double) pow(((double) (((double) (((double) (F * F)) + 2.0)) + ((double) (x * 2.0)))), -0.5)) / ((double) sin(B))))) - (x / ((double) tan(B)))));
		} else {
			tmp_1 = ((double) (((double) ((1.0 / ((double) sin(B))) - (1.0 / ((double) (((double) (F * F)) * ((double) sin(B))))))) - ((double) ((x / ((double) sin(B))) * ((double) cos(B))))));
		}
		tmp = tmp_1;
	}
	return tmp;
}

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 < -5.94905980657102037e100

    1. Initial program 35.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. Simplified35.7

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

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

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

    if -5.94905980657102037e100 < F < 46213591011832264

    1. Initial program 0.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. Simplified0.7

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

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

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

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

    if 46213591011832264 < F

    1. Initial program 26.7

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.94905980657102 \cdot 10^{+100}:\\ \;\;\;\;\left(\frac{1}{\left(F \cdot F\right) \cdot \sin B} - \frac{1}{\sin B}\right) - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 46213591011832264:\\ \;\;\;\;F \cdot \frac{{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{1}{\left(F \cdot F\right) \cdot \sin B}\right) - \frac{x}{\sin B} \cdot \cos B\\ \end{array}\]

Reproduce

herbie shell --seed 2020219 
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  :precision binary64
  (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))