VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.8% → 99.6%
Time: 21.5s
Alternatives: 25
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 25 alternatives:

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

Initial Program: 76.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.8× speedup?

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

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

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

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


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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B}\right)} - 1 \]
      4. neg-mul-140.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{\tan B}} + \frac{-1}{\sin B}\right)} - 1 \]
      5. fma-def40.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} - 1 \]
    4. Applied egg-rr40.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def40.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)\right)} \]
      2. expm1-log1p99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)} \]
      3. rem-log-exp43.0%

        \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} \]
      4. fma-udef43.0%

        \[\leadsto \log \left(e^{\color{blue}{-1 \cdot \frac{x}{\tan B} + \frac{-1}{\sin B}}}\right) \]
      5. neg-mul-143.0%

        \[\leadsto \log \left(e^{\color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{-1}{\sin B}}\right) \]
      6. prod-exp40.9%

        \[\leadsto \log \color{blue}{\left(e^{-\frac{x}{\tan B}} \cdot e^{\frac{-1}{\sin B}}\right)} \]
      7. *-commutative40.9%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B}} \cdot e^{-\frac{x}{\tan B}}\right)} \]
      8. prod-exp43.0%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B} + \left(-\frac{x}{\tan B}\right)}\right)} \]
      9. rem-log-exp99.7%

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

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

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

    if -1.5000000000000001e47 < F < 2.8e7

    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. Taylor expanded in x around 0 99.6%

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

    if 2.8e7 < F

    1. Initial program 65.4%

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\right)} - 1} \]
      3. +-commutative39.3%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\frac{x}{\tan B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def39.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.5 \cdot 10^{+47}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 28000000:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x \cdot \cos B}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 2: 99.5% accurate, 0.8× speedup?

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

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

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

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


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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B}\right)} - 1 \]
      4. neg-mul-140.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{\tan B}} + \frac{-1}{\sin B}\right)} - 1 \]
      5. fma-def40.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} - 1 \]
    4. Applied egg-rr40.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def40.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)\right)} \]
      2. expm1-log1p99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)} \]
      3. rem-log-exp43.0%

        \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} \]
      4. fma-udef43.0%

        \[\leadsto \log \left(e^{\color{blue}{-1 \cdot \frac{x}{\tan B} + \frac{-1}{\sin B}}}\right) \]
      5. neg-mul-143.0%

        \[\leadsto \log \left(e^{\color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{-1}{\sin B}}\right) \]
      6. prod-exp40.9%

        \[\leadsto \log \color{blue}{\left(e^{-\frac{x}{\tan B}} \cdot e^{\frac{-1}{\sin B}}\right)} \]
      7. *-commutative40.9%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B}} \cdot e^{-\frac{x}{\tan B}}\right)} \]
      8. prod-exp43.0%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B} + \left(-\frac{x}{\tan B}\right)}\right)} \]
      9. rem-log-exp99.7%

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

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

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

    if -1.2500000000000001e49 < F < 1.15e8

    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. Taylor expanded in x around 0 99.6%

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

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

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

    if 1.15e8 < F

    1. Initial program 65.4%

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\right)} - 1} \]
      3. +-commutative39.3%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\frac{x}{\tan B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def39.3%

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

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

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

      \[\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 -1.25 \cdot 10^{+49}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 115000000:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \cos B \cdot \frac{x}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 3: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B}\right)} - 1 \]
      4. neg-mul-138.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{\tan B}} + \frac{-1}{\sin B}\right)} - 1 \]
      5. fma-def38.0%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} - 1 \]
    4. Applied egg-rr38.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)\right)} \]
      2. expm1-log1p99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)} \]
      3. rem-log-exp45.2%

        \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} \]
      4. fma-udef45.2%

        \[\leadsto \log \left(e^{\color{blue}{-1 \cdot \frac{x}{\tan B} + \frac{-1}{\sin B}}}\right) \]
      5. neg-mul-145.2%

        \[\leadsto \log \left(e^{\color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{-1}{\sin B}}\right) \]
      6. prod-exp43.3%

        \[\leadsto \log \color{blue}{\left(e^{-\frac{x}{\tan B}} \cdot e^{\frac{-1}{\sin B}}\right)} \]
      7. *-commutative43.3%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B}} \cdot e^{-\frac{x}{\tan B}}\right)} \]
      8. prod-exp45.2%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B} + \left(-\frac{x}{\tan B}\right)}\right)} \]
      9. rem-log-exp99.7%

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

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

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

    if -1.4e22 < F < 9e7

    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. associate-*l/99.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}}}}{\sin B} \]
    8. Step-by-step derivation
      1. expm1-log1p-u88.9%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}}}{\sin B}\right)} - 1\right)} \]
      3. un-div-inv68.1%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}}}}{\sin B}\right)} - 1\right) \]
    9. Applied egg-rr68.1%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}}}{\sin B}\right)} - 1\right)} \]
    10. Step-by-step derivation
      1. expm1-def89.0%

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

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

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

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

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

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

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

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

    if 9e7 < F

    1. Initial program 65.4%

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\right)} - 1} \]
      3. +-commutative39.3%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\frac{x}{\tan B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def39.3%

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

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

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

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

Alternative 4: 99.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 59.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 98.4%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B}\right)} - 1 \]
      4. neg-mul-138.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{\tan B}} + \frac{-1}{\sin B}\right)} - 1 \]
      5. fma-def38.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} - 1 \]
    4. Applied egg-rr38.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)\right)} \]
      2. expm1-log1p98.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)} \]
      3. rem-log-exp45.5%

        \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} \]
      4. fma-udef45.5%

        \[\leadsto \log \left(e^{\color{blue}{-1 \cdot \frac{x}{\tan B} + \frac{-1}{\sin B}}}\right) \]
      5. neg-mul-145.5%

        \[\leadsto \log \left(e^{\color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{-1}{\sin B}}\right) \]
      6. prod-exp43.5%

        \[\leadsto \log \color{blue}{\left(e^{-\frac{x}{\tan B}} \cdot e^{\frac{-1}{\sin B}}\right)} \]
      7. *-commutative43.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B}} \cdot e^{-\frac{x}{\tan B}}\right)} \]
      8. prod-exp45.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B} + \left(-\frac{x}{\tan B}\right)}\right)} \]
      9. rem-log-exp98.5%

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

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

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

    if -1.3999999999999999 < F < 1.3999999999999999

    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.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.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 0 99.0%

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

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

    if 1.3999999999999999 < F

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\right)} - 1} \]
      3. +-commutative38.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)}\right)} - 1 \]
      4. div-inv38.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\color{blue}{\frac{x}{\tan B}}\right)\right)} - 1 \]
    4. Applied egg-rr38.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\frac{x}{\tan B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.4:\\ \;\;\;\;\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.4× speedup?

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

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

\mathbf{elif}\;F \leq -3.6 \cdot 10^{-181}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;F \leq 2200000:\\
\;\;\;\;t_0\\

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


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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B}\right)} - 1 \]
      4. neg-mul-140.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{\tan B}} + \frac{-1}{\sin B}\right)} - 1 \]
      5. fma-def40.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} - 1 \]
    4. Applied egg-rr40.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def40.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)\right)} \]
      2. expm1-log1p99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)} \]
      3. rem-log-exp43.0%

        \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} \]
      4. fma-udef43.0%

        \[\leadsto \log \left(e^{\color{blue}{-1 \cdot \frac{x}{\tan B} + \frac{-1}{\sin B}}}\right) \]
      5. neg-mul-143.0%

        \[\leadsto \log \left(e^{\color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{-1}{\sin B}}\right) \]
      6. prod-exp40.9%

        \[\leadsto \log \color{blue}{\left(e^{-\frac{x}{\tan B}} \cdot e^{\frac{-1}{\sin B}}\right)} \]
      7. *-commutative40.9%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B}} \cdot e^{-\frac{x}{\tan B}}\right)} \]
      8. prod-exp43.0%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B} + \left(-\frac{x}{\tan B}\right)}\right)} \]
      9. rem-log-exp99.7%

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

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

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

    if -1.5000000000000001e47 < F < -3.5999999999999999e-181 or 2.9e-45 < F < 2.2e6

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

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

    if -3.5999999999999999e-181 < F < 2.9e-45

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

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

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

    if 2.2e6 < F

    1. Initial program 65.4%

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\right)} - 1} \]
      3. +-commutative39.3%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\frac{x}{\tan B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def39.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.5 \cdot 10^{+47}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -3.6 \cdot 10^{-181}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.9 \cdot 10^{-45}:\\ \;\;\;\;\frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2200000:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 6: 91.5% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -3 \cdot 10^{-54}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;F \leq 0.001:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 59.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 98.4%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B}\right)} - 1 \]
      4. neg-mul-138.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{\tan B}} + \frac{-1}{\sin B}\right)} - 1 \]
      5. fma-def38.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} - 1 \]
    4. Applied egg-rr38.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)\right)} \]
      2. expm1-log1p98.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)} \]
      3. rem-log-exp45.5%

        \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} \]
      4. fma-udef45.5%

        \[\leadsto \log \left(e^{\color{blue}{-1 \cdot \frac{x}{\tan B} + \frac{-1}{\sin B}}}\right) \]
      5. neg-mul-145.5%

        \[\leadsto \log \left(e^{\color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{-1}{\sin B}}\right) \]
      6. prod-exp43.5%

        \[\leadsto \log \color{blue}{\left(e^{-\frac{x}{\tan B}} \cdot e^{\frac{-1}{\sin B}}\right)} \]
      7. *-commutative43.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B}} \cdot e^{-\frac{x}{\tan B}}\right)} \]
      8. prod-exp45.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B} + \left(-\frac{x}{\tan B}\right)}\right)} \]
      9. rem-log-exp98.5%

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

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

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

    if -0.0210000000000000013 < F < -3.00000000000000009e-54 or 3e-37 < F < 1e-3

    1. Initial program 98.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. +-commutative98.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-neg98.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/98.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/99.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. *-commutative99.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. Simplified99.2%

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in F around inf 90.5%

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

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{0.5}}}{\sin B} \]
      2. associate-*r/91.0%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} \]
    8. Simplified91.0%

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

    if -3.00000000000000009e-54 < F < 3e-37

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

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

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

    if 1e-3 < F

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\right)} - 1} \]
      3. +-commutative38.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)}\right)} - 1 \]
      4. div-inv38.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\color{blue}{\frac{x}{\tan B}}\right)\right)} - 1 \]
    4. Applied egg-rr38.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\frac{x}{\tan B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.021:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -3 \cdot 10^{-54}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 3 \cdot 10^{-37}:\\ \;\;\;\;\frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 0.001:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 7: 85.4% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -4.9 \cdot 10^{-54}:\\
\;\;\;\;t_0\\

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

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

\mathbf{elif}\;F \leq 9 \cdot 10^{-5}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 59.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 98.4%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B}\right)} - 1 \]
      4. neg-mul-138.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{\tan B}} + \frac{-1}{\sin B}\right)} - 1 \]
      5. fma-def38.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} - 1 \]
    4. Applied egg-rr38.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)\right)} \]
      2. expm1-log1p98.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)} \]
      3. rem-log-exp45.5%

        \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} \]
      4. fma-udef45.5%

        \[\leadsto \log \left(e^{\color{blue}{-1 \cdot \frac{x}{\tan B} + \frac{-1}{\sin B}}}\right) \]
      5. neg-mul-145.5%

        \[\leadsto \log \left(e^{\color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{-1}{\sin B}}\right) \]
      6. prod-exp43.5%

        \[\leadsto \log \color{blue}{\left(e^{-\frac{x}{\tan B}} \cdot e^{\frac{-1}{\sin B}}\right)} \]
      7. *-commutative43.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B}} \cdot e^{-\frac{x}{\tan B}}\right)} \]
      8. prod-exp45.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B} + \left(-\frac{x}{\tan B}\right)}\right)} \]
      9. rem-log-exp98.5%

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

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

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

    if -0.0037000000000000002 < F < -4.90000000000000021e-54 or 1.99999999999999991e-44 < F < 9.00000000000000057e-5

    1. Initial program 98.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. +-commutative98.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-neg98.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/98.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/99.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. *-commutative99.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. Simplified99.2%

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in F around inf 90.5%

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

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{0.5}}}{\sin B} \]
      2. associate-*r/91.0%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} \]
    8. Simplified91.0%

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

    if -4.90000000000000021e-54 < F < -2.7999999999999999e-201

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

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

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

    if -2.7999999999999999e-201 < F < 1.99999999999999991e-44

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

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

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

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

        \[\leadsto \frac{-1 \cdot \color{blue}{\left(x \cdot \cos B\right)}}{\sin B} \]
      3. associate-*r*82.0%

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

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

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

    if 9.00000000000000057e-5 < F

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\right)} - 1} \]
      3. +-commutative38.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)}\right)} - 1 \]
      4. div-inv38.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\color{blue}{\frac{x}{\tan B}}\right)\right)} - 1 \]
    4. Applied egg-rr38.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\frac{x}{\tan B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.0037:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -4.9 \cdot 10^{-54}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq -2.8 \cdot 10^{-201}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2 \cdot 10^{-44}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 9 \cdot 10^{-5}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 8: 66.1% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -3.5 \cdot 10^{-54}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;F \leq 5 \cdot 10^{-64}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\

\mathbf{elif}\;F \leq 0.03:\\
\;\;\;\;t_0\\

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac73.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{B} \]
      6. metadata-eval73.3%

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x}{B} \]
    5. Simplified73.3%

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

    if -0.017000000000000001 < F < -3.49999999999999982e-54 or 5.00000000000000033e-64 < F < 0.029999999999999999

    1. Initial program 98.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. +-commutative98.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-neg98.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/99.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/99.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. *-commutative99.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. Simplified99.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 0 96.9%

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in F around inf 83.1%

      \[\leadsto \color{blue}{\frac{\sqrt{0.5} \cdot F}{\sin B}} \]
    7. Step-by-step derivation
      1. *-commutative83.1%

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{0.5}}}{\sin B} \]
      2. associate-*r/83.5%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} \]
    8. Simplified83.5%

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

    if -3.49999999999999982e-54 < F < -2.0000000000000001e-203

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

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

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

    if -2.0000000000000001e-203 < F < 5.00000000000000033e-64

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

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

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

    if 0.029999999999999999 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.017:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -3.5 \cdot 10^{-54}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq -2 \cdot 10^{-203}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-64}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 0.03:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]

Alternative 9: 72.3% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -5.2 \cdot 10^{-54}:\\
\;\;\;\;t_0\\

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

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

\mathbf{elif}\;F \leq 0.00029:\\
\;\;\;\;t_0\\

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac73.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{B} \]
      6. metadata-eval73.3%

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x}{B} \]
    5. Simplified73.3%

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

    if -0.0155 < F < -5.20000000000000004e-54 or 5.79999999999999988e-38 < F < 2.9e-4

    1. Initial program 98.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. +-commutative98.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-neg98.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/98.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/99.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. *-commutative99.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. Simplified99.2%

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in F around inf 90.5%

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

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{0.5}}}{\sin B} \]
      2. associate-*r/91.0%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} \]
    8. Simplified91.0%

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

    if -5.20000000000000004e-54 < F < -1.5499999999999999e-201

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

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

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

    if -1.5499999999999999e-201 < F < 5.79999999999999988e-38

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{\cos B}{\frac{\sin B}{x}}} \]
      2. *-rgt-identity81.8%

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

        \[\leadsto -\color{blue}{\cos B \cdot \frac{1}{\frac{\sin B}{x}}} \]
      4. associate-/r/81.6%

        \[\leadsto -\cos B \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot x\right)} \]
      5. associate-*l/81.9%

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

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

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

    if 2.9e-4 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.0155:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -5.2 \cdot 10^{-54}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq -1.55 \cdot 10^{-201}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-38}:\\ \;\;\;\;\cos B \cdot \frac{-x}{\sin B}\\ \mathbf{elif}\;F \leq 0.00029:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]

Alternative 10: 72.3% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -3.3 \cdot 10^{-54}:\\
\;\;\;\;t_0\\

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

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

\mathbf{elif}\;F \leq 0.00058:\\
\;\;\;\;t_0\\

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac73.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{B} \]
      6. metadata-eval73.3%

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x}{B} \]
    5. Simplified73.3%

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

    if -0.025000000000000001 < F < -3.29999999999999993e-54 or 2.6000000000000001e-40 < F < 5.8e-4

    1. Initial program 98.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. +-commutative98.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-neg98.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/98.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/99.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. *-commutative99.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. Simplified99.2%

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in F around inf 90.5%

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

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{0.5}}}{\sin B} \]
      2. associate-*r/91.0%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} \]
    8. Simplified91.0%

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

    if -3.29999999999999993e-54 < F < -1.3499999999999999e-202

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

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

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

    if -1.3499999999999999e-202 < F < 2.6000000000000001e-40

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

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

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

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

        \[\leadsto \frac{-1 \cdot \color{blue}{\left(x \cdot \cos B\right)}}{\sin B} \]
      3. associate-*r*82.0%

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

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

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

    if 5.8e-4 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.025:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -3.3 \cdot 10^{-54}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq -1.35 \cdot 10^{-202}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.6 \cdot 10^{-40}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.00058:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]

Alternative 11: 79.2% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -1.6 \cdot 10^{-54}:\\
\;\;\;\;t_0\\

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

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

\mathbf{elif}\;F \leq 0.00055:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 59.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 98.4%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B}\right)} - 1 \]
      4. neg-mul-138.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{\tan B}} + \frac{-1}{\sin B}\right)} - 1 \]
      5. fma-def38.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} - 1 \]
    4. Applied egg-rr38.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)\right)} \]
      2. expm1-log1p98.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)} \]
      3. rem-log-exp45.5%

        \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} \]
      4. fma-udef45.5%

        \[\leadsto \log \left(e^{\color{blue}{-1 \cdot \frac{x}{\tan B} + \frac{-1}{\sin B}}}\right) \]
      5. neg-mul-145.5%

        \[\leadsto \log \left(e^{\color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{-1}{\sin B}}\right) \]
      6. prod-exp43.5%

        \[\leadsto \log \color{blue}{\left(e^{-\frac{x}{\tan B}} \cdot e^{\frac{-1}{\sin B}}\right)} \]
      7. *-commutative43.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B}} \cdot e^{-\frac{x}{\tan B}}\right)} \]
      8. prod-exp45.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B} + \left(-\frac{x}{\tan B}\right)}\right)} \]
      9. rem-log-exp98.5%

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

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

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

    if -0.00949999999999999976 < F < -1.59999999999999999e-54 or 2.59999999999999987e-48 < F < 5.50000000000000033e-4

    1. Initial program 98.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. +-commutative98.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-neg98.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/98.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/99.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. *-commutative99.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. Simplified99.2%

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in F around inf 90.5%

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

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{0.5}}}{\sin B} \]
      2. associate-*r/91.0%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} \]
    8. Simplified91.0%

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

    if -1.59999999999999999e-54 < F < -2.7999999999999999e-201

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

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

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

    if -2.7999999999999999e-201 < F < 2.59999999999999987e-48

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

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

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

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

        \[\leadsto \frac{-1 \cdot \color{blue}{\left(x \cdot \cos B\right)}}{\sin B} \]
      3. associate-*r*82.0%

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

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

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

    if 5.50000000000000033e-4 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.0095:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.6 \cdot 10^{-54}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq -2.8 \cdot 10^{-201}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.6 \cdot 10^{-48}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.00055:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]

Alternative 12: 91.5% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -4.2 \cdot 10^{-54}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;F \leq 0.00026:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 59.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 98.4%

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B}\right)} - 1 \]
      4. neg-mul-138.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{\tan B}} + \frac{-1}{\sin B}\right)} - 1 \]
      5. fma-def38.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} - 1 \]
    4. Applied egg-rr38.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)\right)\right)} \]
      2. expm1-log1p98.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)} \]
      3. rem-log-exp45.5%

        \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(-1, \frac{x}{\tan B}, \frac{-1}{\sin B}\right)}\right)} \]
      4. fma-udef45.5%

        \[\leadsto \log \left(e^{\color{blue}{-1 \cdot \frac{x}{\tan B} + \frac{-1}{\sin B}}}\right) \]
      5. neg-mul-145.5%

        \[\leadsto \log \left(e^{\color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{-1}{\sin B}}\right) \]
      6. prod-exp43.5%

        \[\leadsto \log \color{blue}{\left(e^{-\frac{x}{\tan B}} \cdot e^{\frac{-1}{\sin B}}\right)} \]
      7. *-commutative43.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B}} \cdot e^{-\frac{x}{\tan B}}\right)} \]
      8. prod-exp45.5%

        \[\leadsto \log \color{blue}{\left(e^{\frac{-1}{\sin B} + \left(-\frac{x}{\tan B}\right)}\right)} \]
      9. rem-log-exp98.5%

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

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

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

    if -0.0074999999999999997 < F < -4.2e-54 or 6.00000000000000055e-39 < F < 2.59999999999999977e-4

    1. Initial program 98.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. +-commutative98.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-neg98.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/98.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/99.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. *-commutative99.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. Simplified99.2%

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in F around inf 90.5%

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

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{0.5}}}{\sin B} \]
      2. associate-*r/91.0%

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} \]
    8. Simplified91.0%

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

    if -4.2e-54 < F < 6.00000000000000055e-39

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in B around 0 87.8%

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

        \[\leadsto \color{blue}{\frac{\sqrt{0.5}}{\frac{B}{F}}} - \frac{x}{\tan B} \]
    8. Simplified87.8%

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

    if 2.59999999999999977e-4 < F

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\right)} - 1} \]
      3. +-commutative38.9%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)}\right)} - 1 \]
      4. div-inv38.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\color{blue}{\frac{x}{\tan B}}\right)\right)} - 1 \]
    4. Applied egg-rr38.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\sin B} + \left(-\frac{x}{\tan B}\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def38.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.0075:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -4.2 \cdot 10^{-54}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 6 \cdot 10^{-39}:\\ \;\;\;\;\frac{\sqrt{0.5}}{\frac{B}{F}} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 0.00026:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 13: 64.9% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -680:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.4 \cdot 10^{-203}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.3 \cdot 10^{-32}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{+155} \lor \neg \left(F \leq 1.1 \cdot 10^{+252}\right):\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -680.0)
   (- (/ -1.0 (sin B)) (/ x B))
   (if (<= F -1.4e-203)
     (- (* (pow (+ (+ (* F F) 2.0) (* x 2.0)) -0.5) (/ F B)) (/ x B))
     (if (<= F 2.3e-32)
       (+ (* x (/ -1.0 (tan B))) (* (/ F B) (/ -1.0 F)))
       (if (or (<= F 1.35e+155) (not (<= F 1.1e+252)))
         (- (/ 1.0 (sin B)) (/ x B))
         (- (/ 1.0 B) (* x (/ 1.0 (tan B)))))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -680.0) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= -1.4e-203) {
		tmp = (pow((((F * F) + 2.0) + (x * 2.0)), -0.5) * (F / B)) - (x / B);
	} else if (F <= 2.3e-32) {
		tmp = (x * (-1.0 / tan(B))) + ((F / B) * (-1.0 / F));
	} else if ((F <= 1.35e+155) || !(F <= 1.1e+252)) {
		tmp = (1.0 / sin(B)) - (x / B);
	} else {
		tmp = (1.0 / B) - (x * (1.0 / tan(B)));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-680.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= (-1.4d-203)) then
        tmp = (((((f * f) + 2.0d0) + (x * 2.0d0)) ** (-0.5d0)) * (f / b)) - (x / b)
    else if (f <= 2.3d-32) then
        tmp = (x * ((-1.0d0) / tan(b))) + ((f / b) * ((-1.0d0) / f))
    else if ((f <= 1.35d+155) .or. (.not. (f <= 1.1d+252))) then
        tmp = (1.0d0 / sin(b)) - (x / b)
    else
        tmp = (1.0d0 / b) - (x * (1.0d0 / tan(b)))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -680.0) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= -1.4e-203) {
		tmp = (Math.pow((((F * F) + 2.0) + (x * 2.0)), -0.5) * (F / B)) - (x / B);
	} else if (F <= 2.3e-32) {
		tmp = (x * (-1.0 / Math.tan(B))) + ((F / B) * (-1.0 / F));
	} else if ((F <= 1.35e+155) || !(F <= 1.1e+252)) {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	} else {
		tmp = (1.0 / B) - (x * (1.0 / Math.tan(B)));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -680.0:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= -1.4e-203:
		tmp = (math.pow((((F * F) + 2.0) + (x * 2.0)), -0.5) * (F / B)) - (x / B)
	elif F <= 2.3e-32:
		tmp = (x * (-1.0 / math.tan(B))) + ((F / B) * (-1.0 / F))
	elif (F <= 1.35e+155) or not (F <= 1.1e+252):
		tmp = (1.0 / math.sin(B)) - (x / B)
	else:
		tmp = (1.0 / B) - (x * (1.0 / math.tan(B)))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -680.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= -1.4e-203)
		tmp = Float64(Float64((Float64(Float64(Float64(F * F) + 2.0) + Float64(x * 2.0)) ^ -0.5) * Float64(F / B)) - Float64(x / B));
	elseif (F <= 2.3e-32)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(-1.0 / F)));
	elseif ((F <= 1.35e+155) || !(F <= 1.1e+252))
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / B) - Float64(x * Float64(1.0 / tan(B))));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -680.0)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= -1.4e-203)
		tmp = (((((F * F) + 2.0) + (x * 2.0)) ^ -0.5) * (F / B)) - (x / B);
	elseif (F <= 2.3e-32)
		tmp = (x * (-1.0 / tan(B))) + ((F / B) * (-1.0 / F));
	elseif ((F <= 1.35e+155) || ~((F <= 1.1e+252)))
		tmp = (1.0 / sin(B)) - (x / B);
	else
		tmp = (1.0 / B) - (x * (1.0 / tan(B)));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -680.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.4e-203], N[(N[(N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.3e-32], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[F, 1.35e+155], N[Not[LessEqual[F, 1.1e+252]], $MachinePrecision]], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;F \leq 1.35 \cdot 10^{+155} \lor \neg \left(F \leq 1.1 \cdot 10^{+252}\right):\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac74.1%

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

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

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

    if -680 < F < -1.40000000000000011e-203

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

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

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

    if -1.40000000000000011e-203 < F < 2.3000000000000001e-32

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

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

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

    if 2.3000000000000001e-32 < F < 1.34999999999999997e155 or 1.1e252 < F

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

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

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

    if 1.34999999999999997e155 < F < 1.1e252

    1. Initial program 45.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 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -680:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.4 \cdot 10^{-203}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.3 \cdot 10^{-32}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{+155} \lor \neg \left(F \leq 1.1 \cdot 10^{+252}\right):\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \]

Alternative 14: 64.9% accurate, 2.7× speedup?

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

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

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

\mathbf{elif}\;F \leq 3.8 \cdot 10^{-30}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\

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

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac72.4%

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

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x}{B} \]
    5. Simplified72.4%

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

    if -0.00142000000000000004 < F < -3.9500000000000001e-206

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in B around 0 66.7%

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

    if -3.9500000000000001e-206 < F < 3.8000000000000003e-30

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

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

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

    if 3.8000000000000003e-30 < F < 1.2000000000000001e155 or 3.49999999999999978e253 < F

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

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

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

    if 1.2000000000000001e155 < F < 3.49999999999999978e253

    1. Initial program 45.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 99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.00142:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -3.95 \cdot 10^{-206}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 3.8 \cdot 10^{-30}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 1.2 \cdot 10^{+155} \lor \neg \left(F \leq 3.5 \cdot 10^{+253}\right):\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \]

Alternative 15: 63.5% accurate, 2.8× speedup?

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

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

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

\mathbf{elif}\;F \leq 3.5 \cdot 10^{+63} \lor \neg \left(F \leq 2.7 \cdot 10^{+155}\right):\\
\;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac72.4%

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

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x}{B} \]
    5. Simplified72.4%

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

    if -0.0029 < F < -1.95e-203

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in B around 0 66.7%

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

    if -1.95e-203 < F < 3.50000000000000029e63 or 2.69999999999999994e155 < F

    1. Initial program 81.1%

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

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

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

    if 3.50000000000000029e63 < F < 2.69999999999999994e155

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.0029:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.95 \cdot 10^{-203}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 3.5 \cdot 10^{+63} \lor \neg \left(F \leq 2.7 \cdot 10^{+155}\right):\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]

Alternative 16: 63.7% accurate, 2.8× speedup?

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

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

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

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

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac72.4%

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

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x}{B} \]
    5. Simplified72.4%

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

    if -0.00279999999999999997 < F < -1.7200000000000001e-203

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in B around 0 66.7%

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

    if -1.7200000000000001e-203 < F < 3.8000000000000003e-30

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

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

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

    if 3.8000000000000003e-30 < F

    1. Initial program 68.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.0028:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.72 \cdot 10^{-203}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 3.8 \cdot 10^{-30}:\\ \;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]

Alternative 17: 58.0% accurate, 2.9× speedup?

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

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

\mathbf{elif}\;F \leq 10^{-49}:\\
\;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac63.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{B} \]
      6. metadata-eval63.3%

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x}{B} \]
    5. Simplified63.3%

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

    if -1.3499999999999999e-58 < F < 9.99999999999999936e-50

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

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

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

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

        \[\leadsto -\color{blue}{\frac{\cos B}{\frac{\sin B}{x}}} \]
    5. Simplified73.4%

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

      \[\leadsto -\color{blue}{\left(\frac{x}{B} + \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right) \cdot B\right)} \]
    7. Step-by-step derivation
      1. *-commutative40.3%

        \[\leadsto -\left(\frac{x}{B} + \color{blue}{B \cdot \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right)}\right) \]
      2. distribute-rgt-out--40.3%

        \[\leadsto -\left(\frac{x}{B} + B \cdot \color{blue}{\left(x \cdot \left(-0.5 - -0.16666666666666666\right)\right)}\right) \]
      3. metadata-eval40.3%

        \[\leadsto -\left(\frac{x}{B} + B \cdot \left(x \cdot \color{blue}{-0.3333333333333333}\right)\right) \]
    8. Simplified40.3%

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

    if 9.99999999999999936e-50 < F

    1. Initial program 69.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. Taylor expanded in B around 0 45.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.35 \cdot 10^{-58}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 10^{-49}:\\ \;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]

Alternative 18: 64.7% accurate, 2.9× speedup?

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

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

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

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac72.4%

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

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x}{B} \]
    5. Simplified72.4%

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

    if -0.0029 < F < 2.4e-10

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

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    6. Taylor expanded in B around 0 51.5%

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

    if 2.4e-10 < F

    1. Initial program 66.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.0029:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.4 \cdot 10^{-10}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]

Alternative 19: 51.1% accurate, 3.0× speedup?

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

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

\mathbf{elif}\;F \leq 8.5 \cdot 10^{-50}:\\
\;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\

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


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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{1}{\sin B}\right) - \frac{x}{B}} \]
      5. distribute-neg-frac63.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x}{B} \]
      6. metadata-eval63.3%

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x}{B} \]
    5. Simplified63.3%

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

    if -3.09999999999999976e-57 < F < 8.50000000000000012e-50

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

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

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

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

        \[\leadsto -\color{blue}{\frac{\cos B}{\frac{\sin B}{x}}} \]
    5. Simplified73.4%

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

      \[\leadsto -\color{blue}{\left(\frac{x}{B} + \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right) \cdot B\right)} \]
    7. Step-by-step derivation
      1. *-commutative40.3%

        \[\leadsto -\left(\frac{x}{B} + \color{blue}{B \cdot \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right)}\right) \]
      2. distribute-rgt-out--40.3%

        \[\leadsto -\left(\frac{x}{B} + B \cdot \color{blue}{\left(x \cdot \left(-0.5 - -0.16666666666666666\right)\right)}\right) \]
      3. metadata-eval40.3%

        \[\leadsto -\left(\frac{x}{B} + B \cdot \left(x \cdot \color{blue}{-0.3333333333333333}\right)\right) \]
    8. Simplified40.3%

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

    if 8.50000000000000012e-50 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.1 \cdot 10^{-57}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 8.5 \cdot 10^{-50}:\\ \;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]

Alternative 20: 44.1% accurate, 22.9× speedup?

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

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

\mathbf{elif}\;F \leq 10^{-49}:\\
\;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.44999999999999995e-58 < F < 9.99999999999999936e-50

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

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

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

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

        \[\leadsto -\color{blue}{\frac{\cos B}{\frac{\sin B}{x}}} \]
    5. Simplified73.4%

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

      \[\leadsto -\color{blue}{\left(\frac{x}{B} + \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right) \cdot B\right)} \]
    7. Step-by-step derivation
      1. *-commutative40.3%

        \[\leadsto -\left(\frac{x}{B} + \color{blue}{B \cdot \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right)}\right) \]
      2. distribute-rgt-out--40.3%

        \[\leadsto -\left(\frac{x}{B} + B \cdot \color{blue}{\left(x \cdot \left(-0.5 - -0.16666666666666666\right)\right)}\right) \]
      3. metadata-eval40.3%

        \[\leadsto -\left(\frac{x}{B} + B \cdot \left(x \cdot \color{blue}{-0.3333333333333333}\right)\right) \]
    8. Simplified40.3%

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

    if 9.99999999999999936e-50 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.45 \cdot 10^{-58}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 10^{-49}:\\ \;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]

Alternative 21: 44.0% accurate, 24.7× speedup?

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

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

\mathbf{elif}\;F \leq 8 \cdot 10^{-50}:\\
\;\;\;\;x \cdot \left(\frac{-1}{B} + B \cdot 0.3333333333333333\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3500000000000001e-57 < F < 8.00000000000000006e-50

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

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

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

        \[\leadsto \left(-\left(\frac{x}{B} + -0.3333333333333333 \cdot \color{blue}{\left(x \cdot B\right)}\right)\right) + \frac{-1}{\sin B} \]
    5. Simplified20.1%

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

      \[\leadsto \left(-\left(\frac{x}{B} + -0.3333333333333333 \cdot \left(x \cdot B\right)\right)\right) + \color{blue}{\left(-0.16666666666666666 \cdot B - \frac{1}{B}\right)} \]
    7. Taylor expanded in x around inf 40.1%

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

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

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

        \[\leadsto x \cdot \left(-1 \cdot \color{blue}{\left(\frac{1}{B} + -0.3333333333333333 \cdot B\right)}\right) \]
      4. distribute-lft-in40.1%

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

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

        \[\leadsto x \cdot \left(\color{blue}{\frac{-1}{B}} + -1 \cdot \left(-0.3333333333333333 \cdot B\right)\right) \]
      7. metadata-eval40.1%

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

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

        \[\leadsto x \cdot \left(\frac{-1}{B} + \left(-\color{blue}{\left(-0.3333333333333333\right)} \cdot B\right)\right) \]
      10. distribute-lft-neg-in40.1%

        \[\leadsto x \cdot \left(\frac{-1}{B} + \left(-\color{blue}{\left(-0.3333333333333333 \cdot B\right)}\right)\right) \]
      11. remove-double-neg40.1%

        \[\leadsto x \cdot \left(\frac{-1}{B} + \color{blue}{0.3333333333333333 \cdot B}\right) \]
      12. *-commutative40.1%

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

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

    if 8.00000000000000006e-50 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.35 \cdot 10^{-57}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 8 \cdot 10^{-50}:\\ \;\;\;\;x \cdot \left(\frac{-1}{B} + B \cdot 0.3333333333333333\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]

Alternative 22: 44.1% accurate, 35.5× speedup?

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

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

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

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


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

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.4e-43 < F < 1.15e-32

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.15e-32 < F

    1. Initial program 68.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -7.4 \cdot 10^{-43}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.15 \cdot 10^{-32}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]

Alternative 23: 37.2% accurate, 45.9× speedup?

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

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

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


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

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.50000000000000002e-43 < F

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.5 \cdot 10^{-43}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \]

Alternative 24: 29.4% accurate, 81.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-x}{B}} \]
  9. Final simplification27.3%

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

Alternative 25: 11.0% accurate, 108.0× speedup?

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

\\
\frac{-1}{B}
\end{array}
Derivation
  1. Initial program 79.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. Taylor expanded in F around -inf 51.8%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-1}{B}} \]
  7. Final simplification8.1%

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

Reproduce

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