VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.0% → 99.6%
Time: 17.5s
Alternatives: 24
Speedup: 1.4×

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 24 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: 77.0% 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.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;F \leq 2750:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\frac{\sin B}{F}} - t\_0\\

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


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

    1. Initial program 54.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. Simplified67.7%

      \[\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 -inf 99.7%

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

    if -3.5999999999999997e36 < F < 2750

    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.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. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

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

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

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

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

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

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

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

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

    if 2750 < F

    1. Initial program 64.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. Simplified80.7%

      \[\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 inf 99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - x \cdot \frac{\cos B}{\sin B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;F \leq 2750:\\
\;\;\;\;F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - t\_0\\

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


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

    1. Initial program 54.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. Simplified67.7%

      \[\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 -inf 99.7%

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

    if -9.99999999999999954e36 < F < 2750

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

    if 2750 < F

    1. Initial program 64.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. Simplified80.7%

      \[\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 inf 99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - x \cdot \frac{\cos B}{\sin B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 99.5% 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 -2 \cdot 10^{+38}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_1\\ \mathbf{elif}\;F \leq 2750:\\ \;\;\;\;F \cdot \left(t\_0 \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\right) - t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0 - x \cdot \frac{\cos B}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ x (tan B))))
   (if (<= F -2e+38)
     (- (/ -1.0 (sin B)) t_1)
     (if (<= F 2750.0)
       (- (* F (* t_0 (sqrt (/ 1.0 (fma F F 2.0))))) t_1)
       (- t_0 (* x (/ (cos B) (sin B))))))))
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 <= -2e+38) {
		tmp = (-1.0 / sin(B)) - t_1;
	} else if (F <= 2750.0) {
		tmp = (F * (t_0 * sqrt((1.0 / fma(F, F, 2.0))))) - t_1;
	} else {
		tmp = t_0 - (x * (cos(B) / sin(B)));
	}
	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 <= -2e+38)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_1);
	elseif (F <= 2750.0)
		tmp = Float64(Float64(F * Float64(t_0 * sqrt(Float64(1.0 / fma(F, F, 2.0))))) - t_1);
	else
		tmp = Float64(t_0 - Float64(x * Float64(cos(B) / sin(B))));
	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, -2e+38], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, 2750.0], N[(N[(F * N[(t$95$0 * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(t$95$0 - N[(x * N[(N[Cos[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;t\_0 - x \cdot \frac{\cos B}{\sin B}\\


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

    1. Initial program 54.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. Simplified67.7%

      \[\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 -inf 99.7%

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

    if -1.99999999999999995e38 < F < 2750

    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.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 x around 0 99.5%

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

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

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

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

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

    if 2750 < F

    1. Initial program 64.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. Simplified80.7%

      \[\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 inf 99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - x \cdot \frac{\cos B}{\sin B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 99.5% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 54.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. Simplified67.7%

      \[\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 -inf 99.7%

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

    if -9.99999999999999954e36 < F < 2750

    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.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 x around 0 99.5%

      \[\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.5%

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

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

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

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

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

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

    if 2750 < F

    1. Initial program 64.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. Simplified80.7%

      \[\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 inf 99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - x \cdot \frac{\cos B}{\sin B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -4.8 \cdot 10^{+36}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2750:\\ \;\;\;\;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{1}{\sin B} - x \cdot \frac{\cos B}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -4.8e+36)
   (- (/ -1.0 (sin B)) (/ x (tan B)))
   (if (<= F 2750.0)
     (+
      (* x (/ -1.0 (tan B)))
      (* (/ F (sin B)) (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5)))
     (- (/ 1.0 (sin B)) (* x (/ (cos B) (sin B)))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -4.8e+36) {
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	} else if (F <= 2750.0) {
		tmp = (x * (-1.0 / tan(B))) + ((F / sin(B)) * pow(((2.0 + (F * F)) + (x * 2.0)), -0.5));
	} else {
		tmp = (1.0 / sin(B)) - (x * (cos(B) / sin(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.8d+36)) then
        tmp = ((-1.0d0) / sin(b)) - (x / tan(b))
    else if (f <= 2750.0d0) then
        tmp = (x * ((-1.0d0) / tan(b))) + ((f / sin(b)) * (((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0)))
    else
        tmp = (1.0d0 / sin(b)) - (x * (cos(b) / sin(b)))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -4.8e+36) {
		tmp = (-1.0 / Math.sin(B)) - (x / Math.tan(B));
	} else if (F <= 2750.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 = (1.0 / Math.sin(B)) - (x * (Math.cos(B) / Math.sin(B)));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -4.8e+36:
		tmp = (-1.0 / math.sin(B)) - (x / math.tan(B))
	elif F <= 2750.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 = (1.0 / math.sin(B)) - (x * (math.cos(B) / math.sin(B)))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -4.8e+36)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B)));
	elseif (F <= 2750.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(1.0 / sin(B)) - Float64(x * Float64(cos(B) / sin(B))));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -4.8e+36)
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	elseif (F <= 2750.0)
		tmp = (x * (-1.0 / tan(B))) + ((F / sin(B)) * (((2.0 + (F * F)) + (x * 2.0)) ^ -0.5));
	else
		tmp = (1.0 / sin(B)) - (x * (cos(B) / sin(B)));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -4.8e+36], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2750.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[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x * N[(N[Cos[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq 2750:\\
\;\;\;\;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{1}{\sin B} - x \cdot \frac{\cos B}{\sin B}\\


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

    1. Initial program 54.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. Simplified67.7%

      \[\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 -inf 99.7%

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

    if -4.79999999999999985e36 < F < 2750

    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. Add Preprocessing
    3. Step-by-step derivation
      1. metadata-eval99.4%

        \[\leadsto \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(-\color{blue}{0.5}\right)} \]
      2. metadata-eval99.4%

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

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

    if 2750 < F

    1. Initial program 64.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. Simplified80.7%

      \[\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 inf 99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -4.8 \cdot 10^{+36}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2750:\\ \;\;\;\;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{1}{\sin B} - x \cdot \frac{\cos B}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 91.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -0.39:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 3.4 \cdot 10^{-156}:\\ \;\;\;\;F \cdot \left(\frac{1}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - t\_0\\ \mathbf{elif}\;F \leq 2200:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - x \cdot \frac{\cos B}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -0.39)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 3.4e-156)
       (- (* F (* (/ 1.0 B) (sqrt (/ 1.0 (+ 2.0 (* x 2.0)))))) t_0)
       (if (<= F 2200.0)
         (- (* (/ F (sin B)) (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5)) (/ x B))
         (- (/ 1.0 (sin B)) (* x (/ (cos B) (sin B)))))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -0.39) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 3.4e-156) {
		tmp = (F * ((1.0 / B) * sqrt((1.0 / (2.0 + (x * 2.0)))))) - t_0;
	} else if (F <= 2200.0) {
		tmp = ((F / sin(B)) * pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - (x / B);
	} else {
		tmp = (1.0 / sin(B)) - (x * (cos(B) / sin(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 = x / tan(b)
    if (f <= (-0.39d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= 3.4d-156) then
        tmp = (f * ((1.0d0 / b) * sqrt((1.0d0 / (2.0d0 + (x * 2.0d0)))))) - t_0
    else if (f <= 2200.0d0) then
        tmp = ((f / sin(b)) * (((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0))) - (x / b)
    else
        tmp = (1.0d0 / sin(b)) - (x * (cos(b) / sin(b)))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x / Math.tan(B);
	double tmp;
	if (F <= -0.39) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= 3.4e-156) {
		tmp = (F * ((1.0 / B) * Math.sqrt((1.0 / (2.0 + (x * 2.0)))))) - t_0;
	} else if (F <= 2200.0) {
		tmp = ((F / Math.sin(B)) * Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - (x / B);
	} else {
		tmp = (1.0 / Math.sin(B)) - (x * (Math.cos(B) / Math.sin(B)));
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -0.39:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= 3.4e-156:
		tmp = (F * ((1.0 / B) * math.sqrt((1.0 / (2.0 + (x * 2.0)))))) - t_0
	elif F <= 2200.0:
		tmp = ((F / math.sin(B)) * math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - (x / B)
	else:
		tmp = (1.0 / math.sin(B)) - (x * (math.cos(B) / math.sin(B)))
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -0.39)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 3.4e-156)
		tmp = Float64(Float64(F * Float64(Float64(1.0 / B) * sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0)))))) - t_0);
	elseif (F <= 2200.0)
		tmp = Float64(Float64(Float64(F / sin(B)) * (Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5)) - Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x * Float64(cos(B) / sin(B))));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= -0.39)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= 3.4e-156)
		tmp = (F * ((1.0 / B) * sqrt((1.0 / (2.0 + (x * 2.0)))))) - t_0;
	elseif (F <= 2200.0)
		tmp = ((F / sin(B)) * (((2.0 + (F * F)) + (x * 2.0)) ^ -0.5)) - (x / B);
	else
		tmp = (1.0 / sin(B)) - (x * (cos(B) / sin(B)));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.39], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 3.4e-156], N[(N[(F * N[(N[(1.0 / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 2200.0], 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], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x * N[(N[Cos[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq 3.4 \cdot 10^{-156}:\\
\;\;\;\;F \cdot \left(\frac{1}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - t\_0\\

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

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


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

    1. Initial program 55.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. Simplified68.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 -inf 99.5%

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

    if -0.39000000000000001 < F < 3.3999999999999999e-156

    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.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 98.7%

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}}{\sin B} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative98.7%

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Taylor expanded in B around 0 88.9%

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

    if 3.3999999999999999e-156 < F < 2200

    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 83.9%

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

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

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

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

        \[\leadsto \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(-\color{blue}{0.5}\right)} \]
      2. metadata-eval99.3%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\color{blue}{-0.5}} \]
    7. Applied egg-rr83.9%

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

    if 2200 < F

    1. Initial program 64.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. Simplified80.7%

      \[\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 inf 99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. associate-/l*99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified99.8%

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

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

Alternative 7: 99.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 55.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. Simplified68.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 -inf 99.5%

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

    if -1.3999999999999999 < F < 0.599999999999999978

    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.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 98.9%

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

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Taylor expanded in x around 0 98.9%

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

    if 0.599999999999999978 < F

    1. Initial program 65.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. Simplified81.3%

      \[\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 inf 98.5%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. associate-/l*98.7%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - x \cdot \frac{\cos B}{\sin B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 87.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1650000:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq -2.45 \cdot 10^{-79}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 6.5 \cdot 10^{-157}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 3.4 \cdot 10^{-6}:\\ \;\;\;\;F \cdot \frac{\sqrt{\frac{1}{2 + x \cdot 2}}}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1650000.0)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F -2.45e-79)
       (/ (- (* F (sqrt (/ 1.0 (+ 2.0 (+ (* F F) (* x 2.0)))))) x) B)
       (if (<= F 6.5e-157)
         (/ (* x (- (cos B))) (sin B))
         (if (<= F 3.4e-6)
           (- (* F (/ (sqrt (/ 1.0 (+ 2.0 (* x 2.0)))) (sin B))) (/ x B))
           (- (/ 1.0 (sin B)) t_0)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1650000.0) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= -2.45e-79) {
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 6.5e-157) {
		tmp = (x * -cos(B)) / sin(B);
	} else if (F <= 3.4e-6) {
		tmp = (F * (sqrt((1.0 / (2.0 + (x * 2.0)))) / sin(B))) - (x / B);
	} else {
		tmp = (1.0 / sin(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 = x / tan(b)
    if (f <= (-1650000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= (-2.45d-79)) then
        tmp = ((f * sqrt((1.0d0 / (2.0d0 + ((f * f) + (x * 2.0d0)))))) - x) / b
    else if (f <= 6.5d-157) then
        tmp = (x * -cos(b)) / sin(b)
    else if (f <= 3.4d-6) then
        tmp = (f * (sqrt((1.0d0 / (2.0d0 + (x * 2.0d0)))) / sin(b))) - (x / b)
    else
        tmp = (1.0d0 / sin(b)) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x / Math.tan(B);
	double tmp;
	if (F <= -1650000.0) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= -2.45e-79) {
		tmp = ((F * Math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 6.5e-157) {
		tmp = (x * -Math.cos(B)) / Math.sin(B);
	} else if (F <= 3.4e-6) {
		tmp = (F * (Math.sqrt((1.0 / (2.0 + (x * 2.0)))) / Math.sin(B))) - (x / B);
	} else {
		tmp = (1.0 / Math.sin(B)) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -1650000.0:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= -2.45e-79:
		tmp = ((F * math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B
	elif F <= 6.5e-157:
		tmp = (x * -math.cos(B)) / math.sin(B)
	elif F <= 3.4e-6:
		tmp = (F * (math.sqrt((1.0 / (2.0 + (x * 2.0)))) / math.sin(B))) - (x / B)
	else:
		tmp = (1.0 / math.sin(B)) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1650000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= -2.45e-79)
		tmp = Float64(Float64(Float64(F * sqrt(Float64(1.0 / Float64(2.0 + Float64(Float64(F * F) + Float64(x * 2.0)))))) - x) / B);
	elseif (F <= 6.5e-157)
		tmp = Float64(Float64(x * Float64(-cos(B))) / sin(B));
	elseif (F <= 3.4e-6)
		tmp = Float64(Float64(F * Float64(sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0)))) / sin(B))) - Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= -1650000.0)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= -2.45e-79)
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	elseif (F <= 6.5e-157)
		tmp = (x * -cos(B)) / sin(B);
	elseif (F <= 3.4e-6)
		tmp = (F * (sqrt((1.0 / (2.0 + (x * 2.0)))) / sin(B))) - (x / B);
	else
		tmp = (1.0 / sin(B)) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1650000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, -2.45e-79], N[(N[(N[(F * N[Sqrt[N[(1.0 / N[(2.0 + N[(N[(F * F), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 6.5e-157], N[(N[(x * (-N[Cos[B], $MachinePrecision])), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.4e-6], N[(N[(F * N[(N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -2.45 \cdot 10^{-79}:\\
\;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\

\mathbf{elif}\;F \leq 6.5 \cdot 10^{-157}:\\
\;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\

\mathbf{elif}\;F \leq 3.4 \cdot 10^{-6}:\\
\;\;\;\;F \cdot \frac{\sqrt{\frac{1}{2 + x \cdot 2}}}{\sin B} - \frac{x}{B}\\

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


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

    1. Initial program 55.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. Simplified68.1%

      \[\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 -inf 99.7%

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

    if -1.65e6 < F < -2.45e-79

    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. 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 B around 0 99.2%

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

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + \color{blue}{F \cdot F}\right)}} - x}{B} \]
    6. Applied egg-rr99.2%

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

    if -2.45e-79 < F < 6.5000000000000002e-157

    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 99.6%

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

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. sqrt-div99.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg84.5%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
    11. Simplified84.5%

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

    if 6.5000000000000002e-157 < F < 3.40000000000000006e-6

    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. 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 99.4%

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}}{\sin B} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative99.4%

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Taylor expanded in B around 0 83.2%

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

    if 3.40000000000000006e-6 < F

    1. Initial program 65.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. Simplified81.3%

      \[\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 inf 98.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -2.45 \cdot 10^{-79}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 6.5 \cdot 10^{-157}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 3.4 \cdot 10^{-6}:\\ \;\;\;\;F \cdot \frac{\sqrt{\frac{1}{2 + x \cdot 2}}}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 91.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -0.47:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 2.2 \cdot 10^{-156}:\\ \;\;\;\;F \cdot \left(\frac{1}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - t\_0\\ \mathbf{elif}\;F \leq 600:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -0.47)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 2.2e-156)
       (- (* F (* (/ 1.0 B) (sqrt (/ 1.0 (+ 2.0 (* x 2.0)))))) t_0)
       (if (<= F 600.0)
         (- (* (/ F (sin B)) (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5)) (/ x B))
         (- (/ 1.0 (sin B)) t_0))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -0.47) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 2.2e-156) {
		tmp = (F * ((1.0 / B) * sqrt((1.0 / (2.0 + (x * 2.0)))))) - t_0;
	} else if (F <= 600.0) {
		tmp = ((F / sin(B)) * pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - (x / B);
	} else {
		tmp = (1.0 / sin(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 = x / tan(b)
    if (f <= (-0.47d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= 2.2d-156) then
        tmp = (f * ((1.0d0 / b) * sqrt((1.0d0 / (2.0d0 + (x * 2.0d0)))))) - t_0
    else if (f <= 600.0d0) then
        tmp = ((f / sin(b)) * (((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0))) - (x / b)
    else
        tmp = (1.0d0 / sin(b)) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x / Math.tan(B);
	double tmp;
	if (F <= -0.47) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= 2.2e-156) {
		tmp = (F * ((1.0 / B) * Math.sqrt((1.0 / (2.0 + (x * 2.0)))))) - t_0;
	} else if (F <= 600.0) {
		tmp = ((F / Math.sin(B)) * Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - (x / B);
	} else {
		tmp = (1.0 / Math.sin(B)) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -0.47:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= 2.2e-156:
		tmp = (F * ((1.0 / B) * math.sqrt((1.0 / (2.0 + (x * 2.0)))))) - t_0
	elif F <= 600.0:
		tmp = ((F / math.sin(B)) * math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - (x / B)
	else:
		tmp = (1.0 / math.sin(B)) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -0.47)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 2.2e-156)
		tmp = Float64(Float64(F * Float64(Float64(1.0 / B) * sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0)))))) - t_0);
	elseif (F <= 600.0)
		tmp = Float64(Float64(Float64(F / sin(B)) * (Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5)) - Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= -0.47)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= 2.2e-156)
		tmp = (F * ((1.0 / B) * sqrt((1.0 / (2.0 + (x * 2.0)))))) - t_0;
	elseif (F <= 600.0)
		tmp = ((F / sin(B)) * (((2.0 + (F * F)) + (x * 2.0)) ^ -0.5)) - (x / B);
	else
		tmp = (1.0 / sin(B)) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.47], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 2.2e-156], N[(N[(F * N[(N[(1.0 / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 600.0], 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], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq 2.2 \cdot 10^{-156}:\\
\;\;\;\;F \cdot \left(\frac{1}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - t\_0\\

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

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


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

    1. Initial program 55.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. Simplified68.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 -inf 99.5%

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

    if -0.46999999999999997 < F < 2.1999999999999999e-156

    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.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 98.7%

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}}{\sin B} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative98.7%

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Taylor expanded in B around 0 88.9%

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

    if 2.1999999999999999e-156 < F < 600

    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 83.9%

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

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

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

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

        \[\leadsto \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(-\color{blue}{0.5}\right)} \]
      2. metadata-eval99.3%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\color{blue}{-0.5}} \]
    7. Applied egg-rr83.9%

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

    if 600 < F

    1. Initial program 64.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. Simplified80.7%

      \[\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 inf 99.8%

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

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

Alternative 10: 84.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1650000:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq -5.1 \cdot 10^{-79}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 2.2 \cdot 10^{-156}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{-5}:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1650000.0)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F -5.1e-79)
       (/ (- (* F (sqrt (/ 1.0 (+ 2.0 (+ (* F F) (* x 2.0)))))) x) B)
       (if (<= F 2.2e-156)
         (/ (* x (- (cos B))) (sin B))
         (if (<= F 1.35e-5)
           (* (/ F (sin B)) (sqrt (/ 1.0 (+ 2.0 (* x 2.0)))))
           (- (/ 1.0 (sin B)) t_0)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1650000.0) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= -5.1e-79) {
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 2.2e-156) {
		tmp = (x * -cos(B)) / sin(B);
	} else if (F <= 1.35e-5) {
		tmp = (F / sin(B)) * sqrt((1.0 / (2.0 + (x * 2.0))));
	} else {
		tmp = (1.0 / sin(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 = x / tan(b)
    if (f <= (-1650000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= (-5.1d-79)) then
        tmp = ((f * sqrt((1.0d0 / (2.0d0 + ((f * f) + (x * 2.0d0)))))) - x) / b
    else if (f <= 2.2d-156) then
        tmp = (x * -cos(b)) / sin(b)
    else if (f <= 1.35d-5) then
        tmp = (f / sin(b)) * sqrt((1.0d0 / (2.0d0 + (x * 2.0d0))))
    else
        tmp = (1.0d0 / sin(b)) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x / Math.tan(B);
	double tmp;
	if (F <= -1650000.0) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= -5.1e-79) {
		tmp = ((F * Math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 2.2e-156) {
		tmp = (x * -Math.cos(B)) / Math.sin(B);
	} else if (F <= 1.35e-5) {
		tmp = (F / Math.sin(B)) * Math.sqrt((1.0 / (2.0 + (x * 2.0))));
	} else {
		tmp = (1.0 / Math.sin(B)) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -1650000.0:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= -5.1e-79:
		tmp = ((F * math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B
	elif F <= 2.2e-156:
		tmp = (x * -math.cos(B)) / math.sin(B)
	elif F <= 1.35e-5:
		tmp = (F / math.sin(B)) * math.sqrt((1.0 / (2.0 + (x * 2.0))))
	else:
		tmp = (1.0 / math.sin(B)) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1650000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= -5.1e-79)
		tmp = Float64(Float64(Float64(F * sqrt(Float64(1.0 / Float64(2.0 + Float64(Float64(F * F) + Float64(x * 2.0)))))) - x) / B);
	elseif (F <= 2.2e-156)
		tmp = Float64(Float64(x * Float64(-cos(B))) / sin(B));
	elseif (F <= 1.35e-5)
		tmp = Float64(Float64(F / sin(B)) * sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0)))));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= -1650000.0)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= -5.1e-79)
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	elseif (F <= 2.2e-156)
		tmp = (x * -cos(B)) / sin(B);
	elseif (F <= 1.35e-5)
		tmp = (F / sin(B)) * sqrt((1.0 / (2.0 + (x * 2.0))));
	else
		tmp = (1.0 / sin(B)) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1650000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, -5.1e-79], N[(N[(N[(F * N[Sqrt[N[(1.0 / N[(2.0 + N[(N[(F * F), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.2e-156], N[(N[(x * (-N[Cos[B], $MachinePrecision])), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.35e-5], 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], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -5.1 \cdot 10^{-79}:\\
\;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\

\mathbf{elif}\;F \leq 2.2 \cdot 10^{-156}:\\
\;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\

\mathbf{elif}\;F \leq 1.35 \cdot 10^{-5}:\\
\;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\

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


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

    1. Initial program 55.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. Simplified68.1%

      \[\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 -inf 99.7%

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

    if -1.65e6 < F < -5.0999999999999999e-79

    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. 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 B around 0 99.2%

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

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + \color{blue}{F \cdot F}\right)}} - x}{B} \]
    6. Applied egg-rr99.2%

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

    if -5.0999999999999999e-79 < F < 2.1999999999999999e-156

    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 99.6%

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

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. sqrt-div99.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg84.5%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
    11. Simplified84.5%

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

    if 2.1999999999999999e-156 < F < 1.3499999999999999e-5

    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. 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 99.4%

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}}{\sin B} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative99.4%

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. sqrt-div99.1%

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

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

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

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

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

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

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

    if 1.3499999999999999e-5 < F

    1. Initial program 65.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. Simplified81.3%

      \[\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 inf 98.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -5.1 \cdot 10^{-79}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 2.2 \cdot 10^{-156}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{-5}:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 91.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{2 + x \cdot 2}}\\ t_1 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -0.43:\\ \;\;\;\;\frac{-1}{\sin B} - t\_1\\ \mathbf{elif}\;F \leq 4.8 \cdot 10^{-156}:\\ \;\;\;\;F \cdot \left(\frac{1}{B} \cdot t\_0\right) - t\_1\\ \mathbf{elif}\;F \leq 0.105:\\ \;\;\;\;F \cdot \frac{t\_0}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin 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 (/ x (tan B))))
   (if (<= F -0.43)
     (- (/ -1.0 (sin B)) t_1)
     (if (<= F 4.8e-156)
       (- (* F (* (/ 1.0 B) t_0)) t_1)
       (if (<= F 0.105)
         (- (* F (/ t_0 (sin B))) (/ x B))
         (- (/ 1.0 (sin 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 = x / tan(B);
	double tmp;
	if (F <= -0.43) {
		tmp = (-1.0 / sin(B)) - t_1;
	} else if (F <= 4.8e-156) {
		tmp = (F * ((1.0 / B) * t_0)) - t_1;
	} else if (F <= 0.105) {
		tmp = (F * (t_0 / sin(B))) - (x / B);
	} else {
		tmp = (1.0 / sin(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 = sqrt((1.0d0 / (2.0d0 + (x * 2.0d0))))
    t_1 = x / tan(b)
    if (f <= (-0.43d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_1
    else if (f <= 4.8d-156) then
        tmp = (f * ((1.0d0 / b) * t_0)) - t_1
    else if (f <= 0.105d0) then
        tmp = (f * (t_0 / sin(b))) - (x / b)
    else
        tmp = (1.0d0 / sin(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 = x / Math.tan(B);
	double tmp;
	if (F <= -0.43) {
		tmp = (-1.0 / Math.sin(B)) - t_1;
	} else if (F <= 4.8e-156) {
		tmp = (F * ((1.0 / B) * t_0)) - t_1;
	} else if (F <= 0.105) {
		tmp = (F * (t_0 / Math.sin(B))) - (x / B);
	} else {
		tmp = (1.0 / Math.sin(B)) - t_1;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = math.sqrt((1.0 / (2.0 + (x * 2.0))))
	t_1 = x / math.tan(B)
	tmp = 0
	if F <= -0.43:
		tmp = (-1.0 / math.sin(B)) - t_1
	elif F <= 4.8e-156:
		tmp = (F * ((1.0 / B) * t_0)) - t_1
	elif F <= 0.105:
		tmp = (F * (t_0 / math.sin(B))) - (x / B)
	else:
		tmp = (1.0 / math.sin(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(x / tan(B))
	tmp = 0.0
	if (F <= -0.43)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_1);
	elseif (F <= 4.8e-156)
		tmp = Float64(Float64(F * Float64(Float64(1.0 / B) * t_0)) - t_1);
	elseif (F <= 0.105)
		tmp = Float64(Float64(F * Float64(t_0 / sin(B))) - Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / sin(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 = x / tan(B);
	tmp = 0.0;
	if (F <= -0.43)
		tmp = (-1.0 / sin(B)) - t_1;
	elseif (F <= 4.8e-156)
		tmp = (F * ((1.0 / B) * t_0)) - t_1;
	elseif (F <= 0.105)
		tmp = (F * (t_0 / sin(B))) - (x / B);
	else
		tmp = (1.0 / sin(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[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.43], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, 4.8e-156], N[(N[(F * N[(N[(1.0 / B), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, 0.105], N[(N[(F * N[(t$95$0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[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{x}{\tan B}\\
\mathbf{if}\;F \leq -0.43:\\
\;\;\;\;\frac{-1}{\sin B} - t\_1\\

\mathbf{elif}\;F \leq 4.8 \cdot 10^{-156}:\\
\;\;\;\;F \cdot \left(\frac{1}{B} \cdot t\_0\right) - t\_1\\

\mathbf{elif}\;F \leq 0.105:\\
\;\;\;\;F \cdot \frac{t\_0}{\sin B} - \frac{x}{B}\\

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


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

    1. Initial program 55.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. Simplified68.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 -inf 99.5%

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

    if -0.429999999999999993 < F < 4.8e-156

    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.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 98.7%

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}}{\sin B} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative98.7%

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Taylor expanded in B around 0 88.9%

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

    if 4.8e-156 < F < 0.104999999999999996

    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. 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 99.4%

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}}{\sin B} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative99.4%

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Taylor expanded in B around 0 83.2%

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

    if 0.104999999999999996 < F

    1. Initial program 65.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. Simplified81.3%

      \[\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 inf 98.7%

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

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

Alternative 12: 84.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1650000:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq -1.12 \cdot 10^{-78}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 4.6 \cdot 10^{-156}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.0015:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1650000.0)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F -1.12e-78)
       (/ (- (* F (sqrt (/ 1.0 (+ 2.0 (+ (* F F) (* x 2.0)))))) x) B)
       (if (<= F 4.6e-156)
         (/ (* x (- (cos B))) (sin B))
         (if (<= F 0.0015)
           (/ (* F (sqrt 0.5)) (sin B))
           (- (/ 1.0 (sin B)) t_0)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1650000.0) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= -1.12e-78) {
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 4.6e-156) {
		tmp = (x * -cos(B)) / sin(B);
	} else if (F <= 0.0015) {
		tmp = (F * sqrt(0.5)) / sin(B);
	} else {
		tmp = (1.0 / sin(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 = x / tan(b)
    if (f <= (-1650000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= (-1.12d-78)) then
        tmp = ((f * sqrt((1.0d0 / (2.0d0 + ((f * f) + (x * 2.0d0)))))) - x) / b
    else if (f <= 4.6d-156) then
        tmp = (x * -cos(b)) / sin(b)
    else if (f <= 0.0015d0) then
        tmp = (f * sqrt(0.5d0)) / sin(b)
    else
        tmp = (1.0d0 / sin(b)) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x / Math.tan(B);
	double tmp;
	if (F <= -1650000.0) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= -1.12e-78) {
		tmp = ((F * Math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 4.6e-156) {
		tmp = (x * -Math.cos(B)) / Math.sin(B);
	} else if (F <= 0.0015) {
		tmp = (F * Math.sqrt(0.5)) / Math.sin(B);
	} else {
		tmp = (1.0 / Math.sin(B)) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -1650000.0:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= -1.12e-78:
		tmp = ((F * math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B
	elif F <= 4.6e-156:
		tmp = (x * -math.cos(B)) / math.sin(B)
	elif F <= 0.0015:
		tmp = (F * math.sqrt(0.5)) / math.sin(B)
	else:
		tmp = (1.0 / math.sin(B)) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1650000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= -1.12e-78)
		tmp = Float64(Float64(Float64(F * sqrt(Float64(1.0 / Float64(2.0 + Float64(Float64(F * F) + Float64(x * 2.0)))))) - x) / B);
	elseif (F <= 4.6e-156)
		tmp = Float64(Float64(x * Float64(-cos(B))) / sin(B));
	elseif (F <= 0.0015)
		tmp = Float64(Float64(F * sqrt(0.5)) / sin(B));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= -1650000.0)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= -1.12e-78)
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	elseif (F <= 4.6e-156)
		tmp = (x * -cos(B)) / sin(B);
	elseif (F <= 0.0015)
		tmp = (F * sqrt(0.5)) / sin(B);
	else
		tmp = (1.0 / sin(B)) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1650000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, -1.12e-78], N[(N[(N[(F * N[Sqrt[N[(1.0 / N[(2.0 + N[(N[(F * F), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.6e-156], N[(N[(x * (-N[Cos[B], $MachinePrecision])), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.0015], N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -1.12 \cdot 10^{-78}:\\
\;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\

\mathbf{elif}\;F \leq 4.6 \cdot 10^{-156}:\\
\;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\

\mathbf{elif}\;F \leq 0.0015:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\

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


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

    1. Initial program 55.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. Simplified68.1%

      \[\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 -inf 99.7%

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

    if -1.65e6 < F < -1.12000000000000005e-78

    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. 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 B around 0 99.2%

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

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + \color{blue}{F \cdot F}\right)}} - x}{B} \]
    6. Applied egg-rr99.2%

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

    if -1.12000000000000005e-78 < F < 4.5999999999999999e-156

    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 99.6%

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

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. sqrt-div99.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg84.5%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
    11. Simplified84.5%

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

    if 4.5999999999999999e-156 < F < 0.0015

    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. 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 99.4%

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}}{\sin B} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative99.4%

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. sqrt-div99.1%

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

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

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

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

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

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

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

    if 0.0015 < F

    1. Initial program 65.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. Simplified81.3%

      \[\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 inf 98.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.12 \cdot 10^{-78}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 4.6 \cdot 10^{-156}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.0015:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 78.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1650000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -9.8 \cdot 10^{-79}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 4.8 \cdot 10^{-156}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.007:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1650000.0)
   (- (/ -1.0 (sin B)) (/ x (tan B)))
   (if (<= F -9.8e-79)
     (/ (- (* F (sqrt (/ 1.0 (+ 2.0 (+ (* F F) (* x 2.0)))))) x) B)
     (if (<= F 4.8e-156)
       (/ (* x (- (cos B))) (sin B))
       (if (<= F 0.007)
         (/ (* F (sqrt 0.5)) (sin B))
         (- (/ 1.0 (sin B)) (/ x B)))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1650000.0) {
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	} else if (F <= -9.8e-79) {
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 4.8e-156) {
		tmp = (x * -cos(B)) / sin(B);
	} else if (F <= 0.007) {
		tmp = (F * sqrt(0.5)) / 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 <= (-1650000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / tan(b))
    else if (f <= (-9.8d-79)) then
        tmp = ((f * sqrt((1.0d0 / (2.0d0 + ((f * f) + (x * 2.0d0)))))) - x) / b
    else if (f <= 4.8d-156) then
        tmp = (x * -cos(b)) / sin(b)
    else if (f <= 0.007d0) then
        tmp = (f * sqrt(0.5d0)) / 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 <= -1650000.0) {
		tmp = (-1.0 / Math.sin(B)) - (x / Math.tan(B));
	} else if (F <= -9.8e-79) {
		tmp = ((F * Math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 4.8e-156) {
		tmp = (x * -Math.cos(B)) / Math.sin(B);
	} else if (F <= 0.007) {
		tmp = (F * Math.sqrt(0.5)) / Math.sin(B);
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1650000.0:
		tmp = (-1.0 / math.sin(B)) - (x / math.tan(B))
	elif F <= -9.8e-79:
		tmp = ((F * math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B
	elif F <= 4.8e-156:
		tmp = (x * -math.cos(B)) / math.sin(B)
	elif F <= 0.007:
		tmp = (F * math.sqrt(0.5)) / math.sin(B)
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1650000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B)));
	elseif (F <= -9.8e-79)
		tmp = Float64(Float64(Float64(F * sqrt(Float64(1.0 / Float64(2.0 + Float64(Float64(F * F) + Float64(x * 2.0)))))) - x) / B);
	elseif (F <= 4.8e-156)
		tmp = Float64(Float64(x * Float64(-cos(B))) / sin(B));
	elseif (F <= 0.007)
		tmp = Float64(Float64(F * sqrt(0.5)) / 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 <= -1650000.0)
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	elseif (F <= -9.8e-79)
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	elseif (F <= 4.8e-156)
		tmp = (x * -cos(B)) / sin(B);
	elseif (F <= 0.007)
		tmp = (F * sqrt(0.5)) / sin(B);
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1650000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -9.8e-79], N[(N[(N[(F * N[Sqrt[N[(1.0 / N[(2.0 + N[(N[(F * F), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.8e-156], N[(N[(x * (-N[Cos[B], $MachinePrecision])), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.007], N[(N[(F * N[Sqrt[0.5], $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 -1650000:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq -9.8 \cdot 10^{-79}:\\
\;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\

\mathbf{elif}\;F \leq 4.8 \cdot 10^{-156}:\\
\;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\

\mathbf{elif}\;F \leq 0.007:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{\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 < -1.65e6

    1. Initial program 55.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. Simplified68.1%

      \[\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 -inf 99.7%

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

    if -1.65e6 < F < -9.8000000000000001e-79

    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. 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 B around 0 99.2%

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

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + \color{blue}{F \cdot F}\right)}} - x}{B} \]
    6. Applied egg-rr99.2%

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

    if -9.8000000000000001e-79 < F < 4.8e-156

    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 99.6%

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

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. sqrt-div99.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg84.5%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
    11. Simplified84.5%

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

    if 4.8e-156 < F < 0.00700000000000000015

    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. 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 99.4%

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}}{\sin B} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative99.4%

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. sqrt-div99.1%

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

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

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

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

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

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

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

    if 0.00700000000000000015 < F

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} + \frac{1}{\sin B} \]
      3. +-commutative68.7%

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \frac{-x}{B}} \]
      4. distribute-frac-neg68.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -9.8 \cdot 10^{-79}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 4.8 \cdot 10^{-156}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.007:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 71.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.05 \cdot 10^{+43}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -8.5 \cdot 10^{-79}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 4.8 \cdot 10^{-156}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.000195:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.05e+43)
   (- (/ -1.0 (sin B)) (/ x B))
   (if (<= F -8.5e-79)
     (/ (- (* F (sqrt (/ 1.0 (+ 2.0 (+ (* F F) (* x 2.0)))))) x) B)
     (if (<= F 4.8e-156)
       (/ (* x (- (cos B))) (sin B))
       (if (<= F 0.000195)
         (/ (* F (sqrt 0.5)) (sin B))
         (- (/ 1.0 (sin B)) (/ x B)))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.05e+43) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= -8.5e-79) {
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 4.8e-156) {
		tmp = (x * -cos(B)) / sin(B);
	} else if (F <= 0.000195) {
		tmp = (F * sqrt(0.5)) / 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 <= (-1.05d+43)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= (-8.5d-79)) then
        tmp = ((f * sqrt((1.0d0 / (2.0d0 + ((f * f) + (x * 2.0d0)))))) - x) / b
    else if (f <= 4.8d-156) then
        tmp = (x * -cos(b)) / sin(b)
    else if (f <= 0.000195d0) then
        tmp = (f * sqrt(0.5d0)) / 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 <= -1.05e+43) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= -8.5e-79) {
		tmp = ((F * Math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else if (F <= 4.8e-156) {
		tmp = (x * -Math.cos(B)) / Math.sin(B);
	} else if (F <= 0.000195) {
		tmp = (F * Math.sqrt(0.5)) / Math.sin(B);
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.05e+43:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= -8.5e-79:
		tmp = ((F * math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B
	elif F <= 4.8e-156:
		tmp = (x * -math.cos(B)) / math.sin(B)
	elif F <= 0.000195:
		tmp = (F * math.sqrt(0.5)) / math.sin(B)
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.05e+43)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= -8.5e-79)
		tmp = Float64(Float64(Float64(F * sqrt(Float64(1.0 / Float64(2.0 + Float64(Float64(F * F) + Float64(x * 2.0)))))) - x) / B);
	elseif (F <= 4.8e-156)
		tmp = Float64(Float64(x * Float64(-cos(B))) / sin(B));
	elseif (F <= 0.000195)
		tmp = Float64(Float64(F * sqrt(0.5)) / 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 <= -1.05e+43)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= -8.5e-79)
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	elseif (F <= 4.8e-156)
		tmp = (x * -cos(B)) / sin(B);
	elseif (F <= 0.000195)
		tmp = (F * sqrt(0.5)) / sin(B);
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.05e+43], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -8.5e-79], N[(N[(N[(F * N[Sqrt[N[(1.0 / N[(2.0 + N[(N[(F * F), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.8e-156], N[(N[(x * (-N[Cos[B], $MachinePrecision])), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.000195], N[(N[(F * N[Sqrt[0.5], $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 -1.05 \cdot 10^{+43}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -8.5 \cdot 10^{-79}:\\
\;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\

\mathbf{elif}\;F \leq 4.8 \cdot 10^{-156}:\\
\;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\

\mathbf{elif}\;F \leq 0.000195:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{\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 < -1.05000000000000001e43

    1. Initial program 54.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. Simplified66.7%

      \[\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 -inf 99.7%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 75.8%

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

    if -1.05000000000000001e43 < F < -8.50000000000000029e-79

    1. Initial program 93.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. 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 B around 0 92.3%

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

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + \color{blue}{F \cdot F}\right)}} - x}{B} \]
    6. Applied egg-rr92.3%

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

    if -8.50000000000000029e-79 < F < 4.8e-156

    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 99.6%

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

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. sqrt-div99.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg84.5%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
    11. Simplified84.5%

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

    if 4.8e-156 < F < 1.94999999999999996e-4

    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. 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 99.4%

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}}{\sin B} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative99.4%

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

      \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + x \cdot 2}}}}{\sin B} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. sqrt-div99.1%

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

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

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

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

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

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

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

    if 1.94999999999999996e-4 < F

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} + \frac{1}{\sin B} \]
      3. +-commutative68.7%

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \frac{-x}{B}} \]
      4. distribute-frac-neg68.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.05 \cdot 10^{+43}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -8.5 \cdot 10^{-79}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{elif}\;F \leq 4.8 \cdot 10^{-156}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.000195:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 64.2% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{2 + x \cdot 2}}\\ \mathbf{if}\;F \leq -0.39:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -2.8 \cdot 10^{-79}:\\ \;\;\;\;t\_0 \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 5.7 \cdot 10^{-140}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.2 \cdot 10^{-9}:\\ \;\;\;\;\frac{F \cdot t\_0 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (sqrt (/ 1.0 (+ 2.0 (* x 2.0))))))
   (if (<= F -0.39)
     (- (/ -1.0 (sin B)) (/ x B))
     (if (<= F -2.8e-79)
       (- (* t_0 (/ F B)) (/ x B))
       (if (<= F 5.7e-140)
         (- (/ -1.0 B) (/ x (tan B)))
         (if (<= F 4.2e-9)
           (/ (- (* F t_0) x) B)
           (- (/ 1.0 (sin B)) (/ x B))))))))
double code(double F, double B, double x) {
	double t_0 = sqrt((1.0 / (2.0 + (x * 2.0))));
	double tmp;
	if (F <= -0.39) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= -2.8e-79) {
		tmp = (t_0 * (F / B)) - (x / B);
	} else if (F <= 5.7e-140) {
		tmp = (-1.0 / B) - (x / tan(B));
	} else if (F <= 4.2e-9) {
		tmp = ((F * t_0) - 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) :: t_0
    real(8) :: tmp
    t_0 = sqrt((1.0d0 / (2.0d0 + (x * 2.0d0))))
    if (f <= (-0.39d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= (-2.8d-79)) then
        tmp = (t_0 * (f / b)) - (x / b)
    else if (f <= 5.7d-140) then
        tmp = ((-1.0d0) / b) - (x / tan(b))
    else if (f <= 4.2d-9) then
        tmp = ((f * t_0) - 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 t_0 = Math.sqrt((1.0 / (2.0 + (x * 2.0))));
	double tmp;
	if (F <= -0.39) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= -2.8e-79) {
		tmp = (t_0 * (F / B)) - (x / B);
	} else if (F <= 5.7e-140) {
		tmp = (-1.0 / B) - (x / Math.tan(B));
	} else if (F <= 4.2e-9) {
		tmp = ((F * t_0) - x) / B;
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = math.sqrt((1.0 / (2.0 + (x * 2.0))))
	tmp = 0
	if F <= -0.39:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= -2.8e-79:
		tmp = (t_0 * (F / B)) - (x / B)
	elif F <= 5.7e-140:
		tmp = (-1.0 / B) - (x / math.tan(B))
	elif F <= 4.2e-9:
		tmp = ((F * t_0) - x) / B
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	t_0 = sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0))))
	tmp = 0.0
	if (F <= -0.39)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= -2.8e-79)
		tmp = Float64(Float64(t_0 * Float64(F / B)) - Float64(x / B));
	elseif (F <= 5.7e-140)
		tmp = Float64(Float64(-1.0 / B) - Float64(x / tan(B)));
	elseif (F <= 4.2e-9)
		tmp = Float64(Float64(Float64(F * t_0) - x) / B);
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = sqrt((1.0 / (2.0 + (x * 2.0))));
	tmp = 0.0;
	if (F <= -0.39)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= -2.8e-79)
		tmp = (t_0 * (F / B)) - (x / B);
	elseif (F <= 5.7e-140)
		tmp = (-1.0 / B) - (x / tan(B));
	elseif (F <= 4.2e-9)
		tmp = ((F * t_0) - x) / B;
	else
		tmp = (1.0 / sin(B)) - (x / B);
	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]}, If[LessEqual[F, -0.39], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -2.8e-79], N[(N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.7e-140], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.2e-9], N[(N[(N[(F * t$95$0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -2.8 \cdot 10^{-79}:\\
\;\;\;\;t\_0 \cdot \frac{F}{B} - \frac{x}{B}\\

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

\mathbf{elif}\;F \leq 4.2 \cdot 10^{-9}:\\
\;\;\;\;\frac{F \cdot t\_0 - x}{B}\\

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


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

    1. Initial program 55.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. Simplified68.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 -inf 99.5%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 75.5%

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

    if -0.39000000000000001 < F < -2.80000000000000012e-79

    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.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 B around 0 99.3%

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

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

    if -2.80000000000000012e-79 < F < 5.7e-140

    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.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 -inf 45.5%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 60.3%

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

    if 5.7e-140 < F < 4.20000000000000039e-9

    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.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 B around 0 57.5%

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

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

    if 4.20000000000000039e-9 < F

    1. Initial program 66.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 37.6%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B} + \frac{1}{\sin B}} \]
    7. Step-by-step derivation
      1. mul-1-neg66.9%

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

        \[\leadsto \color{blue}{\frac{-x}{B}} + \frac{1}{\sin B} \]
      3. +-commutative66.9%

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \frac{-x}{B}} \]
      4. distribute-frac-neg66.9%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{B}} \]
    8. Simplified66.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.39:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -2.8 \cdot 10^{-79}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 5.7 \cdot 10^{-140}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.2 \cdot 10^{-9}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 64.3% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{if}\;F \leq -0.39:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.7 \cdot 10^{-79}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 6 \cdot 10^{-141}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.2 \cdot 10^{-9}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ (- (* F (sqrt (/ 1.0 (+ 2.0 (* x 2.0))))) x) B)))
   (if (<= F -0.39)
     (- (/ -1.0 (sin B)) (/ x B))
     (if (<= F -1.7e-79)
       t_0
       (if (<= F 6e-141)
         (- (/ -1.0 B) (/ x (tan B)))
         (if (<= F 4.2e-9) t_0 (- (/ 1.0 (sin B)) (/ x B))))))))
double code(double F, double B, double x) {
	double t_0 = ((F * sqrt((1.0 / (2.0 + (x * 2.0))))) - x) / B;
	double tmp;
	if (F <= -0.39) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= -1.7e-79) {
		tmp = t_0;
	} else if (F <= 6e-141) {
		tmp = (-1.0 / B) - (x / tan(B));
	} else if (F <= 4.2e-9) {
		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 = ((f * sqrt((1.0d0 / (2.0d0 + (x * 2.0d0))))) - x) / b
    if (f <= (-0.39d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= (-1.7d-79)) then
        tmp = t_0
    else if (f <= 6d-141) then
        tmp = ((-1.0d0) / b) - (x / tan(b))
    else if (f <= 4.2d-9) 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 = ((F * Math.sqrt((1.0 / (2.0 + (x * 2.0))))) - x) / B;
	double tmp;
	if (F <= -0.39) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= -1.7e-79) {
		tmp = t_0;
	} else if (F <= 6e-141) {
		tmp = (-1.0 / B) - (x / Math.tan(B));
	} else if (F <= 4.2e-9) {
		tmp = t_0;
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = ((F * math.sqrt((1.0 / (2.0 + (x * 2.0))))) - x) / B
	tmp = 0
	if F <= -0.39:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= -1.7e-79:
		tmp = t_0
	elif F <= 6e-141:
		tmp = (-1.0 / B) - (x / math.tan(B))
	elif F <= 4.2e-9:
		tmp = t_0
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(Float64(F * sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0))))) - x) / B)
	tmp = 0.0
	if (F <= -0.39)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= -1.7e-79)
		tmp = t_0;
	elseif (F <= 6e-141)
		tmp = Float64(Float64(-1.0 / B) - Float64(x / tan(B)));
	elseif (F <= 4.2e-9)
		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 = ((F * sqrt((1.0 / (2.0 + (x * 2.0))))) - x) / B;
	tmp = 0.0;
	if (F <= -0.39)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= -1.7e-79)
		tmp = t_0;
	elseif (F <= 6e-141)
		tmp = (-1.0 / B) - (x / tan(B));
	elseif (F <= 4.2e-9)
		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[(N[(F * N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[F, -0.39], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.7e-79], t$95$0, If[LessEqual[F, 6e-141], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.2e-9], 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{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\
\mathbf{if}\;F \leq -0.39:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -1.7 \cdot 10^{-79}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;F \leq 4.2 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 55.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. Simplified68.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 -inf 99.5%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 75.5%

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

    if -0.39000000000000001 < F < -1.69999999999999988e-79 or 5.99999999999999967e-141 < F < 4.20000000000000039e-9

    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.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 B around 0 67.0%

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

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

    if -1.69999999999999988e-79 < F < 5.99999999999999967e-141

    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.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 -inf 45.5%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 60.3%

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

    if 4.20000000000000039e-9 < F

    1. Initial program 66.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 37.6%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B} + \frac{1}{\sin B}} \]
    7. Step-by-step derivation
      1. mul-1-neg66.9%

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

        \[\leadsto \color{blue}{\frac{-x}{B}} + \frac{1}{\sin B} \]
      3. +-commutative66.9%

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \frac{-x}{B}} \]
      4. distribute-frac-neg66.9%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{B}} \]
    8. Simplified66.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.39:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.7 \cdot 10^{-79}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{elif}\;F \leq 6 \cdot 10^{-141}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.2 \cdot 10^{-9}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 56.3% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;x \leq -6.6 \cdot 10^{-161}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{-266}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-110}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (/ -1.0 B) (/ x (tan B)))))
   (if (<= x -6.6e-161)
     t_0
     (if (<= x 1.6e-266)
       (/ -1.0 (sin B))
       (if (<= x 1.8e-110) (- (/ 1.0 (sin B)) (/ x B)) t_0)))))
double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / tan(B));
	double tmp;
	if (x <= -6.6e-161) {
		tmp = t_0;
	} else if (x <= 1.6e-266) {
		tmp = -1.0 / sin(B);
	} else if (x <= 1.8e-110) {
		tmp = (1.0 / sin(B)) - (x / B);
	} else {
		tmp = 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) / b) - (x / tan(b))
    if (x <= (-6.6d-161)) then
        tmp = t_0
    else if (x <= 1.6d-266) then
        tmp = (-1.0d0) / sin(b)
    else if (x <= 1.8d-110) then
        tmp = (1.0d0 / sin(b)) - (x / b)
    else
        tmp = t_0
    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 (x <= -6.6e-161) {
		tmp = t_0;
	} else if (x <= 1.6e-266) {
		tmp = -1.0 / Math.sin(B);
	} else if (x <= 1.8e-110) {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (-1.0 / B) - (x / math.tan(B))
	tmp = 0
	if x <= -6.6e-161:
		tmp = t_0
	elif x <= 1.6e-266:
		tmp = -1.0 / math.sin(B)
	elif x <= 1.8e-110:
		tmp = (1.0 / math.sin(B)) - (x / B)
	else:
		tmp = t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(-1.0 / B) - Float64(x / tan(B)))
	tmp = 0.0
	if (x <= -6.6e-161)
		tmp = t_0;
	elseif (x <= 1.6e-266)
		tmp = Float64(-1.0 / sin(B));
	elseif (x <= 1.8e-110)
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = (-1.0 / B) - (x / tan(B));
	tmp = 0.0;
	if (x <= -6.6e-161)
		tmp = t_0;
	elseif (x <= 1.6e-266)
		tmp = -1.0 / sin(B);
	elseif (x <= 1.8e-110)
		tmp = (1.0 / sin(B)) - (x / B);
	else
		tmp = t_0;
	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[x, -6.6e-161], t$95$0, If[LessEqual[x, 1.6e-266], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-110], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.6 \cdot 10^{-266}:\\
\;\;\;\;\frac{-1}{\sin B}\\

\mathbf{elif}\;x \leq 1.8 \cdot 10^{-110}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.5999999999999997e-161 or 1.79999999999999997e-110 < x

    1. Initial program 85.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. Simplified93.7%

      \[\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 -inf 76.2%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 78.1%

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

    if -6.5999999999999997e-161 < x < 1.6e-266

    1. Initial program 74.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. Simplified77.3%

      \[\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 -inf 32.6%

      \[\leadsto F \cdot \color{blue}{\frac{-1}{F \cdot \sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative32.6%

        \[\leadsto F \cdot \frac{-1}{\color{blue}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    6. Simplified32.6%

      \[\leadsto F \cdot \color{blue}{\frac{-1}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    7. Taylor expanded in x around 0 32.8%

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

    if 1.6e-266 < x < 1.79999999999999997e-110

    1. Initial program 62.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 B around 0 56.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} + \frac{1}{\sin B} \]
      3. +-commutative41.7%

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \frac{-x}{B}} \]
      4. distribute-frac-neg41.7%

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

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

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

Alternative 18: 56.2% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq 1.5 \cdot 10^{-22}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= B 1.5e-22)
   (/ (- (* F (sqrt (/ 1.0 (+ 2.0 (+ (* F F) (* x 2.0)))))) x) B)
   (- (/ -1.0 B) (/ x (tan B)))))
double code(double F, double B, double x) {
	double tmp;
	if (B <= 1.5e-22) {
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else {
		tmp = (-1.0 / B) - (x / 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 (b <= 1.5d-22) then
        tmp = ((f * sqrt((1.0d0 / (2.0d0 + ((f * f) + (x * 2.0d0)))))) - x) / b
    else
        tmp = ((-1.0d0) / b) - (x / tan(b))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (B <= 1.5e-22) {
		tmp = ((F * Math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else {
		tmp = (-1.0 / B) - (x / Math.tan(B));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if B <= 1.5e-22:
		tmp = ((F * math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B
	else:
		tmp = (-1.0 / B) - (x / math.tan(B))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (B <= 1.5e-22)
		tmp = Float64(Float64(Float64(F * sqrt(Float64(1.0 / Float64(2.0 + Float64(Float64(F * F) + Float64(x * 2.0)))))) - x) / B);
	else
		tmp = Float64(Float64(-1.0 / B) - Float64(x / tan(B)));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (B <= 1.5e-22)
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	else
		tmp = (-1.0 / B) - (x / tan(B));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[B, 1.5e-22], N[(N[(N[(F * N[Sqrt[N[(1.0 / N[(2.0 + N[(N[(F * F), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.5 \cdot 10^{-22}:\\
\;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 1.5e-22

    1. Initial program 76.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. Simplified86.9%

      \[\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 B around 0 53.5%

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

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

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

    if 1.5e-22 < B

    1. Initial program 86.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. Simplified86.2%

      \[\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 -inf 56.0%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 53.9%

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

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

Alternative 19: 56.2% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.05 \cdot 10^{-159} \lor \neg \left(x \leq 1.05 \cdot 10^{-150}\right):\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (or (<= x -2.05e-159) (not (<= x 1.05e-150)))
   (- (/ -1.0 B) (/ x (tan B)))
   (/ -1.0 (sin B))))
double code(double F, double B, double x) {
	double tmp;
	if ((x <= -2.05e-159) || !(x <= 1.05e-150)) {
		tmp = (-1.0 / B) - (x / tan(B));
	} else {
		tmp = -1.0 / sin(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 <= (-2.05d-159)) .or. (.not. (x <= 1.05d-150))) then
        tmp = ((-1.0d0) / b) - (x / tan(b))
    else
        tmp = (-1.0d0) / sin(b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if ((x <= -2.05e-159) || !(x <= 1.05e-150)) {
		tmp = (-1.0 / B) - (x / Math.tan(B));
	} else {
		tmp = -1.0 / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if (x <= -2.05e-159) or not (x <= 1.05e-150):
		tmp = (-1.0 / B) - (x / math.tan(B))
	else:
		tmp = -1.0 / math.sin(B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if ((x <= -2.05e-159) || !(x <= 1.05e-150))
		tmp = Float64(Float64(-1.0 / B) - Float64(x / tan(B)));
	else
		tmp = Float64(-1.0 / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if ((x <= -2.05e-159) || ~((x <= 1.05e-150)))
		tmp = (-1.0 / B) - (x / tan(B));
	else
		tmp = -1.0 / sin(B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[Or[LessEqual[x, -2.05e-159], N[Not[LessEqual[x, 1.05e-150]], $MachinePrecision]], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{-159} \lor \neg \left(x \leq 1.05 \cdot 10^{-150}\right):\\
\;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.05000000000000007e-159 or 1.0500000000000001e-150 < x

    1. Initial program 83.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. Simplified91.8%

      \[\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 -inf 73.1%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 75.4%

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

    if -2.05000000000000007e-159 < x < 1.0500000000000001e-150

    1. Initial program 70.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. Simplified76.1%

      \[\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 -inf 27.6%

      \[\leadsto F \cdot \color{blue}{\frac{-1}{F \cdot \sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative27.6%

        \[\leadsto F \cdot \frac{-1}{\color{blue}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    6. Simplified27.6%

      \[\leadsto F \cdot \color{blue}{\frac{-1}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    7. Taylor expanded in x around 0 27.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.05 \cdot 10^{-159} \lor \neg \left(x \leq 1.05 \cdot 10^{-150}\right):\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 44.4% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -0.0102:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -0.0102)
   (/ -1.0 (sin B))
   (if (<= F 6.2e-25) (/ x (- B)) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -0.0102) {
		tmp = -1.0 / sin(B);
	} else if (F <= 6.2e-25) {
		tmp = x / -B;
	} else {
		tmp = (1.0 - 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 <= (-0.0102d0)) then
        tmp = (-1.0d0) / sin(b)
    else if (f <= 6.2d-25) then
        tmp = x / -b
    else
        tmp = (1.0d0 - x) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -0.0102) {
		tmp = -1.0 / Math.sin(B);
	} else if (F <= 6.2e-25) {
		tmp = x / -B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -0.0102:
		tmp = -1.0 / math.sin(B)
	elif F <= 6.2e-25:
		tmp = x / -B
	else:
		tmp = (1.0 - x) / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -0.0102)
		tmp = Float64(-1.0 / sin(B));
	elseif (F <= 6.2e-25)
		tmp = Float64(x / Float64(-B));
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -0.0102)
		tmp = -1.0 / sin(B);
	elseif (F <= 6.2e-25)
		tmp = x / -B;
	else
		tmp = (1.0 - x) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -0.0102], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.2e-25], N[(x / (-B)), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.0102:\\
\;\;\;\;\frac{-1}{\sin B}\\

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

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


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

    1. Initial program 56.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. Simplified69.1%

      \[\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 -inf 98.0%

      \[\leadsto F \cdot \color{blue}{\frac{-1}{F \cdot \sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative98.0%

        \[\leadsto F \cdot \frac{-1}{\color{blue}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    6. Simplified98.0%

      \[\leadsto F \cdot \color{blue}{\frac{-1}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    7. Taylor expanded in x around 0 55.9%

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

    if -0.010200000000000001 < F < 6.19999999999999989e-25

    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.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 B around 0 48.3%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    7. Simplified32.0%

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

    if 6.19999999999999989e-25 < F

    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. Simplified82.9%

      \[\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 B around 0 35.1%

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

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

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

Alternative 21: 44.1% accurate, 21.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -6.2 \cdot 10^{-57}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 7.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -6.2e-57)
   (/ (- -1.0 x) B)
   (if (<= F 7.8e-25) (/ x (- B)) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -6.2e-57) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 7.8e-25) {
		tmp = x / -B;
	} else {
		tmp = (1.0 - 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 <= (-6.2d-57)) then
        tmp = ((-1.0d0) - x) / b
    else if (f <= 7.8d-25) then
        tmp = x / -b
    else
        tmp = (1.0d0 - x) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -6.2e-57) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 7.8e-25) {
		tmp = x / -B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -6.2e-57:
		tmp = (-1.0 - x) / B
	elif F <= 7.8e-25:
		tmp = x / -B
	else:
		tmp = (1.0 - x) / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -6.2e-57)
		tmp = Float64(Float64(-1.0 - x) / B);
	elseif (F <= 7.8e-25)
		tmp = Float64(x / Float64(-B));
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -6.2e-57)
		tmp = (-1.0 - x) / B;
	elseif (F <= 7.8e-25)
		tmp = x / -B;
	else
		tmp = (1.0 - x) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -6.2e-57], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.8e-25], N[(x / (-B)), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    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. Simplified71.1%

      \[\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 B around 0 38.0%

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

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

    if -6.19999999999999952e-57 < F < 7.8e-25

    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.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 B around 0 46.0%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    7. Simplified32.5%

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

    if 7.8e-25 < F

    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. Simplified82.9%

      \[\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 B around 0 35.1%

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

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

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

Alternative 22: 37.0% accurate, 32.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.55 \cdot 10^{-60}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.55e-60) (/ (- -1.0 x) B) (/ x (- B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.55e-60) {
		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 <= (-1.55d-60)) 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 <= -1.55e-60) {
		tmp = (-1.0 - x) / B;
	} else {
		tmp = x / -B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.55e-60:
		tmp = (-1.0 - x) / B
	else:
		tmp = x / -B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.55e-60)
		tmp = Float64(Float64(-1.0 - x) / B);
	else
		tmp = Float64(x / Float64(-B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1.55e-60)
		tmp = (-1.0 - x) / B;
	else
		tmp = x / -B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.55e-60], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[(x / (-B)), $MachinePrecision]]
\begin{array}{l}

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

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


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

    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. Simplified71.1%

      \[\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 B around 0 38.0%

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

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

    if -1.54999999999999994e-60 < F

    1. Initial program 87.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. Simplified93.2%

      \[\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 B around 0 41.8%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    7. Simplified28.6%

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

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

Alternative 23: 29.9% accurate, 35.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.9 \cdot 10^{+174}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.9e+174) (/ -1.0 B) (/ x (- B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.9e+174) {
		tmp = -1.0 / 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 <= (-1.9d+174)) then
        tmp = (-1.0d0) / 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 <= -1.9e+174) {
		tmp = -1.0 / B;
	} else {
		tmp = x / -B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.9e+174:
		tmp = -1.0 / B
	else:
		tmp = x / -B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.9e+174)
		tmp = Float64(-1.0 / B);
	else
		tmp = Float64(x / Float64(-B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1.9e+174)
		tmp = -1.0 / B;
	else
		tmp = x / -B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.9e+174], N[(-1.0 / B), $MachinePrecision], N[(x / (-B)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.9 \cdot 10^{+174}:\\
\;\;\;\;\frac{-1}{B}\\

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


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

    1. Initial program 35.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. Simplified45.2%

      \[\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 B around 0 12.4%

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

      \[\leadsto \frac{\color{blue}{-1} - x}{B} \]
    6. Taylor expanded in x around 0 28.3%

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

    if -1.9000000000000001e174 < F

    1. Initial program 85.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. Simplified92.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 B around 0 44.7%

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

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

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

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

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

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

Alternative 24: 10.6% accurate, 108.0× speedup?

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

\\
\frac{-1}{B}
\end{array}
Derivation
  1. Initial program 79.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. Simplified86.7%

    \[\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 B around 0 40.7%

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

    \[\leadsto \frac{\color{blue}{-1} - x}{B} \]
  6. Taylor expanded in x around 0 9.9%

    \[\leadsto \color{blue}{\frac{-1}{B}} \]
  7. Add Preprocessing

Reproduce

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