VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.1% → 99.7%
Time: 18.1s
Alternatives: 21
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 21 alternatives:

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

Initial Program: 77.1% 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 -2.1 \cdot 10^{+60}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 40000000:\\ \;\;\;\;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 -2.1e+60)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 40000000.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 <= -2.1e+60) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 40000000.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 <= -2.1e+60)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 40000000.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, -2.1e+60], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 40000000.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 -2.1 \cdot 10^{+60}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\

\mathbf{elif}\;F \leq 40000000:\\
\;\;\;\;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 < -2.1000000000000001e60

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

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

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

    if -2.1000000000000001e60 < F < 4e7

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

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

    if 4e7 < F

    1. Initial program 61.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. Simplified79.7%

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

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

Alternative 2: 99.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 60.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. Simplified75.5%

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

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

    if -2.7000000000000001e59 < F < 1.2e8

    1. Initial program 99.5%

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

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

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

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

    if 1.2e8 < F

    1. Initial program 61.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. Simplified79.7%

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

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

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

Alternative 3: 98.4% accurate, 1.0× speedup?

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

\mathbf{elif}\;F \leq 6.2 \cdot 10^{-18}:\\
\;\;\;\;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.44999999999999996

    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. Simplified79.5%

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

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

    if -1.44999999999999996 < F < 6.20000000000000014e-18

    1. Initial program 99.5%

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

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

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

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

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

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

    if 6.20000000000000014e-18 < F

    1. Initial program 65.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 F around inf 97.6%

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

Alternative 4: 91.9% accurate, 1.4× speedup?

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

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

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

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


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

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

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

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

    if -1.1000000000000001e-7 < F < -2.10000000000000016e-101

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

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

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

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

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

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

    if -2.10000000000000016e-101 < F < 53

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

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

    if 53 < F

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

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

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

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

Alternative 5: 91.5% accurate, 1.4× speedup?

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

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

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

\mathbf{elif}\;F \leq 7 \cdot 10^{-22}:\\
\;\;\;\;\frac{F}{B} \cdot t\_0 - t\_1\\

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


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

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

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

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

    if -1.05e-7 < F < -6.80000000000000026e-102

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

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

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

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

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

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

    if -6.80000000000000026e-102 < F < 7.00000000000000011e-22

    1. Initial program 99.5%

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

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

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

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

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

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

    if 7.00000000000000011e-22 < F

    1. Initial program 65.7%

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

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

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

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

Alternative 6: 85.8% accurate, 1.4× speedup?

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

\mathbf{elif}\;F \leq -1.56 \cdot 10^{-114}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\

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

\mathbf{elif}\;F \leq 6 \cdot 10^{-18}:\\
\;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\

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


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

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

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

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

    if -1.1000000000000001e-7 < F < -1.5599999999999999e-114

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

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

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

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

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

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

    if -1.5599999999999999e-114 < F < 5.4e-102

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified99.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. Step-by-step derivation
      1. fma-define99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto F \cdot \frac{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{-0.5} \cdot {\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{-0.5}}}{\sin B} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. pow-sqr99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.4e-102 < F < 5.99999999999999966e-18

    1. Initial program 99.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{0.5}}{\sin B}} \]
    8. Step-by-step derivation
      1. associate-/l*80.1%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} \]
    9. Simplified80.1%

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

    if 5.99999999999999966e-18 < F

    1. Initial program 65.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 F around inf 97.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.1 \cdot 10^{-7}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.56 \cdot 10^{-114}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 5.4 \cdot 10^{-102}:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 6 \cdot 10^{-18}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 77.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1.1 \cdot 10^{-7}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq -4.6 \cdot 10^{-118}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 3.5 \cdot 10^{-102}:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 4.8 \cdot 10^{-19}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1.1e-7)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F -4.6e-118)
       (/ (* F (sqrt 0.5)) (sin B))
       (if (<= F 3.5e-102)
         (/ (* x (cos B)) (- (sin B)))
         (if (<= F 4.8e-19)
           (* F (/ (sqrt 0.5) (sin B)))
           (- (* F (/ 1.0 (* F B))) t_0)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1.1e-7) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= -4.6e-118) {
		tmp = (F * sqrt(0.5)) / sin(B);
	} else if (F <= 3.5e-102) {
		tmp = (x * cos(B)) / -sin(B);
	} else if (F <= 4.8e-19) {
		tmp = F * (sqrt(0.5) / sin(B));
	} else {
		tmp = (F * (1.0 / (F * 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.1d-7)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= (-4.6d-118)) then
        tmp = (f * sqrt(0.5d0)) / sin(b)
    else if (f <= 3.5d-102) then
        tmp = (x * cos(b)) / -sin(b)
    else if (f <= 4.8d-19) then
        tmp = f * (sqrt(0.5d0) / sin(b))
    else
        tmp = (f * (1.0d0 / (f * 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.1e-7) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= -4.6e-118) {
		tmp = (F * Math.sqrt(0.5)) / Math.sin(B);
	} else if (F <= 3.5e-102) {
		tmp = (x * Math.cos(B)) / -Math.sin(B);
	} else if (F <= 4.8e-19) {
		tmp = F * (Math.sqrt(0.5) / Math.sin(B));
	} else {
		tmp = (F * (1.0 / (F * B))) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -1.1e-7:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= -4.6e-118:
		tmp = (F * math.sqrt(0.5)) / math.sin(B)
	elif F <= 3.5e-102:
		tmp = (x * math.cos(B)) / -math.sin(B)
	elif F <= 4.8e-19:
		tmp = F * (math.sqrt(0.5) / math.sin(B))
	else:
		tmp = (F * (1.0 / (F * B))) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1.1e-7)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= -4.6e-118)
		tmp = Float64(Float64(F * sqrt(0.5)) / sin(B));
	elseif (F <= 3.5e-102)
		tmp = Float64(Float64(x * cos(B)) / Float64(-sin(B)));
	elseif (F <= 4.8e-19)
		tmp = Float64(F * Float64(sqrt(0.5) / sin(B)));
	else
		tmp = Float64(Float64(F * Float64(1.0 / Float64(F * 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.1e-7)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= -4.6e-118)
		tmp = (F * sqrt(0.5)) / sin(B);
	elseif (F <= 3.5e-102)
		tmp = (x * cos(B)) / -sin(B);
	elseif (F <= 4.8e-19)
		tmp = F * (sqrt(0.5) / sin(B));
	else
		tmp = (F * (1.0 / (F * 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.1e-7], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, -4.6e-118], N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.5e-102], N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 4.8e-19], N[(F * N[(N[Sqrt[0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(F * N[(1.0 / N[(F * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -4.6 \cdot 10^{-118}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\

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

\mathbf{elif}\;F \leq 4.8 \cdot 10^{-19}:\\
\;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\

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


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

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

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

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

    if -1.1000000000000001e-7 < F < -4.60000000000000042e-118

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

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

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

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

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

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

    if -4.60000000000000042e-118 < F < 3.49999999999999986e-102

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified99.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. Step-by-step derivation
      1. fma-define99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto F \cdot \frac{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{-0.5} \cdot {\left(\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{-0.5}}}{\sin B} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. pow-sqr99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.49999999999999986e-102 < F < 4.80000000000000046e-19

    1. Initial program 99.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{0.5}}{\sin B}} \]
    8. Step-by-step derivation
      1. associate-/l*80.1%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} \]
    9. Simplified80.1%

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

    if 4.80000000000000046e-19 < F

    1. Initial program 65.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 F around inf 97.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.1 \cdot 10^{-7}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -4.6 \cdot 10^{-118}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 3.5 \cdot 10^{-102}:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 4.8 \cdot 10^{-19}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 91.4% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq 7 \cdot 10^{-22}:\\
\;\;\;\;F \cdot \frac{\sqrt{0.5}}{B} - t\_0\\

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


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

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

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

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

    if -1.1000000000000001e-7 < F < -1.25000000000000005e-98

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

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

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

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

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

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

    if -1.25000000000000005e-98 < F < 7.00000000000000011e-22

    1. Initial program 99.5%

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

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

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

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

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

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

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

    if 7.00000000000000011e-22 < F

    1. Initial program 65.7%

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

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

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

Alternative 9: 91.3% accurate, 1.5× speedup?

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

\mathbf{elif}\;F \leq 7 \cdot 10^{-22}:\\
\;\;\;\;F \cdot \frac{\sqrt{0.5}}{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 < -0.0195

    1. Initial program 67.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. Simplified79.8%

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

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

    if -0.0195 < F < 7.00000000000000011e-22

    1. Initial program 99.4%

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

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

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

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

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

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

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

    if 7.00000000000000011e-22 < F

    1. Initial program 65.7%

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

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

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

Alternative 10: 56.4% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;B \leq 0.0155:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos B}{\sin B} \cdot \left(-x\right)\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= B 0.0155)
   (/ (- (* F (sqrt (/ 1.0 (+ 2.0 (+ (* F F) (* x 2.0)))))) x) B)
   (* (/ (cos B) (sin B)) (- x))))
double code(double F, double B, double x) {
	double tmp;
	if (B <= 0.0155) {
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else {
		tmp = (cos(B) / sin(B)) * -x;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (b <= 0.0155d0) then
        tmp = ((f * sqrt((1.0d0 / (2.0d0 + ((f * f) + (x * 2.0d0)))))) - x) / b
    else
        tmp = (cos(b) / sin(b)) * -x
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (B <= 0.0155) {
		tmp = ((F * Math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	} else {
		tmp = (Math.cos(B) / Math.sin(B)) * -x;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if B <= 0.0155:
		tmp = ((F * math.sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B
	else:
		tmp = (math.cos(B) / math.sin(B)) * -x
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (B <= 0.0155)
		tmp = Float64(Float64(Float64(F * sqrt(Float64(1.0 / Float64(2.0 + Float64(Float64(F * F) + Float64(x * 2.0)))))) - x) / B);
	else
		tmp = Float64(Float64(cos(B) / sin(B)) * Float64(-x));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (B <= 0.0155)
		tmp = ((F * sqrt((1.0 / (2.0 + ((F * F) + (x * 2.0)))))) - x) / B;
	else
		tmp = (cos(B) / sin(B)) * -x;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[B, 0.0155], N[(N[(N[(F * N[Sqrt[N[(1.0 / N[(2.0 + N[(N[(F * F), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[Cos[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 0.0155

    1. Initial program 78.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. Simplified89.1%

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

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

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

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

    if 0.0155 < B

    1. Initial program 87.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. Simplified87.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. Step-by-step derivation
      1. fma-define87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    10. Simplified51.4%

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

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

Alternative 11: 54.7% accurate, 2.5× speedup?

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

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

\mathbf{elif}\;x \leq -2.7 \cdot 10^{-102}:\\
\;\;\;\;\frac{1}{B}\\

\mathbf{elif}\;x \leq -7 \cdot 10^{-297}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{B}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -8.8000000000000004e-46 or 1.9500000000000001e-70 < x

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

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

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

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

    if -8.8000000000000004e-46 < x < -2.7e-102

    1. Initial program 62.1%

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

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

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

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

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

    if -2.7e-102 < x < -6.9999999999999998e-297

    1. Initial program 88.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. Simplified88.4%

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

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

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

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

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

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

    if -6.9999999999999998e-297 < x < 1.9500000000000001e-70

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

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

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. clear-num39.4%

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

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{{\left(\frac{\tan B}{x}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-139.4%

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

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

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

Alternative 12: 62.7% accurate, 2.6× speedup?

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

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

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

\mathbf{elif}\;F \leq 1.72 \cdot 10^{-90}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\

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


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

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

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

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

      \[\leadsto \color{blue}{\frac{-1}{B}} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. div-inv80.9%

        \[\leadsto \frac{-1}{B} - \color{blue}{x \cdot \frac{1}{\tan B}} \]
    7. Applied egg-rr80.9%

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

    if -5.19999999999999984e81 < F < -1.1000000000000001e-7

    1. Initial program 95.3%

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

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

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

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

    if -1.1000000000000001e-7 < F < 1.72e-90

    1. Initial program 99.5%

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

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

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

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

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

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

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

    if 1.72e-90 < F

    1. Initial program 68.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.2 \cdot 10^{+81}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -1.1 \cdot 10^{-7}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.72 \cdot 10^{-90}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 44.3% accurate, 2.6× speedup?

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

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

\mathbf{elif}\;F \leq -6 \cdot 10^{-35}:\\
\;\;\;\;\frac{-1}{\sin B}\\

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

\mathbf{elif}\;F \leq 9.2 \cdot 10^{-24}:\\
\;\;\;\;F \cdot \frac{\sqrt{0.5}}{B}\\

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


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

    1. Initial program 32.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. Simplified64.4%

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

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
      2. inv-pow99.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{{\left(\frac{\tan B}{x}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-199.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
    9. Step-by-step derivation
      1. div-inv99.8%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval69.7%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-169.7%

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

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    13. Simplified69.7%

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

    if -1e220 < F < -5.99999999999999978e-35

    1. Initial program 82.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. Simplified87.2%

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

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. clear-num86.8%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
      2. inv-pow86.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{{\left(\frac{\tan B}{x}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-186.8%

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

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

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

    if -5.99999999999999978e-35 < F < 6.9999999999999997e-144

    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 inf 25.2%

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

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

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

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

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

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

    if 6.9999999999999997e-144 < F < 9.2000000000000004e-24

    1. Initial program 99.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{0.5}}{B}} \]
    9. Step-by-step derivation
      1. associate-/l*33.9%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{B}} \]
    10. Simplified33.9%

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

    if 9.2000000000000004e-24 < F

    1. Initial program 65.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1 \cdot 10^{+220}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -6 \cdot 10^{-35}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-144}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 9.2 \cdot 10^{-24}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 57.1% accurate, 2.7× speedup?

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

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

\mathbf{elif}\;x \leq -5.3 \cdot 10^{-297}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.80000000000000011e-9 or 2.7e-72 < x

    1. Initial program 85.1%

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

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

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

    if -3.80000000000000011e-9 < x < -5.30000000000000019e-297

    1. Initial program 82.9%

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

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

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

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

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

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

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

    if -5.30000000000000019e-297 < x < 2.7e-72

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

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

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. clear-num39.4%

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

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{{\left(\frac{\tan B}{x}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-139.4%

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

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

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

Alternative 15: 55.4% accurate, 2.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 0.0155

    1. Initial program 78.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. Simplified89.1%

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

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

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

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

    if 0.0155 < B

    1. Initial program 87.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. Simplified87.8%

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

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

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

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

Alternative 16: 44.0% accurate, 2.9× speedup?

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

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

\mathbf{elif}\;F \leq -3.3 \cdot 10^{-36}:\\
\;\;\;\;\frac{-1}{\sin B}\\

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

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


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

    1. Initial program 32.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. Simplified64.4%

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

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
      2. inv-pow99.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{{\left(\frac{\tan B}{x}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-199.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
    9. Step-by-step derivation
      1. div-inv99.8%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval69.7%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-169.7%

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

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    13. Simplified69.7%

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

    if -1.09999999999999995e220 < F < -3.29999999999999991e-36

    1. Initial program 82.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. Simplified87.2%

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

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. clear-num86.8%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
      2. inv-pow86.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{{\left(\frac{\tan B}{x}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-186.8%

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

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

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

    if -3.29999999999999991e-36 < F < 4.99999999999999981e-81

    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 inf 26.4%

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

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

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

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

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

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

    if 4.99999999999999981e-81 < F

    1. Initial program 68.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.1 \cdot 10^{+220}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -3.3 \cdot 10^{-36}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-81}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 30.3% accurate, 17.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{-B}\\
\mathbf{if}\;x \leq -1.75 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -5 \cdot 10^{-204}:\\
\;\;\;\;\frac{1}{B}\\

\mathbf{elif}\;x \leq 1.1 \cdot 10^{-54}:\\
\;\;\;\;\frac{-1}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.75e-34 or 1.1e-54 < x

    1. Initial program 85.4%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    8. Simplified49.0%

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

    if -1.75e-34 < x < -5.0000000000000002e-204

    1. Initial program 79.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. Simplified83.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 F around inf 32.8%

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

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

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

    if -5.0000000000000002e-204 < x < 1.1e-54

    1. Initial program 73.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. Simplified75.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 F around -inf 33.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{-34}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-204}:\\ \;\;\;\;\frac{1}{B}\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-54}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 43.4% accurate, 21.6× speedup?

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

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

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

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


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

    1. Initial program 71.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. Simplified81.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 F around -inf 89.8%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. clear-num89.8%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
      2. inv-pow89.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{{\left(\frac{\tan B}{x}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-189.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
    9. Step-by-step derivation
      1. div-inv89.8%

        \[\leadsto \frac{-1}{\sin B} - \frac{1}{\color{blue}{\tan B \cdot \frac{1}{x}}} \]
    10. Applied egg-rr89.8%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in42.3%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval42.3%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-142.3%

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

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    13. Simplified42.3%

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

    if -3.00000000000000028e-39 < F < 2.15000000000000007e-86

    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 inf 26.4%

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

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

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

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

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

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

    if 2.15000000000000007e-86 < F

    1. Initial program 68.9%

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

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

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

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

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

Alternative 19: 36.4% accurate, 32.3× speedup?

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

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

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


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

    1. Initial program 71.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. Simplified81.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 F around -inf 89.8%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. clear-num89.8%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
      2. inv-pow89.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{{\left(\frac{\tan B}{x}\right)}^{-1}} \]
    7. Step-by-step derivation
      1. unpow-189.8%

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

      \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{1}{\frac{\tan B}{x}}} \]
    9. Step-by-step derivation
      1. div-inv89.8%

        \[\leadsto \frac{-1}{\sin B} - \frac{1}{\color{blue}{\tan B \cdot \frac{1}{x}}} \]
    10. Applied egg-rr89.8%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in42.3%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval42.3%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-142.3%

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

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    13. Simplified42.3%

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

    if -7.39999999999999997e-40 < F

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

Alternative 20: 17.4% accurate, 40.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq 7.1 \cdot 10^{-143}:\\
\;\;\;\;\frac{-1}{B}\\

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


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

    1. Initial program 84.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. Simplified90.3%

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

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

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

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

    if 7.10000000000000033e-143 < F

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

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

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

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

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

Alternative 21: 10.3% 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 80.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. Simplified88.7%

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

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

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

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

Reproduce

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