VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.9% → 99.7%
Time: 30.3s
Alternatives: 22
Speedup: 1.5×

Specification

?
\[\begin{array}{l} \\ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (+
  (- (* x (/ 1.0 (tan B))))
  (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
	return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
	return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x):
	return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x)
	return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0)))))
end
function tmp = code(F, B, x)
	tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0)));
end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 22 alternatives:

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

Initial Program: 76.9% 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.7% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;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} - t\_0\\


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

    1. Initial program 65.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 99.8%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv99.9%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr99.9%

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

    if -3.45e19 < F < 1e8

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

    if 1e8 < F

    1. Initial program 55.8%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 70.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/70.5%

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -3.6 \cdot 10^{+34}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 5300000000:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x \cdot \cos B}{\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 -3.6e+34)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 5300000000.0)
       (-
        (* (/ F (sin B)) (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5))
        (/ (* x (cos B)) (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 <= -3.6e+34) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 5300000000.0) {
		tmp = ((F / sin(B)) * pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - ((x * cos(B)) / 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 <= (-3.6d+34)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= 5300000000.0d0) then
        tmp = ((f / sin(b)) * (((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0))) - ((x * cos(b)) / 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 <= -3.6e+34) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= 5300000000.0) {
		tmp = ((F / Math.sin(B)) * Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - ((x * Math.cos(B)) / 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 <= -3.6e+34:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= 5300000000.0:
		tmp = ((F / math.sin(B)) * math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) - ((x * math.cos(B)) / 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 <= -3.6e+34)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 5300000000.0)
		tmp = Float64(Float64(Float64(F / sin(B)) * (Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5)) - Float64(Float64(x * cos(B)) / 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 <= -3.6e+34)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= 5300000000.0)
		tmp = ((F / sin(B)) * (((2.0 + (F * F)) + (x * 2.0)) ^ -0.5)) - ((x * cos(B)) / 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, -3.6e+34], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 5300000000.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[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $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 -3.6 \cdot 10^{+34}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\

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

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


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

    1. Initial program 63.2%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 99.8%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv99.9%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr99.9%

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

    if -3.6e34 < F < 5.3e9

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 99.5%

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

    if 5.3e9 < F

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

      \[\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/70.1%

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

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

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

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

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

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

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

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

Alternative 3: 99.7% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 65.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 99.8%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv99.9%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr99.9%

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

    if -5e19 < F < 1.1e8

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

      \[\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 1.1e8 < F

    1. Initial program 55.8%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 70.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/70.5%

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

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

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

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

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

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

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

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

Alternative 4: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -2.23 \cdot 10^{+43}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 75000000:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} + x \cdot \frac{-1}{\tan 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 -2.23e+43)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 75000000.0)
       (+
        (* (/ F (sin B)) (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5))
        (* x (/ -1.0 (tan 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 <= -2.23e+43) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 75000000.0) {
		tmp = ((F / sin(B)) * pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) + (x * (-1.0 / tan(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 <= (-2.23d+43)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= 75000000.0d0) then
        tmp = ((f / sin(b)) * (((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0))) + (x * ((-1.0d0) / tan(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 <= -2.23e+43) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= 75000000.0) {
		tmp = ((F / Math.sin(B)) * Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) + (x * (-1.0 / Math.tan(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 <= -2.23e+43:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= 75000000.0:
		tmp = ((F / math.sin(B)) * math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) + (x * (-1.0 / math.tan(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 <= -2.23e+43)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 75000000.0)
		tmp = Float64(Float64(Float64(F / sin(B)) * (Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5)) + Float64(x * Float64(-1.0 / tan(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 <= -2.23e+43)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= 75000000.0)
		tmp = ((F / sin(B)) * (((2.0 + (F * F)) + (x * 2.0)) ^ -0.5)) + (x * (-1.0 / tan(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, -2.23e+43], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 75000000.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 * N[(-1.0 / N[Tan[B], $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 -2.23 \cdot 10^{+43}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\

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

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


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

    1. Initial program 61.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 99.8%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv99.9%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr99.9%

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

    if -2.23e43 < F < 7.5e7

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing

    if 7.5e7 < F

    1. Initial program 55.8%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 70.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/70.5%

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

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

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

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

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

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

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

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

Alternative 5: 99.1% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;F \cdot \left(t\_0 \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - t\_1\\

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


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

    1. Initial program 68.4%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 99.5%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv99.6%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr99.6%

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

    if -1.4199999999999999 < F < 1.3999999999999999

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified99.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 0 98.9%

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

    if 1.3999999999999999 < F

    1. Initial program 55.8%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 70.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/70.5%

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

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

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

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

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

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

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

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

Alternative 6: 99.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1.42:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 1.4:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - t\_0\\ \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 -1.42)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 1.4)
       (- (* F (/ (sqrt 0.5) (sin B))) t_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 <= -1.42) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 1.4) {
		tmp = (F * (sqrt(0.5) / sin(B))) - t_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 <= (-1.42d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= 1.4d0) then
        tmp = (f * (sqrt(0.5d0) / sin(b))) - t_0
    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 <= -1.42) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= 1.4) {
		tmp = (F * (Math.sqrt(0.5) / Math.sin(B))) - t_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 <= -1.42:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= 1.4:
		tmp = (F * (math.sqrt(0.5) / math.sin(B))) - t_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 <= -1.42)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 1.4)
		tmp = Float64(Float64(F * Float64(sqrt(0.5) / sin(B))) - t_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 <= -1.42)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= 1.4)
		tmp = (F * (sqrt(0.5) / sin(B))) - t_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, -1.42], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 1.4], N[(N[(F * N[(N[Sqrt[0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $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 -1.42:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\

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

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


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

    1. Initial program 68.4%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 99.5%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv99.6%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr99.6%

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

    if -1.4199999999999999 < F < 1.3999999999999999

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified99.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 x around 0 99.4%

      \[\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} \]
    7. Taylor expanded in F around 0 98.8%

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

    if 1.3999999999999999 < F

    1. Initial program 55.8%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 70.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/70.5%

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

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

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

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

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

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

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

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

Alternative 7: 89.7% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -1.45 \cdot 10^{-190}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 67.1%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 99.8%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv99.9%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr99.9%

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

    if -3.05e13 < F < -1.4500000000000001e-190 or 3.5999999999999998e-153 < F < 3.8e-6

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0 77.3%

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

    if -1.4500000000000001e-190 < F < 3.5999999999999998e-153

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 37.6%

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative87.4%

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

        \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    6. Simplified87.4%

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

    if 3.8e-6 < F

    1. Initial program 57.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. Simplified71.4%

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

      \[\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/71.3%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -30500000000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.45 \cdot 10^{-190}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 3.6 \cdot 10^{-153}:\\ \;\;\;\;\cos B \cdot \left(-\frac{x}{\sin B}\right)\\ \mathbf{elif}\;F \leq 3.8 \cdot 10^{-6}:\\ \;\;\;\;\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 8: 92.4% accurate, 1.4× speedup?

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

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

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

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

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


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

    1. Initial program 67.1%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 99.8%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv99.9%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr99.9%

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

    if -3.05e13 < F < -3.15000000000000007e-114

    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. Taylor expanded in B around 0 83.4%

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

    if -3.15000000000000007e-114 < F < 5.3e9

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv99.7%

        \[\leadsto \left(-\color{blue}{\frac{x}{\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. clear-num99.4%

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

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

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

    if 5.3e9 < F

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

      \[\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/70.1%

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

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

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

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

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

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

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

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

Alternative 9: 85.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1.65 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-12}:\\ \;\;\;\;\cos B \cdot \left(-\frac{x}{\sin B}\right)\\ \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 -1.65e-68)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 5e-12) (* (cos B) (- (/ x (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 <= -1.65e-68) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 5e-12) {
		tmp = cos(B) * -(x / 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 <= (-1.65d-68)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= 5d-12) then
        tmp = cos(b) * -(x / 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 <= -1.65e-68) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= 5e-12) {
		tmp = Math.cos(B) * -(x / 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 <= -1.65e-68:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= 5e-12:
		tmp = math.cos(B) * -(x / 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 <= -1.65e-68)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 5e-12)
		tmp = Float64(cos(B) * Float64(-Float64(x / 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 <= -1.65e-68)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= 5e-12)
		tmp = cos(B) * -(x / 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, -1.65e-68], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 5e-12], N[(N[Cos[B], $MachinePrecision] * (-N[(x / N[Sin[B], $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 -1.65 \cdot 10^{-68}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\

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

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


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

    1. Initial program 73.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 90.8%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv90.9%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr90.9%

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

    if -1.6499999999999999e-68 < F < 4.9999999999999997e-12

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 39.4%

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative70.1%

        \[\leadsto -\color{blue}{\cos B \cdot \frac{x}{\sin B}} \]
      4. distribute-rgt-neg-in70.1%

        \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    6. Simplified70.1%

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

    if 4.9999999999999997e-12 < F

    1. Initial program 58.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. Simplified72.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 x around 0 72.1%

      \[\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/72.1%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.65 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-12}:\\ \;\;\;\;\cos B \cdot \left(-\frac{x}{\sin B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 69.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1.55 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1}{B} - t\_0\\ \mathbf{elif}\;F \leq 3.9 \cdot 10^{-140}:\\ \;\;\;\;\cos B \cdot \left(-\frac{x}{\sin B}\right)\\ \mathbf{elif}\;F \leq 1.55 \cdot 10^{+133} \lor \neg \left(F \leq 2 \cdot 10^{+172}\right):\\ \;\;\;\;\frac{1}{B} - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1.55e-68)
     (- (/ -1.0 B) t_0)
     (if (<= F 3.9e-140)
       (* (cos B) (- (/ x (sin B))))
       (if (or (<= F 1.55e+133) (not (<= F 2e+172)))
         (- (/ 1.0 B) t_0)
         (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1.55e-68) {
		tmp = (-1.0 / B) - t_0;
	} else if (F <= 3.9e-140) {
		tmp = cos(B) * -(x / sin(B));
	} else if ((F <= 1.55e+133) || !(F <= 2e+172)) {
		tmp = (1.0 / B) - t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = x / tan(b)
    if (f <= (-1.55d-68)) then
        tmp = ((-1.0d0) / b) - t_0
    else if (f <= 3.9d-140) then
        tmp = cos(b) * -(x / sin(b))
    else if ((f <= 1.55d+133) .or. (.not. (f <= 2d+172))) then
        tmp = (1.0d0 / b) - t_0
    else
        tmp = 1.0d0 / 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.55e-68) {
		tmp = (-1.0 / B) - t_0;
	} else if (F <= 3.9e-140) {
		tmp = Math.cos(B) * -(x / Math.sin(B));
	} else if ((F <= 1.55e+133) || !(F <= 2e+172)) {
		tmp = (1.0 / B) - t_0;
	} else {
		tmp = 1.0 / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -1.55e-68:
		tmp = (-1.0 / B) - t_0
	elif F <= 3.9e-140:
		tmp = math.cos(B) * -(x / math.sin(B))
	elif (F <= 1.55e+133) or not (F <= 2e+172):
		tmp = (1.0 / B) - t_0
	else:
		tmp = 1.0 / math.sin(B)
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1.55e-68)
		tmp = Float64(Float64(-1.0 / B) - t_0);
	elseif (F <= 3.9e-140)
		tmp = Float64(cos(B) * Float64(-Float64(x / sin(B))));
	elseif ((F <= 1.55e+133) || !(F <= 2e+172))
		tmp = Float64(Float64(1.0 / B) - t_0);
	else
		tmp = Float64(1.0 / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= -1.55e-68)
		tmp = (-1.0 / B) - t_0;
	elseif (F <= 3.9e-140)
		tmp = cos(B) * -(x / sin(B));
	elseif ((F <= 1.55e+133) || ~((F <= 2e+172)))
		tmp = (1.0 / B) - t_0;
	else
		tmp = 1.0 / 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.55e-68], N[(N[(-1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 3.9e-140], N[(N[Cos[B], $MachinePrecision] * (-N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[Or[LessEqual[F, 1.55e+133], N[Not[LessEqual[F, 2e+172]], $MachinePrecision]], N[(N[(1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;F \leq 1.55 \cdot 10^{+133} \lor \neg \left(F \leq 2 \cdot 10^{+172}\right):\\
\;\;\;\;\frac{1}{B} - t\_0\\

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


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

    1. Initial program 73.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 90.8%

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

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

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

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

    if -1.55e-68 < F < 3.90000000000000019e-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. Add Preprocessing
    3. Taylor expanded in F around -inf 37.0%

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative74.2%

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

        \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    6. Simplified74.2%

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

    if 3.90000000000000019e-140 < F < 1.55e133 or 2.0000000000000002e172 < F

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

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

      \[\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/80.1%

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

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

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

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

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

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

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

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

    if 1.55e133 < F < 2.0000000000000002e172

    1. Initial program 40.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. Simplified51.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 x around 0 51.7%

      \[\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/51.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.55 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 3.9 \cdot 10^{-140}:\\ \;\;\;\;\cos B \cdot \left(-\frac{x}{\sin B}\right)\\ \mathbf{elif}\;F \leq 1.55 \cdot 10^{+133} \lor \neg \left(F \leq 2 \cdot 10^{+172}\right):\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 76.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1.7 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 7.2 \cdot 10^{-140}:\\ \;\;\;\;\cos B \cdot \left(-\frac{x}{\sin B}\right)\\ \mathbf{elif}\;F \leq 1.25 \cdot 10^{+133} \lor \neg \left(F \leq 2.5 \cdot 10^{+173}\right):\\ \;\;\;\;\frac{1}{B} - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1.7e-68)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 7.2e-140)
       (* (cos B) (- (/ x (sin B))))
       (if (or (<= F 1.25e+133) (not (<= F 2.5e+173)))
         (- (/ 1.0 B) t_0)
         (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1.7e-68) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 7.2e-140) {
		tmp = cos(B) * -(x / sin(B));
	} else if ((F <= 1.25e+133) || !(F <= 2.5e+173)) {
		tmp = (1.0 / B) - t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = x / tan(b)
    if (f <= (-1.7d-68)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= 7.2d-140) then
        tmp = cos(b) * -(x / sin(b))
    else if ((f <= 1.25d+133) .or. (.not. (f <= 2.5d+173))) then
        tmp = (1.0d0 / b) - t_0
    else
        tmp = 1.0d0 / 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.7e-68) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= 7.2e-140) {
		tmp = Math.cos(B) * -(x / Math.sin(B));
	} else if ((F <= 1.25e+133) || !(F <= 2.5e+173)) {
		tmp = (1.0 / B) - t_0;
	} else {
		tmp = 1.0 / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -1.7e-68:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= 7.2e-140:
		tmp = math.cos(B) * -(x / math.sin(B))
	elif (F <= 1.25e+133) or not (F <= 2.5e+173):
		tmp = (1.0 / B) - t_0
	else:
		tmp = 1.0 / math.sin(B)
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1.7e-68)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 7.2e-140)
		tmp = Float64(cos(B) * Float64(-Float64(x / sin(B))));
	elseif ((F <= 1.25e+133) || !(F <= 2.5e+173))
		tmp = Float64(Float64(1.0 / B) - t_0);
	else
		tmp = Float64(1.0 / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= -1.7e-68)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= 7.2e-140)
		tmp = cos(B) * -(x / sin(B));
	elseif ((F <= 1.25e+133) || ~((F <= 2.5e+173)))
		tmp = (1.0 / B) - t_0;
	else
		tmp = 1.0 / 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.7e-68], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 7.2e-140], N[(N[Cos[B], $MachinePrecision] * (-N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[Or[LessEqual[F, 1.25e+133], N[Not[LessEqual[F, 2.5e+173]], $MachinePrecision]], N[(N[(1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;F \leq 1.25 \cdot 10^{+133} \lor \neg \left(F \leq 2.5 \cdot 10^{+173}\right):\\
\;\;\;\;\frac{1}{B} - t\_0\\

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


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

    1. Initial program 73.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 90.8%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv90.9%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr90.9%

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

    if -1.70000000000000009e-68 < F < 7.2000000000000001e-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. Add Preprocessing
    3. Taylor expanded in F around -inf 37.0%

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative74.2%

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

        \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    6. Simplified74.2%

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

    if 7.2000000000000001e-140 < F < 1.2499999999999999e133 or 2.50000000000000017e173 < F

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

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

      \[\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/80.1%

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

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

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

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

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

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

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

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

    if 1.2499999999999999e133 < F < 2.50000000000000017e173

    1. Initial program 40.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. Simplified51.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 x around 0 51.7%

      \[\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/51.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.7 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 7.2 \cdot 10^{-140}:\\ \;\;\;\;\cos B \cdot \left(-\frac{x}{\sin B}\right)\\ \mathbf{elif}\;F \leq 1.25 \cdot 10^{+133} \lor \neg \left(F \leq 2.5 \cdot 10^{+173}\right):\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 60.4% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -4.5 \cdot 10^{-18}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 5.6 \cdot 10^{-287}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{-177}:\\ \;\;\;\;\cos B \cdot \frac{x}{-B}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{+133} \lor \neg \left(F \leq 3.8 \cdot 10^{+172}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (/ 1.0 B) (/ x (tan B)))))
   (if (<= F -4.5e-18)
     (- (/ -1.0 (sin B)) (/ x B))
     (if (<= F 5.6e-287)
       t_0
       (if (<= F 1.35e-177)
         (* (cos B) (/ x (- B)))
         (if (or (<= F 1.35e+133) (not (<= F 3.8e+172)))
           t_0
           (/ 1.0 (sin B))))))))
double code(double F, double B, double x) {
	double t_0 = (1.0 / B) - (x / tan(B));
	double tmp;
	if (F <= -4.5e-18) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= 5.6e-287) {
		tmp = t_0;
	} else if (F <= 1.35e-177) {
		tmp = cos(B) * (x / -B);
	} else if ((F <= 1.35e+133) || !(F <= 3.8e+172)) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = (1.0d0 / b) - (x / tan(b))
    if (f <= (-4.5d-18)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= 5.6d-287) then
        tmp = t_0
    else if (f <= 1.35d-177) then
        tmp = cos(b) * (x / -b)
    else if ((f <= 1.35d+133) .or. (.not. (f <= 3.8d+172))) then
        tmp = t_0
    else
        tmp = 1.0d0 / sin(b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = (1.0 / B) - (x / Math.tan(B));
	double tmp;
	if (F <= -4.5e-18) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= 5.6e-287) {
		tmp = t_0;
	} else if (F <= 1.35e-177) {
		tmp = Math.cos(B) * (x / -B);
	} else if ((F <= 1.35e+133) || !(F <= 3.8e+172)) {
		tmp = t_0;
	} else {
		tmp = 1.0 / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (1.0 / B) - (x / math.tan(B))
	tmp = 0
	if F <= -4.5e-18:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= 5.6e-287:
		tmp = t_0
	elif F <= 1.35e-177:
		tmp = math.cos(B) * (x / -B)
	elif (F <= 1.35e+133) or not (F <= 3.8e+172):
		tmp = t_0
	else:
		tmp = 1.0 / math.sin(B)
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(1.0 / B) - Float64(x / tan(B)))
	tmp = 0.0
	if (F <= -4.5e-18)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= 5.6e-287)
		tmp = t_0;
	elseif (F <= 1.35e-177)
		tmp = Float64(cos(B) * Float64(x / Float64(-B)));
	elseif ((F <= 1.35e+133) || !(F <= 3.8e+172))
		tmp = t_0;
	else
		tmp = Float64(1.0 / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = (1.0 / B) - (x / tan(B));
	tmp = 0.0;
	if (F <= -4.5e-18)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= 5.6e-287)
		tmp = t_0;
	elseif (F <= 1.35e-177)
		tmp = cos(B) * (x / -B);
	elseif ((F <= 1.35e+133) || ~((F <= 3.8e+172)))
		tmp = t_0;
	else
		tmp = 1.0 / sin(B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4.5e-18], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.6e-287], t$95$0, If[LessEqual[F, 1.35e-177], N[(N[Cos[B], $MachinePrecision] * N[(x / (-B)), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[F, 1.35e+133], N[Not[LessEqual[F, 3.8e+172]], $MachinePrecision]], t$95$0, N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq 5.6 \cdot 10^{-287}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 1.35 \cdot 10^{-177}:\\
\;\;\;\;\cos B \cdot \frac{x}{-B}\\

\mathbf{elif}\;F \leq 1.35 \cdot 10^{+133} \lor \neg \left(F \leq 3.8 \cdot 10^{+172}\right):\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 69.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 97.3%

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

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

    if -4.49999999999999994e-18 < F < 5.6000000000000005e-287 or 1.3500000000000001e-177 < F < 1.3500000000000001e133 or 3.7999999999999997e172 < F

    1. Initial program 82.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. Simplified88.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 88.2%

      \[\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/88.3%

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

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

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

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

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

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

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

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

    if 5.6000000000000005e-287 < F < 1.3500000000000001e-177

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 20.8%

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative82.9%

        \[\leadsto -\color{blue}{\cos B \cdot \frac{x}{\sin B}} \]
      4. distribute-rgt-neg-in82.9%

        \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    6. Simplified82.9%

      \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    7. Taylor expanded in B around 0 56.8%

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

    if 1.3500000000000001e133 < F < 3.7999999999999997e172

    1. Initial program 40.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. Simplified51.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 x around 0 51.7%

      \[\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/51.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -4.5 \cdot 10^{-18}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 5.6 \cdot 10^{-287}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{-177}:\\ \;\;\;\;\cos B \cdot \frac{x}{-B}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{+133} \lor \neg \left(F \leq 3.8 \cdot 10^{+172}\right):\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 55.5% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{x}{\tan B}\\
t_2 := \frac{1}{B} - t\_1\\
\mathbf{if}\;x \leq -4.1 \cdot 10^{-144}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq -1.15 \cdot 10^{-200}:\\
\;\;\;\;t\_1 + \frac{-1}{B}\\

\mathbf{elif}\;x \leq 1.4 \cdot 10^{-217}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 4 \cdot 10^{-159}:\\
\;\;\;\;\cos B \cdot \frac{x}{-B}\\

\mathbf{elif}\;x \leq 1.3 \cdot 10^{-23}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -4.1e-144 or 1.3e-23 < x

    1. Initial program 80.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. Simplified92.0%

      \[\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 91.8%

      \[\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/91.8%

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

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

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

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

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

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

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

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

    if -4.1e-144 < x < -1.15000000000000004e-200

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\tan B} + \frac{-1}{B}} \]
      2. +-commutative53.6%

        \[\leadsto \color{blue}{\frac{-1}{B} + \frac{x}{\tan B}} \]
    8. Simplified53.6%

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

    if -1.15000000000000004e-200 < x < 1.4e-217 or 3.99999999999999995e-159 < x < 1.3e-23

    1. Initial program 68.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. Simplified73.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 x around 0 73.9%

      \[\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/73.9%

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

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

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

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

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

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

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

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

    if 1.4e-217 < x < 3.99999999999999995e-159

    1. Initial program 88.0%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 38.3%

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative42.4%

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

        \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    6. Simplified42.4%

      \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    7. Taylor expanded in B around 0 31.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.1 \cdot 10^{-144}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-200}:\\ \;\;\;\;\frac{x}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-217}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-159}:\\ \;\;\;\;\cos B \cdot \frac{x}{-B}\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-23}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 60.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq 6.2 \cdot 10^{-287}:\\ \;\;\;\;\frac{-1}{B} - t\_0\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-185}:\\ \;\;\;\;\cos B \cdot \frac{x}{-B}\\ \mathbf{elif}\;F \leq 1.45 \cdot 10^{+133} \lor \neg \left(F \leq 3.8 \cdot 10^{+172}\right):\\ \;\;\;\;\frac{1}{B} - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F 6.2e-287)
     (- (/ -1.0 B) t_0)
     (if (<= F 5.8e-185)
       (* (cos B) (/ x (- B)))
       (if (or (<= F 1.45e+133) (not (<= F 3.8e+172)))
         (- (/ 1.0 B) t_0)
         (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= 6.2e-287) {
		tmp = (-1.0 / B) - t_0;
	} else if (F <= 5.8e-185) {
		tmp = cos(B) * (x / -B);
	} else if ((F <= 1.45e+133) || !(F <= 3.8e+172)) {
		tmp = (1.0 / B) - t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = x / tan(b)
    if (f <= 6.2d-287) then
        tmp = ((-1.0d0) / b) - t_0
    else if (f <= 5.8d-185) then
        tmp = cos(b) * (x / -b)
    else if ((f <= 1.45d+133) .or. (.not. (f <= 3.8d+172))) then
        tmp = (1.0d0 / b) - t_0
    else
        tmp = 1.0d0 / 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 <= 6.2e-287) {
		tmp = (-1.0 / B) - t_0;
	} else if (F <= 5.8e-185) {
		tmp = Math.cos(B) * (x / -B);
	} else if ((F <= 1.45e+133) || !(F <= 3.8e+172)) {
		tmp = (1.0 / B) - t_0;
	} else {
		tmp = 1.0 / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= 6.2e-287:
		tmp = (-1.0 / B) - t_0
	elif F <= 5.8e-185:
		tmp = math.cos(B) * (x / -B)
	elif (F <= 1.45e+133) or not (F <= 3.8e+172):
		tmp = (1.0 / B) - t_0
	else:
		tmp = 1.0 / math.sin(B)
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= 6.2e-287)
		tmp = Float64(Float64(-1.0 / B) - t_0);
	elseif (F <= 5.8e-185)
		tmp = Float64(cos(B) * Float64(x / Float64(-B)));
	elseif ((F <= 1.45e+133) || !(F <= 3.8e+172))
		tmp = Float64(Float64(1.0 / B) - t_0);
	else
		tmp = Float64(1.0 / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= 6.2e-287)
		tmp = (-1.0 / B) - t_0;
	elseif (F <= 5.8e-185)
		tmp = cos(B) * (x / -B);
	elseif ((F <= 1.45e+133) || ~((F <= 3.8e+172)))
		tmp = (1.0 / B) - t_0;
	else
		tmp = 1.0 / 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, 6.2e-287], N[(N[(-1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 5.8e-185], N[(N[Cos[B], $MachinePrecision] * N[(x / (-B)), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[F, 1.45e+133], N[Not[LessEqual[F, 3.8e+172]], $MachinePrecision]], N[(N[(1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq 5.8 \cdot 10^{-185}:\\
\;\;\;\;\cos B \cdot \frac{x}{-B}\\

\mathbf{elif}\;F \leq 1.45 \cdot 10^{+133} \lor \neg \left(F \leq 3.8 \cdot 10^{+172}\right):\\
\;\;\;\;\frac{1}{B} - t\_0\\

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


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

    1. Initial program 81.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 76.8%

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

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

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

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

    if 6.2000000000000001e-287 < F < 5.79999999999999989e-185

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 20.8%

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative82.9%

        \[\leadsto -\color{blue}{\cos B \cdot \frac{x}{\sin B}} \]
      4. distribute-rgt-neg-in82.9%

        \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    6. Simplified82.9%

      \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
    7. Taylor expanded in B around 0 56.8%

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

    if 5.79999999999999989e-185 < F < 1.4500000000000001e133 or 3.7999999999999997e172 < F

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

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

      \[\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/81.4%

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

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

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

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

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

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

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

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

    if 1.4500000000000001e133 < F < 3.7999999999999997e172

    1. Initial program 40.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. Simplified51.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 x around 0 51.7%

      \[\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/51.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 6.2 \cdot 10^{-287}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-185}:\\ \;\;\;\;\cos B \cdot \frac{x}{-B}\\ \mathbf{elif}\;F \leq 1.45 \cdot 10^{+133} \lor \neg \left(F \leq 3.8 \cdot 10^{+172}\right):\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 61.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq 10^{-292}:\\ \;\;\;\;\frac{-1}{B} - t\_0\\ \mathbf{elif}\;F \leq 1.15 \cdot 10^{-111}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 9.5 \cdot 10^{+132} \lor \neg \left(F \leq 3.8 \cdot 10^{+172}\right):\\ \;\;\;\;\frac{1}{B} - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F 1e-292)
     (- (/ -1.0 B) t_0)
     (if (<= F 1.15e-111)
       (- (* (sqrt (/ 1.0 (+ 2.0 (* x 2.0)))) (/ F B)) (/ x B))
       (if (or (<= F 9.5e+132) (not (<= F 3.8e+172)))
         (- (/ 1.0 B) t_0)
         (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= 1e-292) {
		tmp = (-1.0 / B) - t_0;
	} else if (F <= 1.15e-111) {
		tmp = (sqrt((1.0 / (2.0 + (x * 2.0)))) * (F / B)) - (x / B);
	} else if ((F <= 9.5e+132) || !(F <= 3.8e+172)) {
		tmp = (1.0 / B) - t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = x / tan(b)
    if (f <= 1d-292) then
        tmp = ((-1.0d0) / b) - t_0
    else if (f <= 1.15d-111) then
        tmp = (sqrt((1.0d0 / (2.0d0 + (x * 2.0d0)))) * (f / b)) - (x / b)
    else if ((f <= 9.5d+132) .or. (.not. (f <= 3.8d+172))) then
        tmp = (1.0d0 / b) - t_0
    else
        tmp = 1.0d0 / 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 <= 1e-292) {
		tmp = (-1.0 / B) - t_0;
	} else if (F <= 1.15e-111) {
		tmp = (Math.sqrt((1.0 / (2.0 + (x * 2.0)))) * (F / B)) - (x / B);
	} else if ((F <= 9.5e+132) || !(F <= 3.8e+172)) {
		tmp = (1.0 / B) - t_0;
	} else {
		tmp = 1.0 / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= 1e-292:
		tmp = (-1.0 / B) - t_0
	elif F <= 1.15e-111:
		tmp = (math.sqrt((1.0 / (2.0 + (x * 2.0)))) * (F / B)) - (x / B)
	elif (F <= 9.5e+132) or not (F <= 3.8e+172):
		tmp = (1.0 / B) - t_0
	else:
		tmp = 1.0 / math.sin(B)
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= 1e-292)
		tmp = Float64(Float64(-1.0 / B) - t_0);
	elseif (F <= 1.15e-111)
		tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0)))) * Float64(F / B)) - Float64(x / B));
	elseif ((F <= 9.5e+132) || !(F <= 3.8e+172))
		tmp = Float64(Float64(1.0 / B) - t_0);
	else
		tmp = Float64(1.0 / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= 1e-292)
		tmp = (-1.0 / B) - t_0;
	elseif (F <= 1.15e-111)
		tmp = (sqrt((1.0 / (2.0 + (x * 2.0)))) * (F / B)) - (x / B);
	elseif ((F <= 9.5e+132) || ~((F <= 3.8e+172)))
		tmp = (1.0 / B) - t_0;
	else
		tmp = 1.0 / 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, 1e-292], N[(N[(-1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 1.15e-111], N[(N[(N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[F, 9.5e+132], N[Not[LessEqual[F, 3.8e+172]], $MachinePrecision]], N[(N[(1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;F \leq 9.5 \cdot 10^{+132} \lor \neg \left(F \leq 3.8 \cdot 10^{+172}\right):\\
\;\;\;\;\frac{1}{B} - t\_0\\

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


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

    1. Initial program 81.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 76.8%

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

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

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

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

    if 1.0000000000000001e-292 < F < 1.15e-111

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\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. clear-num99.5%

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

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

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

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

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

    if 1.15e-111 < F < 9.5000000000000005e132 or 3.7999999999999997e172 < F

    1. Initial program 67.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified79.4%

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

      \[\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/79.1%

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

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

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

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

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

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

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

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

    if 9.5000000000000005e132 < F < 3.7999999999999997e172

    1. Initial program 40.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. Simplified51.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 x around 0 51.7%

      \[\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/51.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 10^{-292}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.15 \cdot 10^{-111}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 9.5 \cdot 10^{+132} \lor \neg \left(F \leq 3.8 \cdot 10^{+172}\right):\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 42.8% accurate, 2.9× speedup?

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

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

\mathbf{elif}\;F \leq 1.7 \cdot 10^{+50}:\\
\;\;\;\;\frac{x}{-B}\\

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


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

    1. Initial program 73.1%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 90.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. mul-1-neg50.0%

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified50.0%

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(1 + x\right)}}{B} \]
      3. distribute-neg-in50.0%

        \[\leadsto \frac{\color{blue}{\left(-1\right) + \left(-x\right)}}{B} \]
      4. metadata-eval50.0%

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

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    9. Simplified50.0%

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

    if -3.09999999999999976e-57 < F < 1.6999999999999999e50

    1. Initial program 98.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 43.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. mul-1-neg24.8%

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified24.8%

      \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Taylor expanded in x around inf 39.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    8. Step-by-step derivation
      1. mul-1-neg39.1%

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

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

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

    if 1.6999999999999999e50 < F

    1. Initial program 51.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. Simplified66.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 x around 0 66.7%

      \[\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/66.7%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.1 \cdot 10^{-57}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.7 \cdot 10^{+50}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 30.1% accurate, 16.2× speedup?

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

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

\mathbf{elif}\;F \leq -3.8 \cdot 10^{-7}:\\
\;\;\;\;\frac{-1}{B}\\

\mathbf{elif}\;F \leq 1.72 \cdot 10^{+50}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -3.3999999999999998e55 or -3.80000000000000015e-7 < F < 1.72e50

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified34.9%

      \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Taylor expanded in x around inf 35.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    8. Step-by-step derivation
      1. mul-1-neg35.9%

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-neg-frac235.9%

        \[\leadsto \color{blue}{\frac{x}{-B}} \]
    9. Simplified35.9%

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

    if -3.3999999999999998e55 < F < -3.80000000000000015e-7

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 94.1%

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

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

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified53.1%

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

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

    if 1.72e50 < F

    1. Initial program 51.7%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 39.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. mul-1-neg19.8%

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified19.8%

      \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt10.7%

        \[\leadsto \frac{1 + x}{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}} \]
      2. sqrt-unprod18.5%

        \[\leadsto \frac{1 + x}{\color{blue}{\sqrt{\left(-B\right) \cdot \left(-B\right)}}} \]
      3. sqr-neg18.5%

        \[\leadsto \frac{1 + x}{\sqrt{\color{blue}{B \cdot B}}} \]
      4. sqrt-unprod16.8%

        \[\leadsto \frac{1 + x}{\color{blue}{\sqrt{B} \cdot \sqrt{B}}} \]
      5. add-sqr-sqrt37.3%

        \[\leadsto \frac{1 + x}{\color{blue}{B}} \]
      6. *-un-lft-identity37.3%

        \[\leadsto \color{blue}{1 \cdot \frac{1 + x}{B}} \]
    8. Applied egg-rr37.3%

      \[\leadsto \color{blue}{1 \cdot \frac{1 + x}{B}} \]
    9. Step-by-step derivation
      1. *-lft-identity37.3%

        \[\leadsto \color{blue}{\frac{1 + x}{B}} \]
    10. Simplified37.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.4 \cdot 10^{+55}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq -3.8 \cdot 10^{-7}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{elif}\;F \leq 1.72 \cdot 10^{+50}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 1}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 44.0% accurate, 19.0× speedup?

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

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

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

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


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

    1. Initial program 73.1%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 90.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. mul-1-neg50.0%

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified50.0%

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(1 + x\right)}}{B} \]
      3. distribute-neg-in50.0%

        \[\leadsto \frac{\color{blue}{\left(-1\right) + \left(-x\right)}}{B} \]
      4. metadata-eval50.0%

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

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    9. Simplified50.0%

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

    if -1.14000000000000006e-57 < F < 1.24999999999999999e-56

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 41.8%

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

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

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified23.9%

      \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Taylor expanded in x around inf 41.0%

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

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-neg-frac241.0%

        \[\leadsto \color{blue}{\frac{x}{-B}} \]
    9. Simplified41.0%

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

    if 1.24999999999999999e-56 < F

    1. Initial program 60.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv60.9%

        \[\leadsto \left(-\color{blue}{\frac{x}{\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. clear-num60.9%

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

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

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

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

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

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

Alternative 19: 36.8% accurate, 21.6× speedup?

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

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

\mathbf{elif}\;F \leq 2.95 \cdot 10^{+50}:\\
\;\;\;\;\frac{x}{-B}\\

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


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

    1. Initial program 73.1%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 90.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. mul-1-neg50.0%

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified50.0%

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(1 + x\right)}}{B} \]
      3. distribute-neg-in50.0%

        \[\leadsto \frac{\color{blue}{\left(-1\right) + \left(-x\right)}}{B} \]
      4. metadata-eval50.0%

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

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    9. Simplified50.0%

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

    if -6.8999999999999996e-56 < F < 2.9499999999999999e50

    1. Initial program 98.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 43.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. mul-1-neg24.8%

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified24.8%

      \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Taylor expanded in x around inf 39.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    8. Step-by-step derivation
      1. mul-1-neg39.1%

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

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

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

    if 2.9499999999999999e50 < F

    1. Initial program 51.7%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 39.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. mul-1-neg19.8%

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified19.8%

      \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt10.7%

        \[\leadsto \frac{1 + x}{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}} \]
      2. sqrt-unprod18.5%

        \[\leadsto \frac{1 + x}{\color{blue}{\sqrt{\left(-B\right) \cdot \left(-B\right)}}} \]
      3. sqr-neg18.5%

        \[\leadsto \frac{1 + x}{\sqrt{\color{blue}{B \cdot B}}} \]
      4. sqrt-unprod16.8%

        \[\leadsto \frac{1 + x}{\color{blue}{\sqrt{B} \cdot \sqrt{B}}} \]
      5. add-sqr-sqrt37.3%

        \[\leadsto \frac{1 + x}{\color{blue}{B}} \]
      6. *-un-lft-identity37.3%

        \[\leadsto \color{blue}{1 \cdot \frac{1 + x}{B}} \]
    8. Applied egg-rr37.3%

      \[\leadsto \color{blue}{1 \cdot \frac{1 + x}{B}} \]
    9. Step-by-step derivation
      1. *-lft-identity37.3%

        \[\leadsto \color{blue}{\frac{1 + x}{B}} \]
    10. Simplified37.3%

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

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

Alternative 20: 43.9% accurate, 21.6× speedup?

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

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

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

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


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

    1. Initial program 73.1%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 90.6%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. mul-1-neg50.0%

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified50.0%

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(1 + x\right)}}{B} \]
      3. distribute-neg-in50.0%

        \[\leadsto \frac{\color{blue}{\left(-1\right) + \left(-x\right)}}{B} \]
      4. metadata-eval50.0%

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

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    9. Simplified50.0%

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

    if -8.79999999999999994e-57 < F < 2.49999999999999989e-58

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in F around -inf 41.8%

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

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

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

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified23.9%

      \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Taylor expanded in x around inf 41.0%

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

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-neg-frac241.0%

        \[\leadsto \color{blue}{\frac{x}{-B}} \]
    9. Simplified41.0%

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

    if 2.49999999999999989e-58 < F

    1. Initial program 60.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified73.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 x around 0 73.6%

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

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

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

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

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

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

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

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

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

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

Alternative 21: 30.0% accurate, 81.0× speedup?

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

\\
\frac{x}{-B}
\end{array}
Derivation
  1. Initial program 78.2%

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in F around -inf 59.6%

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

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

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

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

    \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
  7. Taylor expanded in x around inf 31.0%

    \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
  8. Step-by-step derivation
    1. mul-1-neg31.0%

      \[\leadsto \color{blue}{-\frac{x}{B}} \]
    2. distribute-neg-frac231.0%

      \[\leadsto \color{blue}{\frac{x}{-B}} \]
  9. Simplified31.0%

    \[\leadsto \color{blue}{\frac{x}{-B}} \]
  10. Final simplification31.0%

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

Alternative 22: 10.4% 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 78.2%

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in F around -inf 59.6%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-1}{B}} \]
  8. Final simplification11.0%

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

Reproduce

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