VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.4% → 98.9%
Time: 18.3s
Alternatives: 22
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 22 alternatives:

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

Initial Program: 77.4% 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: 98.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq 13:\\
\;\;\;\;F \cdot \left(t_0 \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - t_1\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \left(t_0 + \frac{-1 - x}{F \cdot \left(F \cdot \sin B\right)}\right)\\


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

    1. Initial program 50.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. Taylor expanded in F around -inf 99.8%

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

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

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

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

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

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

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

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

    if -4.2e5 < F < 13

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around 0 99.6%

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

    if 13 < F

    1. Initial program 57.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. Taylor expanded in F around inf 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq 1.45:\\
\;\;\;\;F \cdot \left(t_0 \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - t_1\\

\mathbf{else}:\\
\;\;\;\;t_0 - t_1\\


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

    1. Initial program 50.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. Taylor expanded in F around -inf 99.8%

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

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

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

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

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

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

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

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

    if -4.2e5 < F < 1.44999999999999996

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around 0 99.6%

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

    if 1.44999999999999996 < F

    1. Initial program 58.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. Step-by-step derivation
      1. +-commutative58.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified72.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}} \]
    4. Taylor expanded in F around inf 99.3%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.2%

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

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

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

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

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

        \[\leadsto \color{blue}{F \cdot \frac{1}{\sin B \cdot F} - \frac{x}{\tan B}} \]
      2. associate-*r/99.3%

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

        \[\leadsto \frac{F \cdot 1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      4. times-frac99.5%

        \[\leadsto \color{blue}{\frac{F}{F} \cdot \frac{1}{\sin B}} - \frac{x}{\tan B} \]
      5. *-rgt-identity99.5%

        \[\leadsto \frac{\color{blue}{F \cdot 1}}{F} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      6. associate-*r/99.4%

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

        \[\leadsto \color{blue}{1} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      8. *-lft-identity99.5%

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

      \[\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 -420000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.45:\\ \;\;\;\;F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 3: 98.9% accurate, 1.0× speedup?

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

\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;F \cdot \frac{\sqrt{\frac{1}{2 + x \cdot 2}}}{\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 < -4.2e5

    1. Initial program 50.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. Taylor expanded in F around -inf 99.8%

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

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

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

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

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

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

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

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

    if -4.2e5 < F < 1.3999999999999999

    1. Initial program 99.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    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} \]

    if 1.3999999999999999 < F

    1. Initial program 58.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. Step-by-step derivation
      1. +-commutative58.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified72.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}} \]
    4. Taylor expanded in F around inf 99.3%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.2%

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

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

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

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

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

        \[\leadsto \color{blue}{F \cdot \frac{1}{\sin B \cdot F} - \frac{x}{\tan B}} \]
      2. associate-*r/99.3%

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

        \[\leadsto \frac{F \cdot 1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      4. times-frac99.5%

        \[\leadsto \color{blue}{\frac{F}{F} \cdot \frac{1}{\sin B}} - \frac{x}{\tan B} \]
      5. *-rgt-identity99.5%

        \[\leadsto \frac{\color{blue}{F \cdot 1}}{F} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      6. associate-*r/99.4%

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

        \[\leadsto \color{blue}{1} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      8. *-lft-identity99.5%

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

      \[\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 -420000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.4:\\ \;\;\;\;F \cdot \frac{\sqrt{\frac{1}{2 + x \cdot 2}}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 4: 98.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 50.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. Taylor expanded in F around -inf 99.8%

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

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

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

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

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

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

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

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

    if -4.2e5 < F < 1.3999999999999999

    1. Initial program 99.5%

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

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

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

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

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

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

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

    if 1.3999999999999999 < F

    1. Initial program 58.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. Step-by-step derivation
      1. +-commutative58.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified72.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}} \]
    4. Taylor expanded in F around inf 99.3%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.2%

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

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

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

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

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

        \[\leadsto \color{blue}{F \cdot \frac{1}{\sin B \cdot F} - \frac{x}{\tan B}} \]
      2. associate-*r/99.3%

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

        \[\leadsto \frac{F \cdot 1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      4. times-frac99.5%

        \[\leadsto \color{blue}{\frac{F}{F} \cdot \frac{1}{\sin B}} - \frac{x}{\tan B} \]
      5. *-rgt-identity99.5%

        \[\leadsto \frac{\color{blue}{F \cdot 1}}{F} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      6. associate-*r/99.4%

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

        \[\leadsto \color{blue}{1} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      8. *-lft-identity99.5%

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

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

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

Alternative 5: 91.7% accurate, 1.5× speedup?

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

\mathbf{elif}\;F \leq 0.135:\\
\;\;\;\;F \cdot \left(\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{1}{B}\right) - 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.0999999999999999e-9

    1. Initial program 52.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. Taylor expanded in F around -inf 97.4%

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

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

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

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

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

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

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

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

    if -1.0999999999999999e-9 < F < 0.13500000000000001

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    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. Taylor expanded in B around 0 85.9%

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

    if 0.13500000000000001 < F

    1. Initial program 58.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. Step-by-step derivation
      1. +-commutative58.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified72.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}} \]
    4. Taylor expanded in F around inf 99.3%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.2%

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

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

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

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

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

        \[\leadsto \color{blue}{F \cdot \frac{1}{\sin B \cdot F} - \frac{x}{\tan B}} \]
      2. associate-*r/99.3%

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

        \[\leadsto \frac{F \cdot 1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      4. times-frac99.5%

        \[\leadsto \color{blue}{\frac{F}{F} \cdot \frac{1}{\sin B}} - \frac{x}{\tan B} \]
      5. *-rgt-identity99.5%

        \[\leadsto \frac{\color{blue}{F \cdot 1}}{F} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      6. associate-*r/99.4%

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

        \[\leadsto \color{blue}{1} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      8. *-lft-identity99.5%

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

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

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

Alternative 6: 91.7% accurate, 1.5× speedup?

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

\mathbf{elif}\;F \leq 0.41:\\
\;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{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.0999999999999999e-9

    1. Initial program 52.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. Taylor expanded in F around -inf 97.4%

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

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

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

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

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

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

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

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

    if -1.0999999999999999e-9 < F < 0.409999999999999976

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    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. Taylor expanded in B around 0 85.9%

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

    if 0.409999999999999976 < F

    1. Initial program 58.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. Step-by-step derivation
      1. +-commutative58.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified72.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}} \]
    4. Taylor expanded in F around inf 99.3%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.2%

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

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

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

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

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

        \[\leadsto \color{blue}{F \cdot \frac{1}{\sin B \cdot F} - \frac{x}{\tan B}} \]
      2. associate-*r/99.3%

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

        \[\leadsto \frac{F \cdot 1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      4. times-frac99.5%

        \[\leadsto \color{blue}{\frac{F}{F} \cdot \frac{1}{\sin B}} - \frac{x}{\tan B} \]
      5. *-rgt-identity99.5%

        \[\leadsto \frac{\color{blue}{F \cdot 1}}{F} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      6. associate-*r/99.4%

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

        \[\leadsto \color{blue}{1} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      8. *-lft-identity99.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.1 \cdot 10^{-9}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 0.41:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 7: 70.8% accurate, 1.5× speedup?

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

\mathbf{elif}\;F \leq -0.016:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\

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

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

\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 < -3.2999999999999998e209

    1. Initial program 37.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. Taylor expanded in F around -inf 99.8%

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

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

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

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

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

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

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

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

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

    if -3.2999999999999998e209 < F < -0.016

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in99.8%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{\cos B \cdot x}{\sin B}} \]
      7. *-commutative99.8%

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

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 88.2%

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

    if -0.016 < F < -7.6e-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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    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. Taylor expanded in F around inf 61.1%

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

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

    if -7.6e-90 < F < 2.7e-95

    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. Taylor expanded in F around -inf 37.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{\tan B}} \]
    6. Simplified37.9%

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

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

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in37.8%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{\cos B \cdot x}{\sin B}} \]
      7. *-commutative37.8%

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

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in x around inf 83.7%

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

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

        \[\leadsto -\color{blue}{\frac{\cos B}{\frac{\sin B}{x}}} \]
    12. Simplified83.6%

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

    if 2.7e-95 < F

    1. Initial program 67.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. Step-by-step derivation
      1. +-commutative67.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified78.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}} \]
    4. Taylor expanded in F around inf 89.4%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*89.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.3 \cdot 10^{+209}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -0.016:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq -7.6 \cdot 10^{-90}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 2.7 \cdot 10^{-95}:\\ \;\;\;\;-\frac{\cos B}{\frac{\sin B}{x}}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 8: 70.8% accurate, 1.5× speedup?

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

\mathbf{elif}\;F \leq -0.011:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\

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

\mathbf{elif}\;F \leq 2.7 \cdot 10^{-95}:\\
\;\;\;\;\frac{-x}{\sin B} \cdot \cos 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 < -6.6e208

    1. Initial program 37.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. Taylor expanded in F around -inf 99.8%

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

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

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

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

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

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

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

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

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

    if -6.6e208 < F < -0.010999999999999999

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in99.8%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{\cos B \cdot x}{\sin B}} \]
      7. *-commutative99.8%

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

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 88.2%

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

    if -0.010999999999999999 < F < -2.14999999999999993e-89

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    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. Taylor expanded in F around inf 61.1%

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

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

    if -2.14999999999999993e-89 < F < 2.7e-95

    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. Taylor expanded in F around -inf 37.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{\tan B}} \]
    6. Simplified37.9%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-x\right) \cdot \cos B}}{\sin B} \]
      5. *-rgt-identity83.7%

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

        \[\leadsto \color{blue}{\frac{-x}{\sin B} \cdot \frac{\cos B}{1}} \]
      7. rem-square-sqrt64.9%

        \[\leadsto \frac{-x}{\sin B} \cdot \frac{\color{blue}{\sqrt{\cos B} \cdot \sqrt{\cos B}}}{1} \]
      8. associate-*r/64.9%

        \[\leadsto \frac{-x}{\sin B} \cdot \color{blue}{\left(\sqrt{\cos B} \cdot \frac{\sqrt{\cos B}}{1}\right)} \]
      9. /-rgt-identity64.9%

        \[\leadsto \frac{-x}{\sin B} \cdot \left(\sqrt{\cos B} \cdot \color{blue}{\sqrt{\cos B}}\right) \]
      10. rem-square-sqrt83.7%

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

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

    if 2.7e-95 < F

    1. Initial program 67.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. Step-by-step derivation
      1. +-commutative67.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified78.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}} \]
    4. Taylor expanded in F around inf 89.4%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*89.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -6.6 \cdot 10^{+208}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -0.011:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq -2.15 \cdot 10^{-89}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 2.7 \cdot 10^{-95}:\\ \;\;\;\;\frac{-x}{\sin B} \cdot \cos B\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 9: 84.5% accurate, 1.5× speedup?

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

    if -5.5000000000000002e-5 < F < -1.9000000000000001e-89

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    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. Taylor expanded in F around inf 61.1%

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

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

    if -1.9000000000000001e-89 < F < 2.3500000000000002e-10

    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. Taylor expanded in F around -inf 41.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-x\right) \cdot \cos B}}{\sin B} \]
      5. *-rgt-identity80.4%

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

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

        \[\leadsto \frac{-x}{\sin B} \cdot \frac{\color{blue}{\sqrt{\cos B} \cdot \sqrt{\cos B}}}{1} \]
      8. associate-*r/61.6%

        \[\leadsto \frac{-x}{\sin B} \cdot \color{blue}{\left(\sqrt{\cos B} \cdot \frac{\sqrt{\cos B}}{1}\right)} \]
      9. /-rgt-identity61.6%

        \[\leadsto \frac{-x}{\sin B} \cdot \left(\sqrt{\cos B} \cdot \color{blue}{\sqrt{\cos B}}\right) \]
      10. rem-square-sqrt80.5%

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

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

    if 2.3500000000000002e-10 < F

    1. Initial program 58.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. Step-by-step derivation
      1. +-commutative58.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified72.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}} \]
    4. Taylor expanded in F around inf 99.3%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.2%

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

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

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

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

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

        \[\leadsto \color{blue}{F \cdot \frac{1}{\sin B \cdot F} - \frac{x}{\tan B}} \]
      2. associate-*r/99.3%

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

        \[\leadsto \frac{F \cdot 1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      4. times-frac99.5%

        \[\leadsto \color{blue}{\frac{F}{F} \cdot \frac{1}{\sin B}} - \frac{x}{\tan B} \]
      5. *-rgt-identity99.5%

        \[\leadsto \frac{\color{blue}{F \cdot 1}}{F} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      6. associate-*r/99.4%

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

        \[\leadsto \color{blue}{1} \cdot \frac{1}{\sin B} - \frac{x}{\tan B} \]
      8. *-lft-identity99.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.5 \cdot 10^{-5}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.9 \cdot 10^{-89}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 2.35 \cdot 10^{-10}:\\ \;\;\;\;\frac{-x}{\sin B} \cdot \cos B\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 10: 76.8% accurate, 1.5× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

    if -2.5000000000000002e-6 < F < -9.1999999999999992e-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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    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. Taylor expanded in F around inf 61.1%

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

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

    if -9.1999999999999992e-90 < F < 2.7e-95

    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. Taylor expanded in F around -inf 37.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{\tan B}} \]
    6. Simplified37.9%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-x\right) \cdot \cos B}}{\sin B} \]
      5. *-rgt-identity83.7%

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

        \[\leadsto \color{blue}{\frac{-x}{\sin B} \cdot \frac{\cos B}{1}} \]
      7. rem-square-sqrt64.9%

        \[\leadsto \frac{-x}{\sin B} \cdot \frac{\color{blue}{\sqrt{\cos B} \cdot \sqrt{\cos B}}}{1} \]
      8. associate-*r/64.9%

        \[\leadsto \frac{-x}{\sin B} \cdot \color{blue}{\left(\sqrt{\cos B} \cdot \frac{\sqrt{\cos B}}{1}\right)} \]
      9. /-rgt-identity64.9%

        \[\leadsto \frac{-x}{\sin B} \cdot \left(\sqrt{\cos B} \cdot \color{blue}{\sqrt{\cos B}}\right) \]
      10. rem-square-sqrt83.7%

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

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

    if 2.7e-95 < F

    1. Initial program 67.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. Step-by-step derivation
      1. +-commutative67.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified78.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}} \]
    4. Taylor expanded in F around inf 89.4%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*89.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.5 \cdot 10^{-6}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -9.2 \cdot 10^{-90}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 2.7 \cdot 10^{-95}:\\ \;\;\;\;\frac{-x}{\sin B} \cdot \cos B\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 11: 63.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ t_1 := \frac{-1}{B} - t_0\\ t_2 := F \cdot \sqrt{0.5} - x\\ \mathbf{if}\;F \leq -2.42 \cdot 10^{+210}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;F \leq -0.0032:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq -2.15 \cdot 10^{-89}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 1.32 \cdot 10^{-236}:\\ \;\;\;\;\frac{t_2}{B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-87}:\\ \;\;\;\;\frac{1}{\frac{B}{t_2}}\\ \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)))
        (t_1 (- (/ -1.0 B) t_0))
        (t_2 (- (* F (sqrt 0.5)) x)))
   (if (<= F -2.42e+210)
     t_1
     (if (<= F -0.0032)
       (/ (- -1.0 x) (sin B))
       (if (<= F -2.15e-89)
         (* (sqrt 0.5) (/ F (sin B)))
         (if (<= F 1.32e-236)
           (/ t_2 B)
           (if (<= F 6.2e-101)
             t_1
             (if (<= F 5e-87)
               (/ 1.0 (/ B t_2))
               (- (* F (/ 1.0 (* F B))) t_0)))))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double t_1 = (-1.0 / B) - t_0;
	double t_2 = (F * sqrt(0.5)) - x;
	double tmp;
	if (F <= -2.42e+210) {
		tmp = t_1;
	} else if (F <= -0.0032) {
		tmp = (-1.0 - x) / sin(B);
	} else if (F <= -2.15e-89) {
		tmp = sqrt(0.5) * (F / sin(B));
	} else if (F <= 1.32e-236) {
		tmp = t_2 / B;
	} else if (F <= 6.2e-101) {
		tmp = t_1;
	} else if (F <= 5e-87) {
		tmp = 1.0 / (B / t_2);
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = x / tan(b)
    t_1 = ((-1.0d0) / b) - t_0
    t_2 = (f * sqrt(0.5d0)) - x
    if (f <= (-2.42d+210)) then
        tmp = t_1
    else if (f <= (-0.0032d0)) then
        tmp = ((-1.0d0) - x) / sin(b)
    else if (f <= (-2.15d-89)) then
        tmp = sqrt(0.5d0) * (f / sin(b))
    else if (f <= 1.32d-236) then
        tmp = t_2 / b
    else if (f <= 6.2d-101) then
        tmp = t_1
    else if (f <= 5d-87) then
        tmp = 1.0d0 / (b / t_2)
    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 t_1 = (-1.0 / B) - t_0;
	double t_2 = (F * Math.sqrt(0.5)) - x;
	double tmp;
	if (F <= -2.42e+210) {
		tmp = t_1;
	} else if (F <= -0.0032) {
		tmp = (-1.0 - x) / Math.sin(B);
	} else if (F <= -2.15e-89) {
		tmp = Math.sqrt(0.5) * (F / Math.sin(B));
	} else if (F <= 1.32e-236) {
		tmp = t_2 / B;
	} else if (F <= 6.2e-101) {
		tmp = t_1;
	} else if (F <= 5e-87) {
		tmp = 1.0 / (B / t_2);
	} else {
		tmp = (F * (1.0 / (F * B))) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	t_1 = (-1.0 / B) - t_0
	t_2 = (F * math.sqrt(0.5)) - x
	tmp = 0
	if F <= -2.42e+210:
		tmp = t_1
	elif F <= -0.0032:
		tmp = (-1.0 - x) / math.sin(B)
	elif F <= -2.15e-89:
		tmp = math.sqrt(0.5) * (F / math.sin(B))
	elif F <= 1.32e-236:
		tmp = t_2 / B
	elif F <= 6.2e-101:
		tmp = t_1
	elif F <= 5e-87:
		tmp = 1.0 / (B / t_2)
	else:
		tmp = (F * (1.0 / (F * B))) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	t_1 = Float64(Float64(-1.0 / B) - t_0)
	t_2 = Float64(Float64(F * sqrt(0.5)) - x)
	tmp = 0.0
	if (F <= -2.42e+210)
		tmp = t_1;
	elseif (F <= -0.0032)
		tmp = Float64(Float64(-1.0 - x) / sin(B));
	elseif (F <= -2.15e-89)
		tmp = Float64(sqrt(0.5) * Float64(F / sin(B)));
	elseif (F <= 1.32e-236)
		tmp = Float64(t_2 / B);
	elseif (F <= 6.2e-101)
		tmp = t_1;
	elseif (F <= 5e-87)
		tmp = Float64(1.0 / Float64(B / t_2));
	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);
	t_1 = (-1.0 / B) - t_0;
	t_2 = (F * sqrt(0.5)) - x;
	tmp = 0.0;
	if (F <= -2.42e+210)
		tmp = t_1;
	elseif (F <= -0.0032)
		tmp = (-1.0 - x) / sin(B);
	elseif (F <= -2.15e-89)
		tmp = sqrt(0.5) * (F / sin(B));
	elseif (F <= 1.32e-236)
		tmp = t_2 / B;
	elseif (F <= 6.2e-101)
		tmp = t_1;
	elseif (F <= 5e-87)
		tmp = 1.0 / (B / t_2);
	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]}, Block[{t$95$1 = N[(N[(-1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[F, -2.42e+210], t$95$1, If[LessEqual[F, -0.0032], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -2.15e-89], N[(N[Sqrt[0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.32e-236], N[(t$95$2 / B), $MachinePrecision], If[LessEqual[F, 6.2e-101], t$95$1, If[LessEqual[F, 5e-87], N[(1.0 / N[(B / t$95$2), $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}\\
t_1 := \frac{-1}{B} - t_0\\
t_2 := F \cdot \sqrt{0.5} - x\\
\mathbf{if}\;F \leq -2.42 \cdot 10^{+210}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;F \leq -0.0032:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\

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

\mathbf{elif}\;F \leq 1.32 \cdot 10^{-236}:\\
\;\;\;\;\frac{t_2}{B}\\

\mathbf{elif}\;F \leq 6.2 \cdot 10^{-101}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;F \leq 5 \cdot 10^{-87}:\\
\;\;\;\;\frac{1}{\frac{B}{t_2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if F < -2.42e210 or 1.32e-236 < F < 6.19999999999999946e-101

    1. Initial program 65.0%

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

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

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

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

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

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

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

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

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

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

    if -2.42e210 < F < -0.00320000000000000015

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in99.8%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{\cos B \cdot x}{\sin B}} \]
      7. *-commutative99.8%

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

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 88.2%

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

    if -0.00320000000000000015 < F < -2.14999999999999993e-89

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    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. Taylor expanded in F around inf 61.1%

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

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

    if -2.14999999999999993e-89 < F < 1.32e-236

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified99.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}} \]
    4. Taylor expanded in F around 0 99.8%

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

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

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

    if 6.19999999999999946e-101 < F < 5.00000000000000042e-87

    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. Step-by-step derivation
      1. +-commutative99.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified98.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}} \]
    4. Taylor expanded in F around 0 98.9%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 \cdot x + 2}} - x}{B}} \]
    6. Step-by-step derivation
      1. clear-num80.2%

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

        \[\leadsto \color{blue}{{\left(\frac{B}{F \cdot \sqrt{\frac{1}{2 \cdot x + 2}} - x}\right)}^{-1}} \]
      3. inv-pow80.2%

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{B}{F \cdot {\left(\mathsf{fma}\left(x, 2, 2\right)\right)}^{-0.5} - x}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-180.2%

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

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

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

    if 5.00000000000000042e-87 < F

    1. Initial program 66.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. Step-by-step derivation
      1. +-commutative66.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified78.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}} \]
    4. Taylor expanded in F around inf 92.5%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*92.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.42 \cdot 10^{+210}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -0.0032:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq -2.15 \cdot 10^{-89}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 1.32 \cdot 10^{-236}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-101}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-87}:\\ \;\;\;\;\frac{1}{\frac{B}{F \cdot \sqrt{0.5} - x}}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 12: 63.0% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
t_0 := F \cdot \sqrt{0.5} - x\\
t_1 := \frac{x}{\tan B}\\
t_2 := \frac{-1}{B} - t_1\\
\mathbf{if}\;F \leq -7.8 \cdot 10^{+208}:\\
\;\;\;\;t_2\\

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

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

\mathbf{elif}\;F \leq 7 \cdot 10^{-103}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;F \leq 1.35 \cdot 10^{-89}:\\
\;\;\;\;\frac{1}{\frac{B}{t_0}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if F < -7.8000000000000001e208 or 1.25000000000000009e-230 < F < 7.00000000000000032e-103

    1. Initial program 65.0%

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

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

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

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

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

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

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

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

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

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

    if -7.8000000000000001e208 < F < -1.0999999999999999e-9

    1. Initial program 64.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. Taylor expanded in F around -inf 95.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\cos B \cdot x}{\sin B} + \frac{1}{\sin B}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg95.6%

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in95.6%

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

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

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

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

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x \cdot \cos B}}{\sin B} \]
      8. div-sub95.7%

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 84.6%

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

    if -1.0999999999999999e-9 < F < 1.25000000000000009e-230

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around 0 99.7%

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

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

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

    if 7.00000000000000032e-103 < F < 1.34999999999999994e-89

    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. Step-by-step derivation
      1. +-commutative99.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified98.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}} \]
    4. Taylor expanded in F around 0 98.9%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 \cdot x + 2}} - x}{B}} \]
    6. Step-by-step derivation
      1. clear-num80.2%

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

        \[\leadsto \color{blue}{{\left(\frac{B}{F \cdot \sqrt{\frac{1}{2 \cdot x + 2}} - x}\right)}^{-1}} \]
      3. inv-pow80.2%

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{B}{F \cdot {\left(\mathsf{fma}\left(x, 2, 2\right)\right)}^{-0.5} - x}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-180.2%

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

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

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

    if 1.34999999999999994e-89 < F

    1. Initial program 66.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. Step-by-step derivation
      1. +-commutative66.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified78.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}} \]
    4. Taylor expanded in F around inf 92.5%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*92.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -7.8 \cdot 10^{+208}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.1 \cdot 10^{-9}:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.25 \cdot 10^{-230}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-103}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{-89}:\\ \;\;\;\;\frac{1}{\frac{B}{F \cdot \sqrt{0.5} - x}}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 13: 54.5% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -2.75 \cdot 10^{+210}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;F \leq -6.5 \cdot 10^{-11}:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq -6.2 \cdot 10^{-270}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;F \leq 1.25 \cdot 10^{-237}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{elif}\;F \leq 8.2 \cdot 10^{+172}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (/ -1.0 B) (/ x (tan B)))))
   (if (<= F -2.75e+210)
     t_0
     (if (<= F -6.5e-11)
       (/ (- -1.0 x) (sin B))
       (if (<= F -6.2e-270)
         t_0
         (if (<= F 1.25e-237)
           (/ (- x) B)
           (if (<= F 8.2e+172)
             t_0
             (+
              (* B (+ 0.16666666666666666 (* x 0.3333333333333333)))
              (/ (- 1.0 x) B)))))))))
double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / tan(B));
	double tmp;
	if (F <= -2.75e+210) {
		tmp = t_0;
	} else if (F <= -6.5e-11) {
		tmp = (-1.0 - x) / sin(B);
	} else if (F <= -6.2e-270) {
		tmp = t_0;
	} else if (F <= 1.25e-237) {
		tmp = -x / B;
	} else if (F <= 8.2e+172) {
		tmp = t_0;
	} else {
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((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) :: t_0
    real(8) :: tmp
    t_0 = ((-1.0d0) / b) - (x / tan(b))
    if (f <= (-2.75d+210)) then
        tmp = t_0
    else if (f <= (-6.5d-11)) then
        tmp = ((-1.0d0) - x) / sin(b)
    else if (f <= (-6.2d-270)) then
        tmp = t_0
    else if (f <= 1.25d-237) then
        tmp = -x / b
    else if (f <= 8.2d+172) then
        tmp = t_0
    else
        tmp = (b * (0.16666666666666666d0 + (x * 0.3333333333333333d0))) + ((1.0d0 - x) / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / Math.tan(B));
	double tmp;
	if (F <= -2.75e+210) {
		tmp = t_0;
	} else if (F <= -6.5e-11) {
		tmp = (-1.0 - x) / Math.sin(B);
	} else if (F <= -6.2e-270) {
		tmp = t_0;
	} else if (F <= 1.25e-237) {
		tmp = -x / B;
	} else if (F <= 8.2e+172) {
		tmp = t_0;
	} else {
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (-1.0 / B) - (x / math.tan(B))
	tmp = 0
	if F <= -2.75e+210:
		tmp = t_0
	elif F <= -6.5e-11:
		tmp = (-1.0 - x) / math.sin(B)
	elif F <= -6.2e-270:
		tmp = t_0
	elif F <= 1.25e-237:
		tmp = -x / B
	elif F <= 8.2e+172:
		tmp = t_0
	else:
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B)
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(-1.0 / B) - Float64(x / tan(B)))
	tmp = 0.0
	if (F <= -2.75e+210)
		tmp = t_0;
	elseif (F <= -6.5e-11)
		tmp = Float64(Float64(-1.0 - x) / sin(B));
	elseif (F <= -6.2e-270)
		tmp = t_0;
	elseif (F <= 1.25e-237)
		tmp = Float64(Float64(-x) / B);
	elseif (F <= 8.2e+172)
		tmp = t_0;
	else
		tmp = Float64(Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333))) + Float64(Float64(1.0 - x) / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = (-1.0 / B) - (x / tan(B));
	tmp = 0.0;
	if (F <= -2.75e+210)
		tmp = t_0;
	elseif (F <= -6.5e-11)
		tmp = (-1.0 - x) / sin(B);
	elseif (F <= -6.2e-270)
		tmp = t_0;
	elseif (F <= 1.25e-237)
		tmp = -x / B;
	elseif (F <= 8.2e+172)
		tmp = t_0;
	else
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.75e+210], t$95$0, If[LessEqual[F, -6.5e-11], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -6.2e-270], t$95$0, If[LessEqual[F, 1.25e-237], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 8.2e+172], t$95$0, N[(N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;F \leq -6.2 \cdot 10^{-270}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;F \leq 8.2 \cdot 10^{+172}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -2.75000000000000006e210 or -6.49999999999999953e-11 < F < -6.2e-270 or 1.2500000000000001e-237 < F < 8.200000000000001e172

    1. Initial program 84.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. Taylor expanded in F around -inf 54.4%

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

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

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

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

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

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

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

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

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

    if -2.75000000000000006e210 < F < -6.49999999999999953e-11

    1. Initial program 64.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. Taylor expanded in F around -inf 95.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\cos B \cdot x}{\sin B} + \frac{1}{\sin B}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg95.6%

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in95.6%

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

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

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

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

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x \cdot \cos B}}{\sin B} \]
      8. div-sub95.7%

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 84.6%

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

    if -6.2e-270 < F < 1.2500000000000001e-237

    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. Step-by-step derivation
      1. +-commutative99.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified99.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}} \]
    4. Taylor expanded in F around inf 7.3%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*7.3%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified81.5%

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

    if 8.200000000000001e172 < F

    1. Initial program 29.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. Step-by-step derivation
      1. +-commutative29.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified47.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}} \]
    4. Taylor expanded in F around inf 99.7%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.6%

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

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

      \[\leadsto \color{blue}{\left(\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \frac{1}{B}\right) - \frac{x}{B}} \]
    8. Step-by-step derivation
      1. associate--l+59.4%

        \[\leadsto \color{blue}{\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \left(\frac{1}{B} - \frac{x}{B}\right)} \]
      2. *-commutative59.4%

        \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)} + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      3. *-commutative59.4%

        \[\leadsto B \cdot \left(0.16666666666666666 + \color{blue}{x \cdot 0.3333333333333333}\right) + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      4. div-sub59.4%

        \[\leadsto B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \color{blue}{\frac{1 - x}{B}} \]
    9. Simplified59.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.75 \cdot 10^{+210}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -6.5 \cdot 10^{-11}:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq -6.2 \cdot 10^{-270}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.25 \cdot 10^{-237}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{elif}\;F \leq 8.2 \cdot 10^{+172}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \]

Alternative 14: 56.2% accurate, 2.8× speedup?

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

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

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

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

\mathbf{elif}\;F \leq 8.2 \cdot 10^{+172}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -2.25000000000000007e208 or 1.1e-233 < F < 8.200000000000001e172

    1. Initial program 77.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. Taylor expanded in F around -inf 60.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{\tan B}} \]
    6. Simplified60.7%

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

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

    if -2.25000000000000007e208 < F < -1.0999999999999999e-9

    1. Initial program 64.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. Taylor expanded in F around -inf 95.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\cos B \cdot x}{\sin B} + \frac{1}{\sin B}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg95.6%

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in95.6%

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

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

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

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

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x \cdot \cos B}}{\sin B} \]
      8. div-sub95.7%

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 84.6%

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

    if -1.0999999999999999e-9 < F < 1.1e-233

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around 0 99.7%

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

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

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

    if 8.200000000000001e172 < F

    1. Initial program 29.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. Step-by-step derivation
      1. +-commutative29.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified47.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}} \]
    4. Taylor expanded in F around inf 99.7%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.6%

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

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

      \[\leadsto \color{blue}{\left(\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \frac{1}{B}\right) - \frac{x}{B}} \]
    8. Step-by-step derivation
      1. associate--l+59.4%

        \[\leadsto \color{blue}{\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \left(\frac{1}{B} - \frac{x}{B}\right)} \]
      2. *-commutative59.4%

        \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)} + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      3. *-commutative59.4%

        \[\leadsto B \cdot \left(0.16666666666666666 + \color{blue}{x \cdot 0.3333333333333333}\right) + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      4. div-sub59.4%

        \[\leadsto B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \color{blue}{\frac{1 - x}{B}} \]
    9. Simplified59.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.25 \cdot 10^{+208}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.1 \cdot 10^{-9}:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.1 \cdot 10^{-233}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 8.2 \cdot 10^{+172}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \]

Alternative 15: 51.4% accurate, 3.0× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\


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

    1. Initial program 54.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. Taylor expanded in F around -inf 93.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{\tan B}} \]
    6. Simplified93.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\cos B \cdot x}{\sin B} + \frac{1}{\sin B}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg93.9%

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in93.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{\cos B \cdot x}{\sin B}} \]
      7. *-commutative93.9%

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x \cdot \cos B}}{\sin B} \]
      8. div-sub93.9%

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

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

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

    if -8.79999999999999961e-29 < F < 1.22e-60

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around inf 27.6%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*27.6%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified42.4%

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

    if 1.22e-60 < F

    1. Initial program 64.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. Step-by-step derivation
      1. +-commutative64.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified76.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}} \]
    4. Taylor expanded in F around inf 92.1%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*92.1%

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

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

      \[\leadsto \color{blue}{\left(\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \frac{1}{B}\right) - \frac{x}{B}} \]
    8. Step-by-step derivation
      1. associate--l+46.1%

        \[\leadsto \color{blue}{\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \left(\frac{1}{B} - \frac{x}{B}\right)} \]
      2. *-commutative46.1%

        \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)} + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      3. *-commutative46.1%

        \[\leadsto B \cdot \left(0.16666666666666666 + \color{blue}{x \cdot 0.3333333333333333}\right) + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      4. div-sub46.1%

        \[\leadsto B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \color{blue}{\frac{1 - x}{B}} \]
    9. Simplified46.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -8.8 \cdot 10^{-29}:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.22 \cdot 10^{-60}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \]

Alternative 16: 44.3% accurate, 3.1× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\


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

    1. Initial program 50.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. Taylor expanded in F around -inf 99.8%

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

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

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

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

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

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

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

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

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

    if -4.2e5 < F < 1.22e-60

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around inf 27.2%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*27.2%

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

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

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

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

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

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

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

    if 1.22e-60 < F

    1. Initial program 64.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. Step-by-step derivation
      1. +-commutative64.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified76.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}} \]
    4. Taylor expanded in F around inf 92.1%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*92.1%

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

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

      \[\leadsto \color{blue}{\left(\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \frac{1}{B}\right) - \frac{x}{B}} \]
    8. Step-by-step derivation
      1. associate--l+46.1%

        \[\leadsto \color{blue}{\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \left(\frac{1}{B} - \frac{x}{B}\right)} \]
      2. *-commutative46.1%

        \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)} + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      3. *-commutative46.1%

        \[\leadsto B \cdot \left(0.16666666666666666 + \color{blue}{x \cdot 0.3333333333333333}\right) + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      4. div-sub46.1%

        \[\leadsto B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \color{blue}{\frac{1 - x}{B}} \]
    9. Simplified46.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -420000:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 1.22 \cdot 10^{-60}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \]

Alternative 17: 43.9% accurate, 18.9× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\


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

    1. Initial program 54.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. Taylor expanded in F around -inf 93.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{\tan B}} \]
    6. Simplified93.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\cos B \cdot x}{\sin B} + \frac{1}{\sin B}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg93.9%

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in93.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{\cos B \cdot x}{\sin B}} \]
      7. *-commutative93.9%

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x \cdot \cos B}}{\sin B} \]
      8. div-sub93.9%

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 46.3%

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

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

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

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

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

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

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

    if -1.59999999999999991e-28 < F < 1.17999999999999994e-60

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around inf 27.6%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*27.6%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified42.4%

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

    if 1.17999999999999994e-60 < F

    1. Initial program 64.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. Step-by-step derivation
      1. +-commutative64.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified76.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}} \]
    4. Taylor expanded in F around inf 92.1%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*92.1%

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

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

      \[\leadsto \color{blue}{\left(\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \frac{1}{B}\right) - \frac{x}{B}} \]
    8. Step-by-step derivation
      1. associate--l+46.1%

        \[\leadsto \color{blue}{\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \left(\frac{1}{B} - \frac{x}{B}\right)} \]
      2. *-commutative46.1%

        \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)} + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      3. *-commutative46.1%

        \[\leadsto B \cdot \left(0.16666666666666666 + \color{blue}{x \cdot 0.3333333333333333}\right) + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      4. div-sub46.1%

        \[\leadsto B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \color{blue}{\frac{1 - x}{B}} \]
    9. Simplified46.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.6 \cdot 10^{-28}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.18 \cdot 10^{-60}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \]

Alternative 18: 44.0% accurate, 18.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-28}:\\
\;\;\;\;B \cdot \left(x \cdot 0.3333333333333333 - 0.16666666666666666\right) - \frac{x + 1}{B}\\

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

\mathbf{else}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\


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

    1. Initial program 54.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. Taylor expanded in F around -inf 93.9%

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

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

    if -5.0000000000000002e-28 < F < 1.22e-60

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around inf 27.6%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*27.6%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified42.4%

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

    if 1.22e-60 < F

    1. Initial program 64.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. Step-by-step derivation
      1. +-commutative64.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified76.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}} \]
    4. Taylor expanded in F around inf 92.1%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*92.1%

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

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

      \[\leadsto \color{blue}{\left(\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \frac{1}{B}\right) - \frac{x}{B}} \]
    8. Step-by-step derivation
      1. associate--l+46.1%

        \[\leadsto \color{blue}{\left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) \cdot B + \left(\frac{1}{B} - \frac{x}{B}\right)} \]
      2. *-commutative46.1%

        \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)} + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      3. *-commutative46.1%

        \[\leadsto B \cdot \left(0.16666666666666666 + \color{blue}{x \cdot 0.3333333333333333}\right) + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      4. div-sub46.1%

        \[\leadsto B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \color{blue}{\frac{1 - x}{B}} \]
    9. Simplified46.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5 \cdot 10^{-28}:\\ \;\;\;\;B \cdot \left(x \cdot 0.3333333333333333 - 0.16666666666666666\right) - \frac{x + 1}{B}\\ \mathbf{elif}\;F \leq 1.22 \cdot 10^{-60}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \]

Alternative 19: 43.7% accurate, 35.5× speedup?

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

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

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

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


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

    1. Initial program 54.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. Taylor expanded in F around -inf 93.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{\tan B}} \]
    6. Simplified93.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\cos B \cdot x}{\sin B} + \frac{1}{\sin B}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg93.9%

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in93.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{\cos B \cdot x}{\sin B}} \]
      7. *-commutative93.9%

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x \cdot \cos B}}{\sin B} \]
      8. div-sub93.9%

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 46.3%

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

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

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

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

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

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

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

    if -1.20000000000000001e-27 < F < 2.6499999999999999e-95

    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. Step-by-step derivation
      1. +-commutative99.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around inf 25.3%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*25.3%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified43.2%

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

    if 2.6499999999999999e-95 < F

    1. Initial program 67.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. Step-by-step derivation
      1. +-commutative67.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified78.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}} \]
    4. Taylor expanded in F around inf 89.4%

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

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*89.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.2 \cdot 10^{-27}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 2.65 \cdot 10^{-95}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]

Alternative 20: 37.1% accurate, 39.9× speedup?

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

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

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

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


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

    1. Initial program 54.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. Taylor expanded in F around -inf 93.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{\tan B}} \]
    6. Simplified93.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\cos B \cdot x}{\sin B} + \frac{1}{\sin B}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg93.9%

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

        \[\leadsto -\color{blue}{\left(\frac{1}{\sin B} + \frac{\cos B \cdot x}{\sin B}\right)} \]
      3. distribute-neg-in93.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{\cos B \cdot x}{\sin B}} \]
      7. *-commutative93.9%

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x \cdot \cos B}}{\sin B} \]
      8. div-sub93.9%

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

      \[\leadsto \color{blue}{\frac{-1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 46.3%

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

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

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

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-146.3%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
      5. sub-neg46.3%

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    12. Simplified46.3%

      \[\leadsto \color{blue}{\frac{-1 - x}{B}} \]

    if -9.99999999999999971e-29 < F < 1.32000000000000011e146

    1. Initial program 96.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. Step-by-step derivation
      1. +-commutative96.8%

        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \left(-x \cdot \frac{1}{\tan B}\right)} \]
      2. unsub-neg96.8%

        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}} \]
      3. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
      4. associate-*r/99.4%

        \[\leadsto \color{blue}{F \cdot \frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
      5. *-commutative99.4%

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. 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}} \]
    4. Taylor expanded in F around inf 44.3%

      \[\leadsto F \cdot \color{blue}{\frac{1}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative44.3%

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*44.2%

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified44.2%

      \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    7. Taylor expanded in B around 0 26.1%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    8. Taylor expanded in x around inf 37.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    9. Step-by-step derivation
      1. associate-*r/37.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. neg-mul-137.1%

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified37.1%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]

    if 1.32000000000000011e146 < F

    1. Initial program 35.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. Step-by-step derivation
      1. +-commutative35.0%

        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \left(-x \cdot \frac{1}{\tan B}\right)} \]
      2. unsub-neg35.0%

        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}} \]
      3. associate-*l/50.5%

        \[\leadsto \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
      4. associate-*r/50.5%

        \[\leadsto \color{blue}{F \cdot \frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
      5. *-commutative50.5%

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified50.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}} \]
    4. Taylor expanded in F around inf 99.7%

      \[\leadsto F \cdot \color{blue}{\frac{1}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative99.7%

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.6%

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.6%

      \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    7. Taylor expanded in B around 0 54.8%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    8. Taylor expanded in x around 0 35.7%

      \[\leadsto \color{blue}{\frac{1}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification39.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1 \cdot 10^{-28}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.32 \cdot 10^{+146}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \]

Alternative 21: 29.8% accurate, 53.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq 5.8 \cdot 10^{+146}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \end{array} \]
(FPCore (F B x) :precision binary64 (if (<= F 5.8e+146) (/ (- x) B) (/ 1.0 B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= 5.8e+146) {
		tmp = -x / 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 <= 5.8d+146) then
        tmp = -x / 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 <= 5.8e+146) {
		tmp = -x / B;
	} else {
		tmp = 1.0 / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= 5.8e+146:
		tmp = -x / B
	else:
		tmp = 1.0 / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= 5.8e+146)
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(1.0 / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= 5.8e+146)
		tmp = -x / B;
	else
		tmp = 1.0 / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, 5.8e+146], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq 5.8 \cdot 10^{+146}:\\
\;\;\;\;\frac{-x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 5.7999999999999997e146

    1. Initial program 81.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. Step-by-step derivation
      1. +-commutative81.9%

        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \left(-x \cdot \frac{1}{\tan B}\right)} \]
      2. unsub-neg81.9%

        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}} \]
      3. associate-*l/87.2%

        \[\leadsto \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
      4. associate-*r/87.2%

        \[\leadsto \color{blue}{F \cdot \frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
      5. *-commutative87.2%

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified87.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}} \]
    4. Taylor expanded in F around inf 41.4%

      \[\leadsto F \cdot \color{blue}{\frac{1}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative41.4%

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*41.4%

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified41.4%

      \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    7. Taylor expanded in B around 0 23.6%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    8. Taylor expanded in x around inf 30.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    9. Step-by-step derivation
      1. associate-*r/30.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. neg-mul-130.8%

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified30.8%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]

    if 5.7999999999999997e146 < F

    1. Initial program 35.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. Step-by-step derivation
      1. +-commutative35.0%

        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \left(-x \cdot \frac{1}{\tan B}\right)} \]
      2. unsub-neg35.0%

        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}} \]
      3. associate-*l/50.5%

        \[\leadsto \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
      4. associate-*r/50.5%

        \[\leadsto \color{blue}{F \cdot \frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
      5. *-commutative50.5%

        \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
    3. Simplified50.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}} \]
    4. Taylor expanded in F around inf 99.7%

      \[\leadsto F \cdot \color{blue}{\frac{1}{\sin B \cdot F}} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. *-commutative99.7%

        \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
      2. associate-/r*99.6%

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.6%

      \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    7. Taylor expanded in B around 0 54.8%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    8. Taylor expanded in x around 0 35.7%

      \[\leadsto \color{blue}{\frac{1}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 5.8 \cdot 10^{+146}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \]

Alternative 22: 9.7% 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 75.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. Step-by-step derivation
    1. +-commutative75.5%

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \left(-x \cdot \frac{1}{\tan B}\right)} \]
    2. unsub-neg75.5%

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}} \]
    3. associate-*l/82.2%

      \[\leadsto \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
    4. associate-*r/82.2%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} - x \cdot \frac{1}{\tan B} \]
    5. *-commutative82.2%

      \[\leadsto \color{blue}{\frac{{\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B} \cdot F} - x \cdot \frac{1}{\tan B} \]
  3. Simplified82.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}} \]
  4. Taylor expanded in F around inf 49.4%

    \[\leadsto F \cdot \color{blue}{\frac{1}{\sin B \cdot F}} - \frac{x}{\tan B} \]
  5. Step-by-step derivation
    1. *-commutative49.4%

      \[\leadsto F \cdot \frac{1}{\color{blue}{F \cdot \sin B}} - \frac{x}{\tan B} \]
    2. associate-/r*49.4%

      \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
  6. Simplified49.4%

    \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
  7. Taylor expanded in B around 0 27.8%

    \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  8. Taylor expanded in x around 0 9.3%

    \[\leadsto \color{blue}{\frac{1}{B}} \]
  9. Final simplification9.3%

    \[\leadsto \frac{1}{B} \]

Reproduce

?
herbie shell --seed 2023257 
(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))))))