Average Error: 13.9 → 0.3
Time: 5.2min
Precision: binary64
Cost: 20802
\[\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 -1.7345000061794282 \cdot 10^{+23}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 458314.3485299576:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{F \cdot F + 2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \left(\frac{x}{F \cdot F} + \frac{1}{F \cdot F}\right)}{\sin B} - \frac{x}{\tan 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 -1.7345000061794282 \cdot 10^{+23}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq 458314.3485299576:\\
\;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{F \cdot F + 2}} - \frac{x}{\tan B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - \left(\frac{x}{F \cdot F} + \frac{1}{F \cdot F}\right)}{\sin B} - \frac{x}{\tan 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 -1.7345000061794282e+23)
   (- (/ -1.0 (sin B)) (/ x (tan B)))
   (if (<= F 458314.3485299576)
     (- (* (/ F (sin B)) (sqrt (/ 1.0 (+ (* F F) 2.0)))) (/ x (tan B)))
     (- (/ (- 1.0 (+ (/ x (* F F)) (/ 1.0 (* F F)))) (sin B)) (/ x (tan B))))))
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 tmp;
	if (F <= -1.7345000061794282e+23) {
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	} else if (F <= 458314.3485299576) {
		tmp = ((F / sin(B)) * sqrt(1.0 / ((F * F) + 2.0))) - (x / tan(B));
	} else {
		tmp = ((1.0 - ((x / (F * F)) + (1.0 / (F * F)))) / sin(B)) - (x / tan(B));
	}
	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

Alternatives

Alternative 1
Error0.2
Cost20802
\[\begin{array}{l} \mathbf{if}\;F \leq -129820715864368.95:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 458314.3485299576:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{F \cdot F + 2}}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \left(\frac{x}{F \cdot F} + \frac{1}{F \cdot F}\right)}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]
Alternative 2
Error4.9
Cost14979
\[\begin{array}{l} \mathbf{if}\;F \leq -848392.7563719586:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -7.932951086476523 \cdot 10^{-81}:\\ \;\;\;\;\frac{F \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5}}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 560.3737196529521:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \left(\frac{x}{F \cdot F} + \frac{1}{F \cdot F}\right)}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]
Alternative 3
Error5.0
Cost14915
\[\begin{array}{l} \mathbf{if}\;F \leq -4645.146492727445:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -8.149321183500055 \cdot 10^{-84}:\\ \;\;\;\;\frac{F \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5}}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 469799.4013418561:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]
Alternative 4
Error7.5
Cost15236
\[\begin{array}{l} \mathbf{if}\;F \leq -1.7345000061794282 \cdot 10^{+23}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -2.552488465105514 \cdot 10^{-238}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.1982040141203165 \cdot 10^{-110}:\\ \;\;\;\;\frac{x}{-\sin B} \cdot \cos B\\ \mathbf{elif}\;F \leq 0.4800257531838484:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]
Alternative 5
Error7.4
Cost15236
\[\begin{array}{l} \mathbf{if}\;F \leq -203633.2232100348:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.0689241364748001 \cdot 10^{-237}:\\ \;\;\;\;\frac{F \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5}}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.2638668393559438 \cdot 10^{-110}:\\ \;\;\;\;\frac{x}{-\sin B} \cdot \cos B\\ \mathbf{elif}\;F \leq 0.4800257531838484:\\ \;\;\;\;\frac{F \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5}}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]
Alternative 6
Error10.9
Cost13890
\[\begin{array}{l} \mathbf{if}\;F \leq -2.1857821194708164 \cdot 10^{-80}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.8963945120059034 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{-\sin B} \cdot \cos B\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]
Alternative 7
Error15.5
Cost13826
\[\begin{array}{l} \mathbf{if}\;F \leq -2.1857821194708164 \cdot 10^{-80}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 16.889853377425982:\\ \;\;\;\;\frac{x}{-\sin B} \cdot \cos B\\ \mathbf{elif}\;F \leq 4.7101697855186315 \cdot 10^{+135}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array}\]
Alternative 8
Error25.0
Cost13505
\[\begin{array}{l} \mathbf{if}\;F \leq 11.659649337890587:\\ \;\;\;\;\frac{x}{-\sin B} \cdot \cos B\\ \mathbf{elif}\;F \leq 6.737354207850628 \cdot 10^{+135}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array}\]
Alternative 9
Error32.6
Cost8460
\[\begin{array}{l} \mathbf{if}\;F \leq -1.6375294095987955 \cdot 10^{-166}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -3.289141569193918 \cdot 10^{-241}:\\ \;\;\;\;-\frac{x}{B}\\ \mathbf{elif}\;F \leq 4.544496888397481 \cdot 10^{-280}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.1079463367285392 \cdot 10^{-185}:\\ \;\;\;\;-\frac{x}{B}\\ \mathbf{elif}\;F \leq 283783.38273218885 \lor \neg \left(F \leq 4.502361933676628 \cdot 10^{+137}\right):\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array}\]
Alternative 10
Error39.7
Cost7169
\[\begin{array}{l} \mathbf{if}\;F \leq 1.7163339963652113 \cdot 10^{-130}:\\ \;\;\;\;-\frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array}\]
Alternative 11
Error42.5
Cost6913
\[\begin{array}{l} \mathbf{if}\;F \leq 3.2549820013808687 \cdot 10^{-130}:\\ \;\;\;\;-\frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array}\]
Alternative 12
Error44.6
Cost641
\[\begin{array}{l} \mathbf{if}\;F \leq 4.165783766895228 \cdot 10^{-87}:\\ \;\;\;\;-\frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array}\]
Alternative 13
Error47.3
Cost577
\[\begin{array}{l} \mathbf{if}\;F \leq 5.841025508043288 \cdot 10^{-87}:\\ \;\;\;\;-\frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array}\]
Alternative 14
Error56.4
Cost513
\[\begin{array}{l} \mathbf{if}\;F \leq 2.855296916216521 \cdot 10^{-127}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array}\]
Alternative 15
Error61.0
Cost64
\[1\]

Error

Time

Derivation

  1. Split input into 3 regimes
  2. if F < -1.73450000617942817e23

    1. Initial program 26.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. Simplified26.4

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

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B}\]
    4. Simplified0.2

      \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{\tan B}}\]

    if -1.73450000617942817e23 < F < 458314.34852995758

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

      \[\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 0 0.4

      \[\leadsto \frac{F}{\sin B} \cdot \color{blue}{\sqrt{\frac{1}{{F}^{2} + 2}}} - \frac{x}{\tan B}\]
    4. Simplified0.4

      \[\leadsto \frac{F}{\sin B} \cdot \color{blue}{\sqrt{\frac{1}{F \cdot F + 2}}} - \frac{x}{\tan B}\]
    5. Simplified0.4

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{F \cdot F + 2}} - \frac{x}{\tan B}}\]

    if 458314.34852995758 < F

    1. Initial program 25.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. Simplified25.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 associate-*l/_binary6419.9

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.7345000061794282 \cdot 10^{+23}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 458314.3485299576:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{F \cdot F + 2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \left(\frac{x}{F \cdot F} + \frac{1}{F \cdot F}\right)}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]

Reproduce

herbie shell --seed 2021065 
(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))))))