VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.5% → 99.0%
Time: 21.2s
Alternatives: 21
Speedup: 1.5×

Specification

?
\[\begin{array}{l} \\ \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)} \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))))))
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)));
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
	return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x):
	return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x)
	return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0)))))
end
function tmp = code(F, B, x)
	tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0)));
end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\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)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 21 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 76.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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)} \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))))))
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)));
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
	return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x):
	return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x)
	return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0)))))
end
function tmp = code(F, B, x)
	tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0)));
end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\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)}
\end{array}

Alternative 1: 99.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{\sin B}\\ \mathbf{if}\;F \leq -3.15 \cdot 10^{+162}:\\ \;\;\;\;t\_0 - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ -1.0 (sin B))))
   (if (<= F -3.15e+162)
     (- t_0 (/ x (tan B)))
     (if (<= F 1.0)
       (+ (* x (/ -1.0 (tan B))) (/ F (* (sin B) (sqrt (fma F F 2.0)))))
       (- (/ x (- (tan B))) t_0)))))
double code(double F, double B, double x) {
	double t_0 = -1.0 / sin(B);
	double tmp;
	if (F <= -3.15e+162) {
		tmp = t_0 - (x / tan(B));
	} else if (F <= 1.0) {
		tmp = (x * (-1.0 / tan(B))) + (F / (sin(B) * sqrt(fma(F, F, 2.0))));
	} else {
		tmp = (x / -tan(B)) - t_0;
	}
	return tmp;
}
function code(F, B, x)
	t_0 = Float64(-1.0 / sin(B))
	tmp = 0.0
	if (F <= -3.15e+162)
		tmp = Float64(t_0 - Float64(x / tan(B)));
	elseif (F <= 1.0)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(F / Float64(sin(B) * sqrt(fma(F, F, 2.0)))));
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_0);
	end
	return tmp
end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3.15e+162], N[(t$95$0 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.0], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
\mathbf{if}\;F \leq -3.15 \cdot 10^{+162}:\\
\;\;\;\;t\_0 - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq 1:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -3.15e162

    1. Initial program 30.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.8%

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

    if -3.15e162 < F < 1

    1. Initial program 98.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/99.5%

        \[\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}} \]
      2. +-commutative99.5%

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F \cdot {\left(\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \]
      6. metadata-eval99.5%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\color{blue}{0.5}\right)}}{\sin B} \]
      7. metadata-eval99.5%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\color{blue}{-0.5}}}{\sin B} \]
      8. associate-*r/99.5%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}} \]
      9. clear-num99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + F \cdot \color{blue}{\frac{1}{\frac{\sin B}{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}}} \]
      10. un-div-inv99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}}} \]
      11. fma-define99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F + 2}\right)\right)}^{-0.5}}} \]
      12. fma-undefine99.6%

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\frac{\sin B}{{\color{blue}{\left(\mathsf{fma}\left(2, x, F \cdot F + 2\right)\right)}}^{-0.5}}} \]
      15. fma-define99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(2, x, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)\right)}^{-0.5}}} \]
    4. Applied egg-rr99.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}}} \]
    5. Taylor expanded in x around 0 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\color{blue}{\sin B \cdot \sqrt{2 + {F}^{2}}}} \]
    6. Step-by-step derivation
      1. +-commutative99.7%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B \cdot \sqrt{\color{blue}{F \cdot F} + 2}} \]
      3. fma-undefine99.7%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B \cdot \sqrt{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}} \]
    7. Simplified99.7%

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

    if 1 < F

    1. Initial program 51.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. Add Preprocessing
    3. Taylor expanded in F around -inf 47.2%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr47.3%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/33.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt13.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}} \cdot \sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}}}\right) \]
      6. sqrt-unprod51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod54.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt99.8%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.15 \cdot 10^{+162}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{\sin B}\\ t_1 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -145000000:\\ \;\;\;\;t\_0 - t\_1\\ \mathbf{elif}\;F \leq 120000000:\\ \;\;\;\;F \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B} - t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ -1.0 (sin B))) (t_1 (/ x (tan B))))
   (if (<= F -145000000.0)
     (- t_0 t_1)
     (if (<= F 120000000.0)
       (- (* F (/ (sqrt (/ 1.0 (fma F F 2.0))) (sin B))) t_1)
       (- (/ x (- (tan B))) t_0)))))
double code(double F, double B, double x) {
	double t_0 = -1.0 / sin(B);
	double t_1 = x / tan(B);
	double tmp;
	if (F <= -145000000.0) {
		tmp = t_0 - t_1;
	} else if (F <= 120000000.0) {
		tmp = (F * (sqrt((1.0 / fma(F, F, 2.0))) / sin(B))) - t_1;
	} else {
		tmp = (x / -tan(B)) - t_0;
	}
	return tmp;
}
function code(F, B, x)
	t_0 = Float64(-1.0 / sin(B))
	t_1 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -145000000.0)
		tmp = Float64(t_0 - t_1);
	elseif (F <= 120000000.0)
		tmp = Float64(Float64(F * Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) / sin(B))) - t_1);
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_0);
	end
	return tmp
end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -145000000.0], N[(t$95$0 - t$95$1), $MachinePrecision], If[LessEqual[F, 120000000.0], N[(N[(F * N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
t_1 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -145000000:\\
\;\;\;\;t\_0 - t\_1\\

\mathbf{elif}\;F \leq 120000000:\\
\;\;\;\;F \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B} - t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.45e8

    1. Initial program 60.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.8%

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

    if -1.45e8 < F < 1.2e8

    1. Initial program 99.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. Simplified99.6%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 99.6%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. associate-*l/99.6%

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity99.6%

        \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + {F}^{2}}}}}{\sin B} - \frac{x}{\tan B} \]
      3. +-commutative99.6%

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine99.6%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified99.6%

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

    if 1.2e8 < F

    1. Initial program 51.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. Add Preprocessing
    3. Taylor expanded in F around -inf 47.2%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr47.3%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/33.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt13.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}} \cdot \sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}}}\right) \]
      6. sqrt-unprod51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod54.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt99.8%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -145000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 120000000:\\ \;\;\;\;F \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{\sin B}\\ \mathbf{if}\;F \leq -1.9 \cdot 10^{+63}:\\ \;\;\;\;t\_0 - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 12500000000:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ -1.0 (sin B))))
   (if (<= F -1.9e+63)
     (- t_0 (/ x (tan B)))
     (if (<= F 12500000000.0)
       (+
        (* x (/ -1.0 (tan B)))
        (* (/ F (sin B)) (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5)))
       (- (/ x (- (tan B))) t_0)))))
double code(double F, double B, double x) {
	double t_0 = -1.0 / sin(B);
	double tmp;
	if (F <= -1.9e+63) {
		tmp = t_0 - (x / tan(B));
	} else if (F <= 12500000000.0) {
		tmp = (x * (-1.0 / tan(B))) + ((F / sin(B)) * pow(((2.0 + (F * F)) + (x * 2.0)), -0.5));
	} else {
		tmp = (x / -tan(B)) - t_0;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-1.0d0) / sin(b)
    if (f <= (-1.9d+63)) then
        tmp = t_0 - (x / tan(b))
    else if (f <= 12500000000.0d0) then
        tmp = (x * ((-1.0d0) / tan(b))) + ((f / sin(b)) * (((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0)))
    else
        tmp = (x / -tan(b)) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = -1.0 / Math.sin(B);
	double tmp;
	if (F <= -1.9e+63) {
		tmp = t_0 - (x / Math.tan(B));
	} else if (F <= 12500000000.0) {
		tmp = (x * (-1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5));
	} else {
		tmp = (x / -Math.tan(B)) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = -1.0 / math.sin(B)
	tmp = 0
	if F <= -1.9e+63:
		tmp = t_0 - (x / math.tan(B))
	elif F <= 12500000000.0:
		tmp = (x * (-1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5))
	else:
		tmp = (x / -math.tan(B)) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(-1.0 / sin(B))
	tmp = 0.0
	if (F <= -1.9e+63)
		tmp = Float64(t_0 - Float64(x / tan(B)));
	elseif (F <= 12500000000.0)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / sin(B)) * (Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5)));
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = -1.0 / sin(B);
	tmp = 0.0;
	if (F <= -1.9e+63)
		tmp = t_0 - (x / tan(B));
	elseif (F <= 12500000000.0)
		tmp = (x * (-1.0 / tan(B))) + ((F / sin(B)) * (((2.0 + (F * F)) + (x * 2.0)) ^ -0.5));
	else
		tmp = (x / -tan(B)) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.9e+63], N[(t$95$0 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 12500000000.0], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
\mathbf{if}\;F \leq -1.9 \cdot 10^{+63}:\\
\;\;\;\;t\_0 - \frac{x}{\tan B}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.9000000000000001e63

    1. Initial program 55.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.8%

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

    if -1.9000000000000001e63 < F < 1.25e10

    1. Initial program 99.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. Add Preprocessing

    if 1.25e10 < F

    1. Initial program 51.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. Add Preprocessing
    3. Taylor expanded in F around -inf 47.2%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr47.3%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/33.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt13.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}} \cdot \sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}}}\right) \]
      6. sqrt-unprod51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod54.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt99.8%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.9 \cdot 10^{+63}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 12500000000:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{\sin B}\\ \mathbf{if}\;F \leq -3900000:\\ \;\;\;\;t\_0 - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.36:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B \cdot \sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ -1.0 (sin B))))
   (if (<= F -3900000.0)
     (- t_0 (/ x (tan B)))
     (if (<= F 1.36)
       (+ (* x (/ -1.0 (tan B))) (/ F (* (sin B) (sqrt 2.0))))
       (- (/ x (- (tan B))) t_0)))))
double code(double F, double B, double x) {
	double t_0 = -1.0 / sin(B);
	double tmp;
	if (F <= -3900000.0) {
		tmp = t_0 - (x / tan(B));
	} else if (F <= 1.36) {
		tmp = (x * (-1.0 / tan(B))) + (F / (sin(B) * sqrt(2.0)));
	} else {
		tmp = (x / -tan(B)) - t_0;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-1.0d0) / sin(b)
    if (f <= (-3900000.0d0)) then
        tmp = t_0 - (x / tan(b))
    else if (f <= 1.36d0) then
        tmp = (x * ((-1.0d0) / tan(b))) + (f / (sin(b) * sqrt(2.0d0)))
    else
        tmp = (x / -tan(b)) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = -1.0 / Math.sin(B);
	double tmp;
	if (F <= -3900000.0) {
		tmp = t_0 - (x / Math.tan(B));
	} else if (F <= 1.36) {
		tmp = (x * (-1.0 / Math.tan(B))) + (F / (Math.sin(B) * Math.sqrt(2.0)));
	} else {
		tmp = (x / -Math.tan(B)) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = -1.0 / math.sin(B)
	tmp = 0
	if F <= -3900000.0:
		tmp = t_0 - (x / math.tan(B))
	elif F <= 1.36:
		tmp = (x * (-1.0 / math.tan(B))) + (F / (math.sin(B) * math.sqrt(2.0)))
	else:
		tmp = (x / -math.tan(B)) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(-1.0 / sin(B))
	tmp = 0.0
	if (F <= -3900000.0)
		tmp = Float64(t_0 - Float64(x / tan(B)));
	elseif (F <= 1.36)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(F / Float64(sin(B) * sqrt(2.0))));
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = -1.0 / sin(B);
	tmp = 0.0;
	if (F <= -3900000.0)
		tmp = t_0 - (x / tan(B));
	elseif (F <= 1.36)
		tmp = (x * (-1.0 / tan(B))) + (F / (sin(B) * sqrt(2.0)));
	else
		tmp = (x / -tan(B)) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3900000.0], N[(t$95$0 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.36], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
\mathbf{if}\;F \leq -3900000:\\
\;\;\;\;t\_0 - \frac{x}{\tan B}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -3.9e6

    1. Initial program 60.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.8%

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

    if -3.9e6 < F < 1.3600000000000001

    1. Initial program 99.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/99.5%

        \[\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}} \]
      2. +-commutative99.5%

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F \cdot {\left(\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \]
      6. metadata-eval99.5%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\color{blue}{0.5}\right)}}{\sin B} \]
      7. metadata-eval99.5%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\color{blue}{-0.5}}}{\sin B} \]
      8. associate-*r/99.5%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}} \]
      9. clear-num99.5%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + F \cdot \color{blue}{\frac{1}{\frac{\sin B}{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}}} \]
      10. un-div-inv99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}}} \]
      11. fma-define99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F + 2}\right)\right)}^{-0.5}}} \]
      12. fma-undefine99.6%

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\frac{\sin B}{{\color{blue}{\left(\mathsf{fma}\left(2, x, F \cdot F + 2\right)\right)}}^{-0.5}}} \]
      15. fma-define99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(2, x, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)\right)}^{-0.5}}} \]
    4. Applied egg-rr99.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{\frac{\sin B}{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}}} \]
    5. Taylor expanded in x around 0 99.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\color{blue}{\sin B \cdot \sqrt{2 + {F}^{2}}}} \]
    6. Step-by-step derivation
      1. +-commutative99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B \cdot \sqrt{\color{blue}{F \cdot F} + 2}} \]
      3. fma-undefine99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B \cdot \sqrt{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}} \]
    7. Simplified99.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\color{blue}{\sin B \cdot \sqrt{\mathsf{fma}\left(F, F, 2\right)}}} \]
    8. Taylor expanded in F around 0 98.0%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\color{blue}{\sin B \cdot \sqrt{2}}} \]
    9. Step-by-step derivation
      1. *-commutative98.0%

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

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

    if 1.3600000000000001 < F

    1. Initial program 51.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. Add Preprocessing
    3. Taylor expanded in F around -inf 47.2%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr47.3%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/33.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt13.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}} \cdot \sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}}}\right) \]
      6. sqrt-unprod51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod54.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt99.8%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3900000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.36:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B \cdot \sqrt{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 98.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{\sin B}\\ t_1 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -3900000:\\ \;\;\;\;t\_0 - t\_1\\ \mathbf{elif}\;F \leq 1.4:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ -1.0 (sin B))) (t_1 (/ x (tan B))))
   (if (<= F -3900000.0)
     (- t_0 t_1)
     (if (<= F 1.4)
       (- (* F (/ (sqrt 0.5) (sin B))) t_1)
       (- (/ x (- (tan B))) t_0)))))
double code(double F, double B, double x) {
	double t_0 = -1.0 / sin(B);
	double t_1 = x / tan(B);
	double tmp;
	if (F <= -3900000.0) {
		tmp = t_0 - t_1;
	} else if (F <= 1.4) {
		tmp = (F * (sqrt(0.5) / sin(B))) - t_1;
	} else {
		tmp = (x / -tan(B)) - t_0;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (-1.0d0) / sin(b)
    t_1 = x / tan(b)
    if (f <= (-3900000.0d0)) then
        tmp = t_0 - t_1
    else if (f <= 1.4d0) then
        tmp = (f * (sqrt(0.5d0) / sin(b))) - t_1
    else
        tmp = (x / -tan(b)) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = -1.0 / Math.sin(B);
	double t_1 = x / Math.tan(B);
	double tmp;
	if (F <= -3900000.0) {
		tmp = t_0 - t_1;
	} else if (F <= 1.4) {
		tmp = (F * (Math.sqrt(0.5) / Math.sin(B))) - t_1;
	} else {
		tmp = (x / -Math.tan(B)) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = -1.0 / math.sin(B)
	t_1 = x / math.tan(B)
	tmp = 0
	if F <= -3900000.0:
		tmp = t_0 - t_1
	elif F <= 1.4:
		tmp = (F * (math.sqrt(0.5) / math.sin(B))) - t_1
	else:
		tmp = (x / -math.tan(B)) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(-1.0 / sin(B))
	t_1 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -3900000.0)
		tmp = Float64(t_0 - t_1);
	elseif (F <= 1.4)
		tmp = Float64(Float64(F * Float64(sqrt(0.5) / sin(B))) - t_1);
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = -1.0 / sin(B);
	t_1 = x / tan(B);
	tmp = 0.0;
	if (F <= -3900000.0)
		tmp = t_0 - t_1;
	elseif (F <= 1.4)
		tmp = (F * (sqrt(0.5) / sin(B))) - t_1;
	else
		tmp = (x / -tan(B)) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3900000.0], N[(t$95$0 - t$95$1), $MachinePrecision], If[LessEqual[F, 1.4], N[(N[(F * N[(N[Sqrt[0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
t_1 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -3900000:\\
\;\;\;\;t\_0 - t\_1\\

\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -3.9e6

    1. Initial program 60.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.8%

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

    if -3.9e6 < F < 1.3999999999999999

    1. Initial program 99.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. Simplified99.6%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 97.9%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in x around 0 97.9%

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

    if 1.3999999999999999 < F

    1. Initial program 51.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. Add Preprocessing
    3. Taylor expanded in F around -inf 47.2%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr47.3%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse47.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/33.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt13.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}} \cdot \sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}}}\right) \]
      6. sqrt-unprod51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse51.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times56.4%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod54.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt99.8%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3900000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.4:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 92.1% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5}\\ t_1 := \frac{-1}{\sin B}\\ \mathbf{if}\;F \leq -2.7 \cdot 10^{+19}:\\ \;\;\;\;t\_1 - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -3.7 \cdot 10^{-47}:\\ \;\;\;\;\frac{F}{\sin B} \cdot t\_0 - \frac{x}{B}\\ \mathbf{elif}\;F \leq 0.9:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + t\_0 \cdot \frac{F}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_1\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5)) (t_1 (/ -1.0 (sin B))))
   (if (<= F -2.7e+19)
     (- t_1 (/ x (tan B)))
     (if (<= F -3.7e-47)
       (- (* (/ F (sin B)) t_0) (/ x B))
       (if (<= F 0.9)
         (+ (* x (/ -1.0 (tan B))) (* t_0 (/ F B)))
         (- (/ x (- (tan B))) t_1))))))
double code(double F, double B, double x) {
	double t_0 = pow(((2.0 + (F * F)) + (x * 2.0)), -0.5);
	double t_1 = -1.0 / sin(B);
	double tmp;
	if (F <= -2.7e+19) {
		tmp = t_1 - (x / tan(B));
	} else if (F <= -3.7e-47) {
		tmp = ((F / sin(B)) * t_0) - (x / B);
	} else if (F <= 0.9) {
		tmp = (x * (-1.0 / tan(B))) + (t_0 * (F / B));
	} else {
		tmp = (x / -tan(B)) - t_1;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = ((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0)
    t_1 = (-1.0d0) / sin(b)
    if (f <= (-2.7d+19)) then
        tmp = t_1 - (x / tan(b))
    else if (f <= (-3.7d-47)) then
        tmp = ((f / sin(b)) * t_0) - (x / b)
    else if (f <= 0.9d0) then
        tmp = (x * ((-1.0d0) / tan(b))) + (t_0 * (f / b))
    else
        tmp = (x / -tan(b)) - t_1
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5);
	double t_1 = -1.0 / Math.sin(B);
	double tmp;
	if (F <= -2.7e+19) {
		tmp = t_1 - (x / Math.tan(B));
	} else if (F <= -3.7e-47) {
		tmp = ((F / Math.sin(B)) * t_0) - (x / B);
	} else if (F <= 0.9) {
		tmp = (x * (-1.0 / Math.tan(B))) + (t_0 * (F / B));
	} else {
		tmp = (x / -Math.tan(B)) - t_1;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)
	t_1 = -1.0 / math.sin(B)
	tmp = 0
	if F <= -2.7e+19:
		tmp = t_1 - (x / math.tan(B))
	elif F <= -3.7e-47:
		tmp = ((F / math.sin(B)) * t_0) - (x / B)
	elif F <= 0.9:
		tmp = (x * (-1.0 / math.tan(B))) + (t_0 * (F / B))
	else:
		tmp = (x / -math.tan(B)) - t_1
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5
	t_1 = Float64(-1.0 / sin(B))
	tmp = 0.0
	if (F <= -2.7e+19)
		tmp = Float64(t_1 - Float64(x / tan(B)));
	elseif (F <= -3.7e-47)
		tmp = Float64(Float64(Float64(F / sin(B)) * t_0) - Float64(x / B));
	elseif (F <= 0.9)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(t_0 * Float64(F / B)));
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_1);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = ((2.0 + (F * F)) + (x * 2.0)) ^ -0.5;
	t_1 = -1.0 / sin(B);
	tmp = 0.0;
	if (F <= -2.7e+19)
		tmp = t_1 - (x / tan(B));
	elseif (F <= -3.7e-47)
		tmp = ((F / sin(B)) * t_0) - (x / B);
	elseif (F <= 0.9)
		tmp = (x * (-1.0 / tan(B))) + (t_0 * (F / B));
	else
		tmp = (x / -tan(B)) - t_1;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[(N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.7e+19], N[(t$95$1 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -3.7e-47], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.9], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5}\\
t_1 := \frac{-1}{\sin B}\\
\mathbf{if}\;F \leq -2.7 \cdot 10^{+19}:\\
\;\;\;\;t\_1 - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq -3.7 \cdot 10^{-47}:\\
\;\;\;\;\frac{F}{\sin B} \cdot t\_0 - \frac{x}{B}\\

\mathbf{elif}\;F \leq 0.9:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + t\_0 \cdot \frac{F}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -2.7e19

    1. Initial program 59.3%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.8%

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

    if -2.7e19 < F < -3.7e-47

    1. Initial program 99.3%

      \[\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. Add Preprocessing
    3. Taylor expanded in B around 0 90.9%

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

    if -3.7e-47 < F < 0.900000000000000022

    1. Initial program 99.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. Add Preprocessing
    3. Taylor expanded in B around 0 82.2%

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

    if 0.900000000000000022 < F

    1. Initial program 52.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 46.5%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv46.5%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr46.5%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv46.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg46.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse46.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/33.1%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt13.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}} \cdot \sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}}}\right) \]
      6. sqrt-unprod50.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/50.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse50.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod53.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt98.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr98.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.7 \cdot 10^{+19}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -3.7 \cdot 10^{-47}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 0.9:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 85.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\ t_1 := \frac{-1}{\sin B}\\ \mathbf{if}\;F \leq -1:\\ \;\;\;\;t\_1 - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -2.35 \cdot 10^{-89}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 5.4 \cdot 10^{-82}:\\ \;\;\;\;x \cdot \frac{\cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 4.5 \cdot 10^{-33}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_1\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (* (/ F (sin B)) (sqrt (/ 1.0 (+ 2.0 (* x 2.0))))))
        (t_1 (/ -1.0 (sin B))))
   (if (<= F -1.0)
     (- t_1 (/ x (tan B)))
     (if (<= F -2.35e-89)
       t_0
       (if (<= F 5.4e-82)
         (* x (/ (cos B) (- (sin B))))
         (if (<= F 4.5e-33) t_0 (- (/ x (- (tan B))) t_1)))))))
double code(double F, double B, double x) {
	double t_0 = (F / sin(B)) * sqrt((1.0 / (2.0 + (x * 2.0))));
	double t_1 = -1.0 / sin(B);
	double tmp;
	if (F <= -1.0) {
		tmp = t_1 - (x / tan(B));
	} else if (F <= -2.35e-89) {
		tmp = t_0;
	} else if (F <= 5.4e-82) {
		tmp = x * (cos(B) / -sin(B));
	} else if (F <= 4.5e-33) {
		tmp = t_0;
	} else {
		tmp = (x / -tan(B)) - t_1;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (f / sin(b)) * sqrt((1.0d0 / (2.0d0 + (x * 2.0d0))))
    t_1 = (-1.0d0) / sin(b)
    if (f <= (-1.0d0)) then
        tmp = t_1 - (x / tan(b))
    else if (f <= (-2.35d-89)) then
        tmp = t_0
    else if (f <= 5.4d-82) then
        tmp = x * (cos(b) / -sin(b))
    else if (f <= 4.5d-33) then
        tmp = t_0
    else
        tmp = (x / -tan(b)) - t_1
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = (F / Math.sin(B)) * Math.sqrt((1.0 / (2.0 + (x * 2.0))));
	double t_1 = -1.0 / Math.sin(B);
	double tmp;
	if (F <= -1.0) {
		tmp = t_1 - (x / Math.tan(B));
	} else if (F <= -2.35e-89) {
		tmp = t_0;
	} else if (F <= 5.4e-82) {
		tmp = x * (Math.cos(B) / -Math.sin(B));
	} else if (F <= 4.5e-33) {
		tmp = t_0;
	} else {
		tmp = (x / -Math.tan(B)) - t_1;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (F / math.sin(B)) * math.sqrt((1.0 / (2.0 + (x * 2.0))))
	t_1 = -1.0 / math.sin(B)
	tmp = 0
	if F <= -1.0:
		tmp = t_1 - (x / math.tan(B))
	elif F <= -2.35e-89:
		tmp = t_0
	elif F <= 5.4e-82:
		tmp = x * (math.cos(B) / -math.sin(B))
	elif F <= 4.5e-33:
		tmp = t_0
	else:
		tmp = (x / -math.tan(B)) - t_1
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(F / sin(B)) * sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0)))))
	t_1 = Float64(-1.0 / sin(B))
	tmp = 0.0
	if (F <= -1.0)
		tmp = Float64(t_1 - Float64(x / tan(B)));
	elseif (F <= -2.35e-89)
		tmp = t_0;
	elseif (F <= 5.4e-82)
		tmp = Float64(x * Float64(cos(B) / Float64(-sin(B))));
	elseif (F <= 4.5e-33)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_1);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = (F / sin(B)) * sqrt((1.0 / (2.0 + (x * 2.0))));
	t_1 = -1.0 / sin(B);
	tmp = 0.0;
	if (F <= -1.0)
		tmp = t_1 - (x / tan(B));
	elseif (F <= -2.35e-89)
		tmp = t_0;
	elseif (F <= 5.4e-82)
		tmp = x * (cos(B) / -sin(B));
	elseif (F <= 4.5e-33)
		tmp = t_0;
	else
		tmp = (x / -tan(B)) - t_1;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.0], N[(t$95$1 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -2.35e-89], t$95$0, If[LessEqual[F, 5.4e-82], N[(x * N[(N[Cos[B], $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.5e-33], t$95$0, N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\
t_1 := \frac{-1}{\sin B}\\
\mathbf{if}\;F \leq -1:\\
\;\;\;\;t\_1 - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq -2.35 \cdot 10^{-89}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 5.4 \cdot 10^{-82}:\\
\;\;\;\;x \cdot \frac{\cos B}{-\sin B}\\

\mathbf{elif}\;F \leq 4.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -1

    1. Initial program 60.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.8%

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

    if -1 < F < -2.34999999999999998e-89 or 5.4000000000000003e-82 < F < 4.49999999999999991e-33

    1. Initial program 99.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. Simplified99.4%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 96.7%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in F around inf 70.8%

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

    if -2.34999999999999998e-89 < F < 5.4000000000000003e-82

    1. Initial program 99.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. Simplified99.6%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 99.7%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in F around 0 74.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    6. Step-by-step derivation
      1. mul-1-neg74.2%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*74.2%

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in74.2%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
      4. distribute-neg-frac274.2%

        \[\leadsto x \cdot \color{blue}{\frac{\cos B}{-\sin B}} \]
    7. Simplified74.2%

      \[\leadsto \color{blue}{x \cdot \frac{\cos B}{-\sin B}} \]

    if 4.49999999999999991e-33 < F

    1. Initial program 56.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. Add Preprocessing
    3. Taylor expanded in F around -inf 48.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv48.3%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr48.3%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv48.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg48.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse48.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/36.0%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt15.4%

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

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/50.8%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse50.8%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/55.0%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse55.0%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times55.0%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval55.0%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval55.0%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times55.0%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod51.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt96.1%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr96.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -2.35 \cdot 10^{-89}:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\ \mathbf{elif}\;F \leq 5.4 \cdot 10^{-82}:\\ \;\;\;\;x \cdot \frac{\cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 4.5 \cdot 10^{-33}:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 91.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{2 + x \cdot 2}}\\ t_1 := \frac{-1}{\sin B}\\ t_2 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1:\\ \;\;\;\;t\_1 - t\_2\\ \mathbf{elif}\;F \leq -4.4 \cdot 10^{-51}:\\ \;\;\;\;\frac{F}{\sin B} \cdot t\_0\\ \mathbf{elif}\;F \leq 0.1:\\ \;\;\;\;\frac{F}{B} \cdot t\_0 - t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_1\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (sqrt (/ 1.0 (+ 2.0 (* x 2.0)))))
        (t_1 (/ -1.0 (sin B)))
        (t_2 (/ x (tan B))))
   (if (<= F -1.0)
     (- t_1 t_2)
     (if (<= F -4.4e-51)
       (* (/ F (sin B)) t_0)
       (if (<= F 0.1) (- (* (/ F B) t_0) t_2) (- (/ x (- (tan B))) t_1))))))
double code(double F, double B, double x) {
	double t_0 = sqrt((1.0 / (2.0 + (x * 2.0))));
	double t_1 = -1.0 / sin(B);
	double t_2 = x / tan(B);
	double tmp;
	if (F <= -1.0) {
		tmp = t_1 - t_2;
	} else if (F <= -4.4e-51) {
		tmp = (F / sin(B)) * t_0;
	} else if (F <= 0.1) {
		tmp = ((F / B) * t_0) - t_2;
	} else {
		tmp = (x / -tan(B)) - t_1;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = sqrt((1.0d0 / (2.0d0 + (x * 2.0d0))))
    t_1 = (-1.0d0) / sin(b)
    t_2 = x / tan(b)
    if (f <= (-1.0d0)) then
        tmp = t_1 - t_2
    else if (f <= (-4.4d-51)) then
        tmp = (f / sin(b)) * t_0
    else if (f <= 0.1d0) then
        tmp = ((f / b) * t_0) - t_2
    else
        tmp = (x / -tan(b)) - t_1
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = Math.sqrt((1.0 / (2.0 + (x * 2.0))));
	double t_1 = -1.0 / Math.sin(B);
	double t_2 = x / Math.tan(B);
	double tmp;
	if (F <= -1.0) {
		tmp = t_1 - t_2;
	} else if (F <= -4.4e-51) {
		tmp = (F / Math.sin(B)) * t_0;
	} else if (F <= 0.1) {
		tmp = ((F / B) * t_0) - t_2;
	} else {
		tmp = (x / -Math.tan(B)) - t_1;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = math.sqrt((1.0 / (2.0 + (x * 2.0))))
	t_1 = -1.0 / math.sin(B)
	t_2 = x / math.tan(B)
	tmp = 0
	if F <= -1.0:
		tmp = t_1 - t_2
	elif F <= -4.4e-51:
		tmp = (F / math.sin(B)) * t_0
	elif F <= 0.1:
		tmp = ((F / B) * t_0) - t_2
	else:
		tmp = (x / -math.tan(B)) - t_1
	return tmp
function code(F, B, x)
	t_0 = sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0))))
	t_1 = Float64(-1.0 / sin(B))
	t_2 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1.0)
		tmp = Float64(t_1 - t_2);
	elseif (F <= -4.4e-51)
		tmp = Float64(Float64(F / sin(B)) * t_0);
	elseif (F <= 0.1)
		tmp = Float64(Float64(Float64(F / B) * t_0) - t_2);
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_1);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = sqrt((1.0 / (2.0 + (x * 2.0))));
	t_1 = -1.0 / sin(B);
	t_2 = x / tan(B);
	tmp = 0.0;
	if (F <= -1.0)
		tmp = t_1 - t_2;
	elseif (F <= -4.4e-51)
		tmp = (F / sin(B)) * t_0;
	elseif (F <= 0.1)
		tmp = ((F / B) * t_0) - t_2;
	else
		tmp = (x / -tan(B)) - t_1;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.0], N[(t$95$1 - t$95$2), $MachinePrecision], If[LessEqual[F, -4.4e-51], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[F, 0.1], N[(N[(N[(F / B), $MachinePrecision] * t$95$0), $MachinePrecision] - t$95$2), $MachinePrecision], N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{2 + x \cdot 2}}\\
t_1 := \frac{-1}{\sin B}\\
t_2 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1:\\
\;\;\;\;t\_1 - t\_2\\

\mathbf{elif}\;F \leq -4.4 \cdot 10^{-51}:\\
\;\;\;\;\frac{F}{\sin B} \cdot t\_0\\

\mathbf{elif}\;F \leq 0.1:\\
\;\;\;\;\frac{F}{B} \cdot t\_0 - t\_2\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -1

    1. Initial program 60.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.8%

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

    if -1 < F < -4.4e-51

    1. Initial program 99.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. Simplified99.5%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 92.8%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in F around inf 74.3%

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

    if -4.4e-51 < F < 0.10000000000000001

    1. Initial program 99.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. Simplified99.6%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 99.2%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 81.8%

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

    if 0.10000000000000001 < F

    1. Initial program 52.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 46.5%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv46.5%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr46.5%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv46.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg46.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse46.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/33.1%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt13.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}} \cdot \sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}}}\right) \]
      6. sqrt-unprod50.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/50.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse50.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod53.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt98.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr98.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -4.4 \cdot 10^{-51}:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\ \mathbf{elif}\;F \leq 0.1:\\ \;\;\;\;\frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 92.2% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{\sin B}\\ t_1 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -2.7 \cdot 10^{+19}:\\ \;\;\;\;t\_0 - t\_1\\ \mathbf{elif}\;F \leq -8.2 \cdot 10^{-52}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 0.145:\\ \;\;\;\;\frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ -1.0 (sin B))) (t_1 (/ x (tan B))))
   (if (<= F -2.7e+19)
     (- t_0 t_1)
     (if (<= F -8.2e-52)
       (- (* (/ F (sin B)) (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5)) (/ x B))
       (if (<= F 0.145)
         (- (* (/ F B) (sqrt (/ 1.0 (+ 2.0 (* x 2.0))))) t_1)
         (- (/ x (- (tan B))) t_0))))))
double code(double F, double B, double x) {
	double t_0 = -1.0 / sin(B);
	double t_1 = x / tan(B);
	double tmp;
	if (F <= -2.7e+19) {
		tmp = t_0 - t_1;
	} else if (F <= -8.2e-52) {
		tmp = ((F / sin(B)) * pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - (x / B);
	} else if (F <= 0.145) {
		tmp = ((F / B) * sqrt((1.0 / (2.0 + (x * 2.0))))) - t_1;
	} else {
		tmp = (x / -tan(B)) - t_0;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (-1.0d0) / sin(b)
    t_1 = x / tan(b)
    if (f <= (-2.7d+19)) then
        tmp = t_0 - t_1
    else if (f <= (-8.2d-52)) then
        tmp = ((f / sin(b)) * (((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0))) - (x / b)
    else if (f <= 0.145d0) then
        tmp = ((f / b) * sqrt((1.0d0 / (2.0d0 + (x * 2.0d0))))) - t_1
    else
        tmp = (x / -tan(b)) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = -1.0 / Math.sin(B);
	double t_1 = x / Math.tan(B);
	double tmp;
	if (F <= -2.7e+19) {
		tmp = t_0 - t_1;
	} else if (F <= -8.2e-52) {
		tmp = ((F / Math.sin(B)) * Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - (x / B);
	} else if (F <= 0.145) {
		tmp = ((F / B) * Math.sqrt((1.0 / (2.0 + (x * 2.0))))) - t_1;
	} else {
		tmp = (x / -Math.tan(B)) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = -1.0 / math.sin(B)
	t_1 = x / math.tan(B)
	tmp = 0
	if F <= -2.7e+19:
		tmp = t_0 - t_1
	elif F <= -8.2e-52:
		tmp = ((F / math.sin(B)) * math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - (x / B)
	elif F <= 0.145:
		tmp = ((F / B) * math.sqrt((1.0 / (2.0 + (x * 2.0))))) - t_1
	else:
		tmp = (x / -math.tan(B)) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(-1.0 / sin(B))
	t_1 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -2.7e+19)
		tmp = Float64(t_0 - t_1);
	elseif (F <= -8.2e-52)
		tmp = Float64(Float64(Float64(F / sin(B)) * (Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5)) - Float64(x / B));
	elseif (F <= 0.145)
		tmp = Float64(Float64(Float64(F / B) * sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0))))) - t_1);
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = -1.0 / sin(B);
	t_1 = x / tan(B);
	tmp = 0.0;
	if (F <= -2.7e+19)
		tmp = t_0 - t_1;
	elseif (F <= -8.2e-52)
		tmp = ((F / sin(B)) * (((2.0 + (F * F)) + (x * 2.0)) ^ -0.5)) - (x / B);
	elseif (F <= 0.145)
		tmp = ((F / B) * sqrt((1.0 / (2.0 + (x * 2.0))))) - t_1;
	else
		tmp = (x / -tan(B)) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.7e+19], N[(t$95$0 - t$95$1), $MachinePrecision], If[LessEqual[F, -8.2e-52], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.145], N[(N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
t_1 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2.7 \cdot 10^{+19}:\\
\;\;\;\;t\_0 - t\_1\\

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

\mathbf{elif}\;F \leq 0.145:\\
\;\;\;\;\frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -2.7e19

    1. Initial program 59.3%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.8%

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

    if -2.7e19 < F < -8.19999999999999977e-52

    1. Initial program 99.3%

      \[\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. Add Preprocessing
    3. Taylor expanded in B around 0 90.9%

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

    if -8.19999999999999977e-52 < F < 0.14499999999999999

    1. Initial program 99.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. Simplified99.6%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 99.2%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 81.8%

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

    if 0.14499999999999999 < F

    1. Initial program 52.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 46.5%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv46.5%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr46.5%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv46.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg46.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse46.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/33.1%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt13.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}} \cdot \sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}}}\right) \]
      6. sqrt-unprod50.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/50.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse50.9%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times55.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod53.7%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt98.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr98.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.7 \cdot 10^{+19}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -8.2 \cdot 10^{-52}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 0.145:\\ \;\;\;\;\frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 70.1% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -5.2 \cdot 10^{+232}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.55 \cdot 10^{+24}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -2.85 \cdot 10^{-78}:\\ \;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\ \mathbf{elif}\;F \leq 0.000245:\\ \;\;\;\;x \cdot \frac{\cos B}{-\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -5.2e+232)
   (- (/ -1.0 B) (/ x (tan B)))
   (if (<= F -1.55e+24)
     (- (/ -1.0 (sin B)) (/ x B))
     (if (<= F -2.85e-78)
       (- (/ -1.0 B) (* x (/ 1.0 (tan B))))
       (if (<= F 0.000245)
         (* x (/ (cos B) (- (sin B))))
         (- (/ 1.0 (sin B)) (/ x B)))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -5.2e+232) {
		tmp = (-1.0 / B) - (x / tan(B));
	} else if (F <= -1.55e+24) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= -2.85e-78) {
		tmp = (-1.0 / B) - (x * (1.0 / tan(B)));
	} else if (F <= 0.000245) {
		tmp = x * (cos(B) / -sin(B));
	} else {
		tmp = (1.0 / sin(B)) - (x / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-5.2d+232)) then
        tmp = ((-1.0d0) / b) - (x / tan(b))
    else if (f <= (-1.55d+24)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= (-2.85d-78)) then
        tmp = ((-1.0d0) / b) - (x * (1.0d0 / tan(b)))
    else if (f <= 0.000245d0) then
        tmp = x * (cos(b) / -sin(b))
    else
        tmp = (1.0d0 / sin(b)) - (x / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -5.2e+232) {
		tmp = (-1.0 / B) - (x / Math.tan(B));
	} else if (F <= -1.55e+24) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= -2.85e-78) {
		tmp = (-1.0 / B) - (x * (1.0 / Math.tan(B)));
	} else if (F <= 0.000245) {
		tmp = x * (Math.cos(B) / -Math.sin(B));
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -5.2e+232:
		tmp = (-1.0 / B) - (x / math.tan(B))
	elif F <= -1.55e+24:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= -2.85e-78:
		tmp = (-1.0 / B) - (x * (1.0 / math.tan(B)))
	elif F <= 0.000245:
		tmp = x * (math.cos(B) / -math.sin(B))
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -5.2e+232)
		tmp = Float64(Float64(-1.0 / B) - Float64(x / tan(B)));
	elseif (F <= -1.55e+24)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= -2.85e-78)
		tmp = Float64(Float64(-1.0 / B) - Float64(x * Float64(1.0 / tan(B))));
	elseif (F <= 0.000245)
		tmp = Float64(x * Float64(cos(B) / Float64(-sin(B))));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -5.2e+232)
		tmp = (-1.0 / B) - (x / tan(B));
	elseif (F <= -1.55e+24)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= -2.85e-78)
		tmp = (-1.0 / B) - (x * (1.0 / tan(B)));
	elseif (F <= 0.000245)
		tmp = x * (cos(B) / -sin(B));
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -5.2e+232], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.55e+24], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -2.85e-78], N[(N[(-1.0 / B), $MachinePrecision] - N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.000245], N[(x * N[(N[Cos[B], $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.2 \cdot 10^{+232}:\\
\;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq -1.55 \cdot 10^{+24}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -2.85 \cdot 10^{-78}:\\
\;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\

\mathbf{elif}\;F \leq 0.000245:\\
\;\;\;\;x \cdot \frac{\cos B}{-\sin B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if F < -5.19999999999999947e232

    1. Initial program 42.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.7%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.7%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Taylor expanded in B around 0 90.5%

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

    if -5.19999999999999947e232 < F < -1.55000000000000005e24

    1. Initial program 63.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 83.9%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Step-by-step derivation
      1. +-commutative83.9%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(-\frac{x}{B}\right)} \]
      2. unsub-neg83.9%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Applied egg-rr83.9%

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

    if -1.55000000000000005e24 < F < -2.8499999999999999e-78

    1. Initial program 99.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. Add Preprocessing
    3. Taylor expanded in F around -inf 47.1%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 48.5%

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

    if -2.8499999999999999e-78 < F < 2.4499999999999999e-4

    1. Initial program 99.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. Simplified99.6%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 99.6%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in F around 0 67.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    6. Step-by-step derivation
      1. mul-1-neg67.7%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*67.7%

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in67.7%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
      4. distribute-neg-frac267.7%

        \[\leadsto x \cdot \color{blue}{\frac{\cos B}{-\sin B}} \]
    7. Simplified67.7%

      \[\leadsto \color{blue}{x \cdot \frac{\cos B}{-\sin B}} \]

    if 2.4499999999999999e-4 < F

    1. Initial program 52.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. Add Preprocessing
    3. Taylor expanded in B around 0 35.4%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{B}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification73.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.2 \cdot 10^{+232}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.55 \cdot 10^{+24}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -2.85 \cdot 10^{-78}:\\ \;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\ \mathbf{elif}\;F \leq 0.000245:\\ \;\;\;\;x \cdot \frac{\cos B}{-\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 70.2% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -6 \cdot 10^{+232}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -2.15 \cdot 10^{+24}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -3.3 \cdot 10^{-78}:\\ \;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\ \mathbf{elif}\;F \leq 0.00077:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -6e+232)
   (- (/ -1.0 B) (/ x (tan B)))
   (if (<= F -2.15e+24)
     (- (/ -1.0 (sin B)) (/ x B))
     (if (<= F -3.3e-78)
       (- (/ -1.0 B) (* x (/ 1.0 (tan B))))
       (if (<= F 0.00077)
         (/ (* x (cos B)) (- (sin B)))
         (- (/ 1.0 (sin B)) (/ x B)))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -6e+232) {
		tmp = (-1.0 / B) - (x / tan(B));
	} else if (F <= -2.15e+24) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= -3.3e-78) {
		tmp = (-1.0 / B) - (x * (1.0 / tan(B)));
	} else if (F <= 0.00077) {
		tmp = (x * cos(B)) / -sin(B);
	} else {
		tmp = (1.0 / sin(B)) - (x / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-6d+232)) then
        tmp = ((-1.0d0) / b) - (x / tan(b))
    else if (f <= (-2.15d+24)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= (-3.3d-78)) then
        tmp = ((-1.0d0) / b) - (x * (1.0d0 / tan(b)))
    else if (f <= 0.00077d0) then
        tmp = (x * cos(b)) / -sin(b)
    else
        tmp = (1.0d0 / sin(b)) - (x / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -6e+232) {
		tmp = (-1.0 / B) - (x / Math.tan(B));
	} else if (F <= -2.15e+24) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= -3.3e-78) {
		tmp = (-1.0 / B) - (x * (1.0 / Math.tan(B)));
	} else if (F <= 0.00077) {
		tmp = (x * Math.cos(B)) / -Math.sin(B);
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -6e+232:
		tmp = (-1.0 / B) - (x / math.tan(B))
	elif F <= -2.15e+24:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= -3.3e-78:
		tmp = (-1.0 / B) - (x * (1.0 / math.tan(B)))
	elif F <= 0.00077:
		tmp = (x * math.cos(B)) / -math.sin(B)
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -6e+232)
		tmp = Float64(Float64(-1.0 / B) - Float64(x / tan(B)));
	elseif (F <= -2.15e+24)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= -3.3e-78)
		tmp = Float64(Float64(-1.0 / B) - Float64(x * Float64(1.0 / tan(B))));
	elseif (F <= 0.00077)
		tmp = Float64(Float64(x * cos(B)) / Float64(-sin(B)));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -6e+232)
		tmp = (-1.0 / B) - (x / tan(B));
	elseif (F <= -2.15e+24)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= -3.3e-78)
		tmp = (-1.0 / B) - (x * (1.0 / tan(B)));
	elseif (F <= 0.00077)
		tmp = (x * cos(B)) / -sin(B);
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -6e+232], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -2.15e+24], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -3.3e-78], N[(N[(-1.0 / B), $MachinePrecision] - N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.00077], N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -6 \cdot 10^{+232}:\\
\;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq -2.15 \cdot 10^{+24}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -3.3 \cdot 10^{-78}:\\
\;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\

\mathbf{elif}\;F \leq 0.00077:\\
\;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if F < -6.00000000000000006e232

    1. Initial program 42.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv99.7%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr99.7%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Taylor expanded in B around 0 90.5%

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

    if -6.00000000000000006e232 < F < -2.14999999999999994e24

    1. Initial program 63.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 83.9%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Step-by-step derivation
      1. +-commutative83.9%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(-\frac{x}{B}\right)} \]
      2. unsub-neg83.9%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Applied egg-rr83.9%

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

    if -2.14999999999999994e24 < F < -3.29999999999999982e-78

    1. Initial program 99.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. Add Preprocessing
    3. Taylor expanded in F around -inf 47.1%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 48.5%

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

    if -3.29999999999999982e-78 < F < 7.6999999999999996e-4

    1. Initial program 99.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. Simplified99.6%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 99.6%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in F around 0 67.7%

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

    if 7.6999999999999996e-4 < F

    1. Initial program 52.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. Add Preprocessing
    3. Taylor expanded in B around 0 35.4%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{B}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification73.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -6 \cdot 10^{+232}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -2.15 \cdot 10^{+24}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -3.3 \cdot 10^{-78}:\\ \;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\ \mathbf{elif}\;F \leq 0.00077:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 84.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{\sin B}\\ \mathbf{if}\;F \leq -9.6 \cdot 10^{-29}:\\ \;\;\;\;t\_0 - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.7 \cdot 10^{-40}:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ -1.0 (sin B))))
   (if (<= F -9.6e-29)
     (- t_0 (/ x (tan B)))
     (if (<= F 4.7e-40)
       (/ (* x (cos B)) (- (sin B)))
       (- (/ x (- (tan B))) t_0)))))
double code(double F, double B, double x) {
	double t_0 = -1.0 / sin(B);
	double tmp;
	if (F <= -9.6e-29) {
		tmp = t_0 - (x / tan(B));
	} else if (F <= 4.7e-40) {
		tmp = (x * cos(B)) / -sin(B);
	} else {
		tmp = (x / -tan(B)) - t_0;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (-1.0d0) / sin(b)
    if (f <= (-9.6d-29)) then
        tmp = t_0 - (x / tan(b))
    else if (f <= 4.7d-40) then
        tmp = (x * cos(b)) / -sin(b)
    else
        tmp = (x / -tan(b)) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = -1.0 / Math.sin(B);
	double tmp;
	if (F <= -9.6e-29) {
		tmp = t_0 - (x / Math.tan(B));
	} else if (F <= 4.7e-40) {
		tmp = (x * Math.cos(B)) / -Math.sin(B);
	} else {
		tmp = (x / -Math.tan(B)) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = -1.0 / math.sin(B)
	tmp = 0
	if F <= -9.6e-29:
		tmp = t_0 - (x / math.tan(B))
	elif F <= 4.7e-40:
		tmp = (x * math.cos(B)) / -math.sin(B)
	else:
		tmp = (x / -math.tan(B)) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(-1.0 / sin(B))
	tmp = 0.0
	if (F <= -9.6e-29)
		tmp = Float64(t_0 - Float64(x / tan(B)));
	elseif (F <= 4.7e-40)
		tmp = Float64(Float64(x * cos(B)) / Float64(-sin(B)));
	else
		tmp = Float64(Float64(x / Float64(-tan(B))) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = -1.0 / sin(B);
	tmp = 0.0;
	if (F <= -9.6e-29)
		tmp = t_0 - (x / tan(B));
	elseif (F <= 4.7e-40)
		tmp = (x * cos(B)) / -sin(B);
	else
		tmp = (x / -tan(B)) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -9.6e-29], N[(t$95$0 - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.7e-40], N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], N[(N[(x / (-N[Tan[B], $MachinePrecision])), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1}{\sin B}\\
\mathbf{if}\;F \leq -9.6 \cdot 10^{-29}:\\
\;\;\;\;t\_0 - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq 4.7 \cdot 10^{-40}:\\
\;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{-\tan B} - t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -9.59999999999999968e-29

    1. Initial program 65.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 91.4%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv91.4%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr91.4%

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

    if -9.59999999999999968e-29 < F < 4.6999999999999999e-40

    1. Initial program 99.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. Simplified99.6%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 99.6%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in F around 0 65.8%

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

    if 4.6999999999999999e-40 < F

    1. Initial program 56.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. Add Preprocessing
    3. Taylor expanded in F around -inf 47.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv47.6%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr47.6%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. div-inv47.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{-1 \cdot \frac{1}{\sin B}} \]
      2. mul-1-neg47.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \color{blue}{\left(-\frac{1}{\sin B}\right)} \]
      3. rgt-mult-inverse47.6%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\frac{\color{blue}{F \cdot \frac{1}{F}}}{\sin B}\right) \]
      4. associate-*l/35.5%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{F}{\sin B} \cdot \frac{1}{F}}\right) \]
      5. add-sqr-sqrt15.2%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}} \cdot \sqrt{\frac{F}{\sin B} \cdot \frac{1}{F}}}\right) \]
      6. sqrt-unprod50.1%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\left(\frac{F}{\sin B} \cdot \frac{1}{F}\right) \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}}\right) \]
      7. associate-*l/50.1%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      8. rgt-mult-inverse50.1%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B} \cdot \left(\frac{F}{\sin B} \cdot \frac{1}{F}\right)}\right) \]
      9. associate-*l/54.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}}\right) \]
      10. rgt-mult-inverse54.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{1}{\sin B} \cdot \frac{\color{blue}{1}}{\sin B}}\right) \]
      11. frac-times54.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      12. metadata-eval54.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      13. metadata-eval54.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
      14. frac-times54.3%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\sqrt{\color{blue}{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}}\right) \]
      15. sqrt-unprod51.2%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}}\right) \]
      16. add-sqr-sqrt94.8%

        \[\leadsto \left(-\frac{x}{\tan B}\right) + \left(-\color{blue}{\frac{-1}{\sin B}}\right) \]
    7. Applied egg-rr94.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -9.6 \cdot 10^{-29}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.7 \cdot 10^{-40}:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B} - \frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 77.7% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -7.5 \cdot 10^{-30}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 0.0007:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 1.2 \cdot 10^{+177} \lor \neg \left(F \leq 2.3 \cdot 10^{+238}\right):\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -7.5e-30)
   (- (/ -1.0 (sin B)) (/ x (tan B)))
   (if (<= F 0.0007)
     (/ (* x (cos B)) (- (sin B)))
     (if (or (<= F 1.2e+177) (not (<= F 2.3e+238)))
       (- (/ 1.0 (sin B)) (/ x B))
       (- (/ 1.0 B) (* x (/ 1.0 (tan B))))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -7.5e-30) {
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	} else if (F <= 0.0007) {
		tmp = (x * cos(B)) / -sin(B);
	} else if ((F <= 1.2e+177) || !(F <= 2.3e+238)) {
		tmp = (1.0 / sin(B)) - (x / B);
	} else {
		tmp = (1.0 / B) - (x * (1.0 / tan(B)));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-7.5d-30)) then
        tmp = ((-1.0d0) / sin(b)) - (x / tan(b))
    else if (f <= 0.0007d0) then
        tmp = (x * cos(b)) / -sin(b)
    else if ((f <= 1.2d+177) .or. (.not. (f <= 2.3d+238))) then
        tmp = (1.0d0 / sin(b)) - (x / b)
    else
        tmp = (1.0d0 / b) - (x * (1.0d0 / tan(b)))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -7.5e-30) {
		tmp = (-1.0 / Math.sin(B)) - (x / Math.tan(B));
	} else if (F <= 0.0007) {
		tmp = (x * Math.cos(B)) / -Math.sin(B);
	} else if ((F <= 1.2e+177) || !(F <= 2.3e+238)) {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	} else {
		tmp = (1.0 / B) - (x * (1.0 / Math.tan(B)));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -7.5e-30:
		tmp = (-1.0 / math.sin(B)) - (x / math.tan(B))
	elif F <= 0.0007:
		tmp = (x * math.cos(B)) / -math.sin(B)
	elif (F <= 1.2e+177) or not (F <= 2.3e+238):
		tmp = (1.0 / math.sin(B)) - (x / B)
	else:
		tmp = (1.0 / B) - (x * (1.0 / math.tan(B)))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -7.5e-30)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B)));
	elseif (F <= 0.0007)
		tmp = Float64(Float64(x * cos(B)) / Float64(-sin(B)));
	elseif ((F <= 1.2e+177) || !(F <= 2.3e+238))
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / B) - Float64(x * Float64(1.0 / tan(B))));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -7.5e-30)
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	elseif (F <= 0.0007)
		tmp = (x * cos(B)) / -sin(B);
	elseif ((F <= 1.2e+177) || ~((F <= 2.3e+238)))
		tmp = (1.0 / sin(B)) - (x / B);
	else
		tmp = (1.0 / B) - (x * (1.0 / tan(B)));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -7.5e-30], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.0007], N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[Or[LessEqual[F, 1.2e+177], N[Not[LessEqual[F, 2.3e+238]], $MachinePrecision]], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.5 \cdot 10^{-30}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq 0.0007:\\
\;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\

\mathbf{elif}\;F \leq 1.2 \cdot 10^{+177} \lor \neg \left(F \leq 2.3 \cdot 10^{+238}\right):\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -7.5000000000000006e-30

    1. Initial program 65.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 91.4%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv91.4%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr91.4%

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

    if -7.5000000000000006e-30 < F < 6.99999999999999993e-4

    1. Initial program 99.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. Simplified99.6%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around 0 99.6%

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Taylor expanded in F around 0 65.9%

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

    if 6.99999999999999993e-4 < F < 1.2e177 or 2.30000000000000003e238 < F

    1. Initial program 51.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. Add Preprocessing
    3. Taylor expanded in B around 0 41.5%

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

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

    if 1.2e177 < F < 2.30000000000000003e238

    1. Initial program 56.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. Add Preprocessing
    3. Taylor expanded in F around inf 74.1%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\frac{1}{F}} \]
    4. Step-by-step derivation
      1. un-div-inv74.2%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{\frac{F}{\sin B}}{F}} \]
    5. Applied egg-rr74.2%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{\frac{F}{\sin B}}{F}} \]
    6. Taylor expanded in B around 0 89.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -7.5 \cdot 10^{-30}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 0.0007:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 1.2 \cdot 10^{+177} \lor \neg \left(F \leq 2.3 \cdot 10^{+238}\right):\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 62.3% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -5.6 \cdot 10^{+232}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq -1.1 \cdot 10^{+28}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -3.8 \cdot 10^{-193}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 0.9:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{\frac{F}{B}}{F}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (/ -1.0 B) (/ x (tan B)))))
   (if (<= F -5.6e+232)
     t_0
     (if (<= F -1.1e+28)
       (- (/ -1.0 (sin B)) (/ x B))
       (if (<= F -3.8e-193)
         t_0
         (if (<= F 0.9)
           (+ (* x (/ -1.0 (tan B))) (/ (/ F B) F))
           (- (/ 1.0 (sin B)) (/ x B))))))))
double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / tan(B));
	double tmp;
	if (F <= -5.6e+232) {
		tmp = t_0;
	} else if (F <= -1.1e+28) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= -3.8e-193) {
		tmp = t_0;
	} else if (F <= 0.9) {
		tmp = (x * (-1.0 / tan(B))) + ((F / B) / F);
	} else {
		tmp = (1.0 / sin(B)) - (x / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((-1.0d0) / b) - (x / tan(b))
    if (f <= (-5.6d+232)) then
        tmp = t_0
    else if (f <= (-1.1d+28)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= (-3.8d-193)) then
        tmp = t_0
    else if (f <= 0.9d0) then
        tmp = (x * ((-1.0d0) / tan(b))) + ((f / b) / f)
    else
        tmp = (1.0d0 / sin(b)) - (x / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / Math.tan(B));
	double tmp;
	if (F <= -5.6e+232) {
		tmp = t_0;
	} else if (F <= -1.1e+28) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= -3.8e-193) {
		tmp = t_0;
	} else if (F <= 0.9) {
		tmp = (x * (-1.0 / Math.tan(B))) + ((F / B) / F);
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (-1.0 / B) - (x / math.tan(B))
	tmp = 0
	if F <= -5.6e+232:
		tmp = t_0
	elif F <= -1.1e+28:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= -3.8e-193:
		tmp = t_0
	elif F <= 0.9:
		tmp = (x * (-1.0 / math.tan(B))) + ((F / B) / F)
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(-1.0 / B) - Float64(x / tan(B)))
	tmp = 0.0
	if (F <= -5.6e+232)
		tmp = t_0;
	elseif (F <= -1.1e+28)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= -3.8e-193)
		tmp = t_0;
	elseif (F <= 0.9)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) / F));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = (-1.0 / B) - (x / tan(B));
	tmp = 0.0;
	if (F <= -5.6e+232)
		tmp = t_0;
	elseif (F <= -1.1e+28)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= -3.8e-193)
		tmp = t_0;
	elseif (F <= 0.9)
		tmp = (x * (-1.0 / tan(B))) + ((F / B) / F);
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5.6e+232], t$95$0, If[LessEqual[F, -1.1e+28], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -3.8e-193], t$95$0, If[LessEqual[F, 0.9], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1}{B} - \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -5.6 \cdot 10^{+232}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq -1.1 \cdot 10^{+28}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -3.8 \cdot 10^{-193}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 0.9:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{\frac{F}{B}}{F}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -5.5999999999999998e232 or -1.09999999999999993e28 < F < -3.80000000000000004e-193

    1. Initial program 80.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. Add Preprocessing
    3. Taylor expanded in F around -inf 59.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv59.3%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr59.3%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Taylor expanded in B around 0 62.5%

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

    if -5.5999999999999998e232 < F < -1.09999999999999993e28

    1. Initial program 63.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 83.9%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Step-by-step derivation
      1. +-commutative83.9%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(-\frac{x}{B}\right)} \]
      2. unsub-neg83.9%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Applied egg-rr83.9%

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

    if -3.80000000000000004e-193 < F < 0.900000000000000022

    1. Initial program 99.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. Add Preprocessing
    3. Taylor expanded in F around inf 35.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\frac{1}{F}} \]
    4. Step-by-step derivation
      1. un-div-inv35.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{\frac{F}{\sin B}}{F}} \]
    5. Applied egg-rr35.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{\frac{F}{\sin B}}{F}} \]
    6. Taylor expanded in B around 0 52.2%

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

    if 0.900000000000000022 < F

    1. Initial program 52.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in B around 0 34.4%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{B}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification67.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.6 \cdot 10^{+232}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.1 \cdot 10^{+28}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -3.8 \cdot 10^{-193}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 0.9:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{\frac{F}{B}}{F}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 60.6% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{-41}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-167}:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-100}:\\ \;\;\;\;\frac{-1}{\sin B} + \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= x -1.65e-41)
   (- (/ -1.0 B) (/ x (tan B)))
   (if (<= x 2.7e-167)
     (- (* (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5) (/ F B)) (/ x B))
     (if (<= x 3.2e-100)
       (+ (/ -1.0 (sin B)) (/ x B))
       (- (/ 1.0 B) (* x (/ 1.0 (tan B))))))))
double code(double F, double B, double x) {
	double tmp;
	if (x <= -1.65e-41) {
		tmp = (-1.0 / B) - (x / tan(B));
	} else if (x <= 2.7e-167) {
		tmp = (pow(((2.0 + (F * F)) + (x * 2.0)), -0.5) * (F / B)) - (x / B);
	} else if (x <= 3.2e-100) {
		tmp = (-1.0 / sin(B)) + (x / B);
	} else {
		tmp = (1.0 / B) - (x * (1.0 / tan(B)));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= (-1.65d-41)) then
        tmp = ((-1.0d0) / b) - (x / tan(b))
    else if (x <= 2.7d-167) then
        tmp = ((((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0)) * (f / b)) - (x / b)
    else if (x <= 3.2d-100) then
        tmp = ((-1.0d0) / sin(b)) + (x / b)
    else
        tmp = (1.0d0 / b) - (x * (1.0d0 / tan(b)))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (x <= -1.65e-41) {
		tmp = (-1.0 / B) - (x / Math.tan(B));
	} else if (x <= 2.7e-167) {
		tmp = (Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5) * (F / B)) - (x / B);
	} else if (x <= 3.2e-100) {
		tmp = (-1.0 / Math.sin(B)) + (x / B);
	} else {
		tmp = (1.0 / B) - (x * (1.0 / Math.tan(B)));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if x <= -1.65e-41:
		tmp = (-1.0 / B) - (x / math.tan(B))
	elif x <= 2.7e-167:
		tmp = (math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5) * (F / B)) - (x / B)
	elif x <= 3.2e-100:
		tmp = (-1.0 / math.sin(B)) + (x / B)
	else:
		tmp = (1.0 / B) - (x * (1.0 / math.tan(B)))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (x <= -1.65e-41)
		tmp = Float64(Float64(-1.0 / B) - Float64(x / tan(B)));
	elseif (x <= 2.7e-167)
		tmp = Float64(Float64((Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5) * Float64(F / B)) - Float64(x / B));
	elseif (x <= 3.2e-100)
		tmp = Float64(Float64(-1.0 / sin(B)) + Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / B) - Float64(x * Float64(1.0 / tan(B))));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (x <= -1.65e-41)
		tmp = (-1.0 / B) - (x / tan(B));
	elseif (x <= 2.7e-167)
		tmp = ((((2.0 + (F * F)) + (x * 2.0)) ^ -0.5) * (F / B)) - (x / B);
	elseif (x <= 3.2e-100)
		tmp = (-1.0 / sin(B)) + (x / B);
	else
		tmp = (1.0 / B) - (x * (1.0 / tan(B)));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[x, -1.65e-41], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.7e-167], N[(N[(N[Power[N[(N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.2e-100], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-41}:\\
\;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\

\mathbf{elif}\;x \leq 2.7 \cdot 10^{-167}:\\
\;\;\;\;{\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\

\mathbf{elif}\;x \leq 3.2 \cdot 10^{-100}:\\
\;\;\;\;\frac{-1}{\sin B} + \frac{x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.65000000000000012e-41

    1. Initial program 62.3%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 85.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv85.3%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr85.3%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Taylor expanded in B around 0 88.9%

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

    if -1.65000000000000012e-41 < x < 2.7000000000000001e-167

    1. Initial program 80.3%

      \[\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. Add Preprocessing
    3. Taylor expanded in B around 0 67.8%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0 42.6%

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

    if 2.7000000000000001e-167 < x < 3.20000000000000017e-100

    1. Initial program 59.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. Add Preprocessing
    3. Taylor expanded in F around -inf 59.4%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 59.4%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt46.7%

        \[\leadsto \left(-\frac{x}{B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}} \]
      2. sqrt-unprod37.4%

        \[\leadsto \left(-\frac{x}{B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}} \]
      3. frac-times37.4%

        \[\leadsto \left(-\frac{x}{B}\right) + \sqrt{\color{blue}{\frac{-1 \cdot -1}{\sin B \cdot \sin B}}} \]
      4. metadata-eval37.4%

        \[\leadsto \left(-\frac{x}{B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}} \]
      5. metadata-eval37.4%

        \[\leadsto \left(-\frac{x}{B}\right) + \sqrt{\frac{\color{blue}{1 \cdot 1}}{\sin B \cdot \sin B}} \]
      6. frac-times37.4%

        \[\leadsto \left(-\frac{x}{B}\right) + \sqrt{\color{blue}{\frac{1}{\sin B} \cdot \frac{1}{\sin B}}} \]
      7. sqrt-unprod2.0%

        \[\leadsto \left(-\frac{x}{B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}} \]
      8. add-sqr-sqrt14.4%

        \[\leadsto \left(-\frac{x}{B}\right) + \color{blue}{\frac{1}{\sin B}} \]
      9. *-un-lft-identity14.4%

        \[\leadsto \left(-\frac{x}{B}\right) + \color{blue}{1 \cdot \frac{1}{\sin B}} \]
      10. metadata-eval14.4%

        \[\leadsto \left(-\frac{x}{B}\right) + \color{blue}{\left(--1\right)} \cdot \frac{1}{\sin B} \]
      11. cancel-sign-sub-inv14.4%

        \[\leadsto \color{blue}{\left(-\frac{x}{B}\right) - -1 \cdot \frac{1}{\sin B}} \]
      12. div-inv14.4%

        \[\leadsto \left(-\frac{x}{B}\right) - \color{blue}{\frac{-1}{\sin B}} \]
      13. *-un-lft-identity14.4%

        \[\leadsto \color{blue}{1 \cdot \left(\left(-\frac{x}{B}\right) - \frac{-1}{\sin B}\right)} \]
      14. sub-neg14.4%

        \[\leadsto 1 \cdot \color{blue}{\left(\left(-\frac{x}{B}\right) + \left(-\frac{-1}{\sin B}\right)\right)} \]
      15. add-sqr-sqrt13.0%

        \[\leadsto 1 \cdot \left(\color{blue}{\sqrt{-\frac{x}{B}} \cdot \sqrt{-\frac{x}{B}}} + \left(-\frac{-1}{\sin B}\right)\right) \]
      16. sqrt-unprod14.4%

        \[\leadsto 1 \cdot \left(\color{blue}{\sqrt{\left(-\frac{x}{B}\right) \cdot \left(-\frac{x}{B}\right)}} + \left(-\frac{-1}{\sin B}\right)\right) \]
      17. sqr-neg14.4%

        \[\leadsto 1 \cdot \left(\sqrt{\color{blue}{\frac{x}{B} \cdot \frac{x}{B}}} + \left(-\frac{-1}{\sin B}\right)\right) \]
      18. sqrt-unprod8.0%

        \[\leadsto 1 \cdot \left(\color{blue}{\sqrt{\frac{x}{B}} \cdot \sqrt{\frac{x}{B}}} + \left(-\frac{-1}{\sin B}\right)\right) \]
      19. add-sqr-sqrt14.4%

        \[\leadsto 1 \cdot \left(\color{blue}{\frac{x}{B}} + \left(-\frac{-1}{\sin B}\right)\right) \]
      20. distribute-frac-neg214.4%

        \[\leadsto 1 \cdot \left(\frac{x}{B} + \color{blue}{\frac{-1}{-\sin B}}\right) \]
      21. metadata-eval14.4%

        \[\leadsto 1 \cdot \left(\frac{x}{B} + \frac{\color{blue}{-1}}{-\sin B}\right) \]
    6. Applied egg-rr59.4%

      \[\leadsto \color{blue}{1 \cdot \left(\frac{x}{B} + \frac{-1}{\sin B}\right)} \]
    7. Step-by-step derivation
      1. *-lft-identity59.4%

        \[\leadsto \color{blue}{\frac{x}{B} + \frac{-1}{\sin B}} \]
      2. +-commutative59.4%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \frac{x}{B}} \]
    8. Simplified59.4%

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

    if 3.20000000000000017e-100 < x

    1. Initial program 81.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. Add Preprocessing
    3. Taylor expanded in F around inf 69.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\frac{1}{F}} \]
    4. Step-by-step derivation
      1. un-div-inv69.7%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{\frac{F}{\sin B}}{F}} \]
    5. Applied egg-rr69.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{\frac{F}{\sin B}}{F}} \]
    6. Taylor expanded in B around 0 84.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{-41}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;x \leq 2.7 \cdot 10^{-167}:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-100}:\\ \;\;\;\;\frac{-1}{\sin B} + \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 61.2% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -5 \cdot 10^{+232}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq -1.05 \cdot 10^{+32}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 0.0007:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (/ -1.0 B) (/ x (tan B)))))
   (if (<= F -5e+232)
     t_0
     (if (<= F -1.05e+32)
       (- (/ -1.0 (sin B)) (/ x B))
       (if (<= F 0.0007) t_0 (- (/ 1.0 (sin B)) (/ x B)))))))
double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / tan(B));
	double tmp;
	if (F <= -5e+232) {
		tmp = t_0;
	} else if (F <= -1.05e+32) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= 0.0007) {
		tmp = t_0;
	} else {
		tmp = (1.0 / sin(B)) - (x / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((-1.0d0) / b) - (x / tan(b))
    if (f <= (-5d+232)) then
        tmp = t_0
    else if (f <= (-1.05d+32)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= 0.0007d0) then
        tmp = t_0
    else
        tmp = (1.0d0 / sin(b)) - (x / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / Math.tan(B));
	double tmp;
	if (F <= -5e+232) {
		tmp = t_0;
	} else if (F <= -1.05e+32) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= 0.0007) {
		tmp = t_0;
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (-1.0 / B) - (x / math.tan(B))
	tmp = 0
	if F <= -5e+232:
		tmp = t_0
	elif F <= -1.05e+32:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= 0.0007:
		tmp = t_0
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(-1.0 / B) - Float64(x / tan(B)))
	tmp = 0.0
	if (F <= -5e+232)
		tmp = t_0;
	elseif (F <= -1.05e+32)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= 0.0007)
		tmp = t_0;
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = (-1.0 / B) - (x / tan(B));
	tmp = 0.0;
	if (F <= -5e+232)
		tmp = t_0;
	elseif (F <= -1.05e+32)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= 0.0007)
		tmp = t_0;
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e+232], t$95$0, If[LessEqual[F, -1.05e+32], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.0007], t$95$0, N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-1}{B} - \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -5 \cdot 10^{+232}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq -1.05 \cdot 10^{+32}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq 0.0007:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -4.99999999999999987e232 or -1.05e32 < F < 6.99999999999999993e-4

    1. Initial program 91.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. Add Preprocessing
    3. Taylor expanded in F around -inf 45.8%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. div-inv45.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr45.8%

      \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Taylor expanded in B around 0 53.1%

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

    if -4.99999999999999987e232 < F < -1.05e32

    1. Initial program 63.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. Add Preprocessing
    3. Taylor expanded in F around -inf 99.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 83.9%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Step-by-step derivation
      1. +-commutative83.9%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(-\frac{x}{B}\right)} \]
      2. unsub-neg83.9%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Applied egg-rr83.9%

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

    if 6.99999999999999993e-4 < F

    1. Initial program 52.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. Add Preprocessing
    3. Taylor expanded in B around 0 35.4%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5 \cdot 10^{+232}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.05 \cdot 10^{+32}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 0.0007:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 57.1% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -5.8 \cdot 10^{-79}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.25 \cdot 10^{-108}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -5.8e-79)
   (- (/ -1.0 (sin B)) (/ x B))
   (if (<= F 1.25e-108) (/ (- x) B) (- (/ 1.0 (sin B)) (/ x B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -5.8e-79) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= 1.25e-108) {
		tmp = -x / B;
	} else {
		tmp = (1.0 / sin(B)) - (x / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-5.8d-79)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= 1.25d-108) then
        tmp = -x / b
    else
        tmp = (1.0d0 / sin(b)) - (x / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -5.8e-79) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= 1.25e-108) {
		tmp = -x / B;
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -5.8e-79:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= 1.25e-108:
		tmp = -x / B
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -5.8e-79)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= 1.25e-108)
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -5.8e-79)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= 1.25e-108)
		tmp = -x / B;
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -5.8e-79], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.25e-108], N[((-x) / B), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.8 \cdot 10^{-79}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq 1.25 \cdot 10^{-108}:\\
\;\;\;\;\frac{-x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -5.8000000000000001e-79

    1. Initial program 68.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. Add Preprocessing
    3. Taylor expanded in F around -inf 85.4%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 63.2%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Step-by-step derivation
      1. +-commutative63.2%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(-\frac{x}{B}\right)} \]
      2. unsub-neg63.2%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Applied egg-rr63.2%

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

    if -5.8000000000000001e-79 < F < 1.25e-108

    1. Initial program 99.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. Add Preprocessing
    3. Taylor expanded in F around -inf 32.2%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 15.7%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Taylor expanded in x around inf 30.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    6. Step-by-step derivation
      1. associate-*r/30.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. neg-mul-130.8%

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    7. Simplified30.8%

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

    if 1.25e-108 < F

    1. Initial program 62.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. Add Preprocessing
    3. Taylor expanded in B around 0 43.9%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification54.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.8 \cdot 10^{-79}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.25 \cdot 10^{-108}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 43.5% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -4.3 \cdot 10^{-86}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -4.3e-86) (- (/ -1.0 (sin B)) (/ x B)) (/ (- x) B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -4.3e-86) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else {
		tmp = -x / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-4.3d-86)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else
        tmp = -x / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -4.3e-86) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else {
		tmp = -x / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -4.3e-86:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	else:
		tmp = -x / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -4.3e-86)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	else
		tmp = Float64(Float64(-x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -4.3e-86)
		tmp = (-1.0 / sin(B)) - (x / B);
	else
		tmp = -x / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -4.3e-86], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.3 \cdot 10^{-86}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -4.30000000000000013e-86

    1. Initial program 68.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. Add Preprocessing
    3. Taylor expanded in F around -inf 85.4%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 63.2%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Step-by-step derivation
      1. +-commutative63.2%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(-\frac{x}{B}\right)} \]
      2. unsub-neg63.2%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Applied egg-rr63.2%

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

    if -4.30000000000000013e-86 < F

    1. Initial program 81.0%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 38.8%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 22.0%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Taylor expanded in x around inf 30.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    6. Step-by-step derivation
      1. associate-*r/30.3%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. neg-mul-130.3%

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    7. Simplified30.3%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -4.3 \cdot 10^{-86}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 36.6% accurate, 27.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -3.2 \cdot 10^{-78}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -3.2e-78) (- (/ -1.0 B) (/ x B)) (/ (- x) B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.2e-78) {
		tmp = (-1.0 / B) - (x / B);
	} else {
		tmp = -x / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-3.2d-78)) then
        tmp = ((-1.0d0) / b) - (x / b)
    else
        tmp = -x / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.2e-78) {
		tmp = (-1.0 / B) - (x / B);
	} else {
		tmp = -x / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -3.2e-78:
		tmp = (-1.0 / B) - (x / B)
	else:
		tmp = -x / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -3.2e-78)
		tmp = Float64(Float64(-1.0 / B) - Float64(x / B));
	else
		tmp = Float64(Float64(-x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -3.2e-78)
		tmp = (-1.0 / B) - (x / B);
	else
		tmp = -x / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -3.2e-78], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{-78}:\\
\;\;\;\;\frac{-1}{B} - \frac{x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -3.2e-78

    1. Initial program 68.3%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 86.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 63.8%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Taylor expanded in B around 0 47.3%

      \[\leadsto \left(-\frac{x}{B}\right) + \color{blue}{\frac{-1}{B}} \]

    if -3.2e-78 < F

    1. Initial program 81.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. Add Preprocessing
    3. Taylor expanded in F around -inf 38.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 21.9%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Taylor expanded in x around inf 30.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    6. Step-by-step derivation
      1. associate-*r/30.2%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. neg-mul-130.2%

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    7. Simplified30.2%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification36.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.2 \cdot 10^{-78}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 36.6% accurate, 32.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -4.6 \cdot 10^{-78}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -4.6e-78) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -4.6e-78) {
		tmp = (-1.0 - x) / B;
	} else {
		tmp = -x / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-4.6d-78)) then
        tmp = ((-1.0d0) - x) / b
    else
        tmp = -x / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -4.6e-78) {
		tmp = (-1.0 - x) / B;
	} else {
		tmp = -x / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -4.6e-78:
		tmp = (-1.0 - x) / B
	else:
		tmp = -x / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -4.6e-78)
		tmp = Float64(Float64(-1.0 - x) / B);
	else
		tmp = Float64(Float64(-x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -4.6e-78)
		tmp = (-1.0 - x) / B;
	else
		tmp = -x / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -4.6e-78], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.6 \cdot 10^{-78}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -4.6000000000000004e-78

    1. Initial program 68.3%

      \[\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. Add Preprocessing
    3. Taylor expanded in F around -inf 86.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 63.8%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Taylor expanded in B around 0 47.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    6. Step-by-step derivation
      1. mul-1-neg47.2%

        \[\leadsto \color{blue}{-\frac{1 + x}{B}} \]
      2. distribute-neg-frac247.2%

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Simplified47.2%

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

    if -4.6000000000000004e-78 < F

    1. Initial program 81.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. Add Preprocessing
    3. Taylor expanded in F around -inf 38.6%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Taylor expanded in B around 0 21.9%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
    5. Taylor expanded in x around inf 30.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    6. Step-by-step derivation
      1. associate-*r/30.2%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. neg-mul-130.2%

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    7. Simplified30.2%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification36.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -4.6 \cdot 10^{-78}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 29.2% accurate, 81.0× speedup?

\[\begin{array}{l} \\ \frac{-x}{B} \end{array} \]
(FPCore (F B x) :precision binary64 (/ (- x) B))
double code(double F, double B, double x) {
	return -x / B;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = -x / b
end function
public static double code(double F, double B, double x) {
	return -x / B;
}
def code(F, B, x):
	return -x / B
function code(F, B, x)
	return Float64(Float64(-x) / B)
end
function tmp = code(F, B, x)
	tmp = -x / B;
end
code[F_, B_, x_] := N[((-x) / B), $MachinePrecision]
\begin{array}{l}

\\
\frac{-x}{B}
\end{array}
Derivation
  1. Initial program 76.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. Add Preprocessing
  3. Taylor expanded in F around -inf 56.1%

    \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
  4. Taylor expanded in B around 0 37.3%

    \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]
  5. Taylor expanded in x around inf 29.4%

    \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
  6. Step-by-step derivation
    1. associate-*r/29.4%

      \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
    2. neg-mul-129.4%

      \[\leadsto \frac{\color{blue}{-x}}{B} \]
  7. Simplified29.4%

    \[\leadsto \color{blue}{\frac{-x}{B}} \]
  8. Final simplification29.4%

    \[\leadsto \frac{-x}{B} \]
  9. Add Preprocessing

Reproduce

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