VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.1% → 97.8%
Time: 26.8s
Alternatives: 29
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 29 alternatives:

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

Initial Program: 77.1% accurate, 1.0× speedup?

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

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

Alternative 1: 97.8% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 52.2%

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

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

    if -4.4e18 < F < 3.35e-37

    1. Initial program 99.6%

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

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

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

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

    if 3.35e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{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 -4.4 \cdot 10^{+18}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + {\left(\frac{\sin B}{F}\right)}^{-1} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 2: 99.5% accurate, 1.0× speedup?

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

\mathbf{elif}\;F \leq 2.5 \cdot 10^{+16}:\\
\;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{\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 < -6.6000000000000003e63

    1. Initial program 45.0%

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

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

    if -6.6000000000000003e63 < F < 2.5e16

    1. Initial program 99.6%

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

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

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

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied egg-rr55.8%

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

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

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

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

    if 2.5e16 < F

    1. Initial program 55.8%

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

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

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

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt18.9%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod12.6%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg12.6%

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.8%

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

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

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

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

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

Alternative 3: 97.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 55.1%

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

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

    if -5.79999999999999982 < F < 3.35e-37

    1. Initial program 99.6%

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

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

    if 3.35e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{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 -5.8:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 4: 97.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\
\;\;\;\;t_0 + \frac{F}{\sin B \cdot \sqrt{2 + x \cdot 2}}\\

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


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

    1. Initial program 55.1%

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

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

    if -5.79999999999999982 < F < 3.35e-37

    1. Initial program 99.6%

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

        \[\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. associate-/l*99.5%

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

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

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

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

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

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

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

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

    if 3.35e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{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 -5.8:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B \cdot \sqrt{2 + x \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 5: 91.2% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq 2.2 \cdot 10^{-133}:\\
\;\;\;\;t_1 \cdot \frac{F}{B} - t_2\\

\mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\
\;\;\;\;t_1 \cdot \left(F \cdot t_0\right) - \frac{x}{B}\\

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


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

    1. Initial program 57.7%

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

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

    if -4.5e-10 < F < 2.2000000000000001e-133

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

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

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

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

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

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def57.4%

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

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

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

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

    if 2.2000000000000001e-133 < F < 3.35e-37

    1. Initial program 99.3%

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

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

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

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

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

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

    if 3.35e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{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 simplification94.5%

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

Alternative 6: 78.1% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -5.8 \cdot 10^{-107}:\\
\;\;\;\;x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + t_0\\

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

\mathbf{elif}\;F \leq -5.3 \cdot 10^{-192}:\\
\;\;\;\;t_0 + x \cdot \frac{-1}{B}\\

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

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

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


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

    1. Initial program 57.1%

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

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

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

    if -1.44999999999999996e-9 < F < -5.7999999999999996e-107

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

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

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

    if -5.7999999999999996e-107 < F < -2.14999999999999989e-156

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.14999999999999989e-156 < F < -5.29999999999999969e-192

    1. Initial program 99.6%

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

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

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

    if -5.29999999999999969e-192 < F < 4.40000000000000006e-129

    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 F around -inf 42.3%

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac88.6%

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

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

    if 4.40000000000000006e-129 < F < 3.35e-37

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

    if 3.35e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.45 \cdot 10^{-9}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -5.8 \cdot 10^{-107}:\\ \;\;\;\;x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ \mathbf{elif}\;F \leq -2.15 \cdot 10^{-156}:\\ \;\;\;\;\left(-x\right) \cdot \frac{\cos B}{\sin B}\\ \mathbf{elif}\;F \leq -5.3 \cdot 10^{-192}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} + x \cdot \frac{-1}{B}\\ \mathbf{elif}\;F \leq 4.4 \cdot 10^{-129}:\\ \;\;\;\;\frac{-x}{\frac{\sin B}{\cos B}}\\ \mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\ \;\;\;\;\left(\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} + 0.3333333333333333 \cdot \left(x \cdot B\right)\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 7: 91.0% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 57.7%

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

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

    if -4.5e-10 < F < 3.35e-37

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

    if 3.35e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{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 simplification92.7%

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

Alternative 8: 70.8% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -4.6 \cdot 10^{-109}:\\
\;\;\;\;x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + t_1\\

\mathbf{elif}\;F \leq -4.6 \cdot 10^{-156}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq -5.5 \cdot 10^{-192}:\\
\;\;\;\;t_1 + x \cdot \frac{-1}{B}\\

\mathbf{elif}\;F \leq 1.35 \cdot 10^{-128}:\\
\;\;\;\;t_0\\

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

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


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

    1. Initial program 57.1%

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

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

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

    if -1.25e-9 < F < -4.6000000000000003e-109

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

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

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

    if -4.6000000000000003e-109 < F < -4.5999999999999999e-156 or -5.49999999999999995e-192 < F < 1.35000000000000003e-128

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.5999999999999999e-156 < F < -5.49999999999999995e-192

    1. Initial program 99.6%

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

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

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

    if 1.35000000000000003e-128 < F < 3.1999999999999999e-37

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

    if 3.1999999999999999e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.25 \cdot 10^{-9}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -4.6 \cdot 10^{-109}:\\ \;\;\;\;x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ \mathbf{elif}\;F \leq -4.6 \cdot 10^{-156}:\\ \;\;\;\;\left(-x\right) \cdot \frac{\cos B}{\sin B}\\ \mathbf{elif}\;F \leq -5.5 \cdot 10^{-192}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} + x \cdot \frac{-1}{B}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{-128}:\\ \;\;\;\;\left(-x\right) \cdot \frac{\cos B}{\sin B}\\ \mathbf{elif}\;F \leq 3.2 \cdot 10^{-37}:\\ \;\;\;\;\left(\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} + 0.3333333333333333 \cdot \left(x \cdot B\right)\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 9: 70.8% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -6.2 \cdot 10^{-107}:\\
\;\;\;\;x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + t_0\\

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

\mathbf{elif}\;F \leq -5.4 \cdot 10^{-192}:\\
\;\;\;\;t_0 + x \cdot \frac{-1}{B}\\

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

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

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


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

    1. Initial program 57.1%

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

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

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

    if -1.3500000000000001e-9 < F < -6.20000000000000043e-107

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

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

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

    if -6.20000000000000043e-107 < F < -7.19999999999999998e-156

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.19999999999999998e-156 < F < -5.39999999999999982e-192

    1. Initial program 99.6%

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

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

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

    if -5.39999999999999982e-192 < F < 3.39999999999999995e-131

    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 F around -inf 42.3%

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac88.6%

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

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

    if 3.39999999999999995e-131 < F < 2.5999999999999998e-37

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

    if 2.5999999999999998e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.35 \cdot 10^{-9}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -6.2 \cdot 10^{-107}:\\ \;\;\;\;x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ \mathbf{elif}\;F \leq -7.2 \cdot 10^{-156}:\\ \;\;\;\;\left(-x\right) \cdot \frac{\cos B}{\sin B}\\ \mathbf{elif}\;F \leq -5.4 \cdot 10^{-192}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} + x \cdot \frac{-1}{B}\\ \mathbf{elif}\;F \leq 3.4 \cdot 10^{-131}:\\ \;\;\;\;\frac{-x}{\frac{\sin B}{\cos B}}\\ \mathbf{elif}\;F \leq 2.6 \cdot 10^{-37}:\\ \;\;\;\;\left(\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} + 0.3333333333333333 \cdot \left(x \cdot B\right)\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 10: 85.3% accurate, 1.5× speedup?

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

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

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

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

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

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


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

    1. Initial program 57.7%

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

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

    if -3.6e-10 < F < -1.3000000000000001e-96

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

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

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

    if -1.3000000000000001e-96 < F < 1.3e-130

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac83.1%

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

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

    if 1.3e-130 < F < 2.40000000000000022e-38

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

    if 2.40000000000000022e-38 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.6 \cdot 10^{-10}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq -1.3 \cdot 10^{-96}:\\ \;\;\;\;x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ \mathbf{elif}\;F \leq 1.3 \cdot 10^{-130}:\\ \;\;\;\;\frac{-x}{\frac{\sin B}{\cos B}}\\ \mathbf{elif}\;F \leq 2.4 \cdot 10^{-38}:\\ \;\;\;\;\left(\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} + 0.3333333333333333 \cdot \left(x \cdot B\right)\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 11: 91.0% accurate, 1.5× speedup?

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

\mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{B} - t_0\\

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


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

    1. Initial program 57.7%

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

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

    if -4.5e-10 < F < 3.35e-37

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

    if 3.35e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{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 simplification92.7%

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

Alternative 12: 64.6% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ t_1 := x \cdot \frac{-1}{\tan B}\\ \mathbf{if}\;F \leq -1.2 \cdot 10^{-9}:\\ \;\;\;\;t_1 + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -2.1 \cdot 10^{-109}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;F \leq -1.8 \cdot 10^{-140}:\\ \;\;\;\;t_1 + \frac{1}{B}\\ \mathbf{elif}\;F \leq -6.6 \cdot 10^{-217}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\ \;\;\;\;t_1 + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 3.3 \cdot 10^{-37}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \left(F \cdot \frac{1}{B}\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0
         (+
          (* x (- (/ -1.0 B) (* B -0.3333333333333333)))
          (* (pow (+ (+ (* F F) 2.0) (* x 2.0)) -0.5) (/ F B))))
        (t_1 (* x (/ -1.0 (tan B)))))
   (if (<= F -1.2e-9)
     (+ t_1 (/ -1.0 B))
     (if (<= F -2.1e-109)
       t_0
       (if (<= F -1.8e-140)
         (+ t_1 (/ 1.0 B))
         (if (<= F -6.6e-217)
           t_0
           (if (<= F 1.92e-128)
             (+ t_1 (* (/ F B) (/ -1.0 F)))
             (if (<= F 3.3e-37)
               (- (* (sqrt (/ 1.0 (+ 2.0 (* x 2.0)))) (* F (/ 1.0 B))) (/ x B))
               (- (/ 1.0 B) (/ x (tan B)))))))))))
double code(double F, double B, double x) {
	double t_0 = (x * ((-1.0 / B) - (B * -0.3333333333333333))) + (pow((((F * F) + 2.0) + (x * 2.0)), -0.5) * (F / B));
	double t_1 = x * (-1.0 / tan(B));
	double tmp;
	if (F <= -1.2e-9) {
		tmp = t_1 + (-1.0 / B);
	} else if (F <= -2.1e-109) {
		tmp = t_0;
	} else if (F <= -1.8e-140) {
		tmp = t_1 + (1.0 / B);
	} else if (F <= -6.6e-217) {
		tmp = t_0;
	} else if (F <= 1.92e-128) {
		tmp = t_1 + ((F / B) * (-1.0 / F));
	} else if (F <= 3.3e-37) {
		tmp = (sqrt((1.0 / (2.0 + (x * 2.0)))) * (F * (1.0 / B))) - (x / B);
	} else {
		tmp = (1.0 / B) - (x / tan(B));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (x * (((-1.0d0) / b) - (b * (-0.3333333333333333d0)))) + (((((f * f) + 2.0d0) + (x * 2.0d0)) ** (-0.5d0)) * (f / b))
    t_1 = x * ((-1.0d0) / tan(b))
    if (f <= (-1.2d-9)) then
        tmp = t_1 + ((-1.0d0) / b)
    else if (f <= (-2.1d-109)) then
        tmp = t_0
    else if (f <= (-1.8d-140)) then
        tmp = t_1 + (1.0d0 / b)
    else if (f <= (-6.6d-217)) then
        tmp = t_0
    else if (f <= 1.92d-128) then
        tmp = t_1 + ((f / b) * ((-1.0d0) / f))
    else if (f <= 3.3d-37) then
        tmp = (sqrt((1.0d0 / (2.0d0 + (x * 2.0d0)))) * (f * (1.0d0 / b))) - (x / b)
    else
        tmp = (1.0d0 / b) - (x / tan(b))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = (x * ((-1.0 / B) - (B * -0.3333333333333333))) + (Math.pow((((F * F) + 2.0) + (x * 2.0)), -0.5) * (F / B));
	double t_1 = x * (-1.0 / Math.tan(B));
	double tmp;
	if (F <= -1.2e-9) {
		tmp = t_1 + (-1.0 / B);
	} else if (F <= -2.1e-109) {
		tmp = t_0;
	} else if (F <= -1.8e-140) {
		tmp = t_1 + (1.0 / B);
	} else if (F <= -6.6e-217) {
		tmp = t_0;
	} else if (F <= 1.92e-128) {
		tmp = t_1 + ((F / B) * (-1.0 / F));
	} else if (F <= 3.3e-37) {
		tmp = (Math.sqrt((1.0 / (2.0 + (x * 2.0)))) * (F * (1.0 / B))) - (x / B);
	} else {
		tmp = (1.0 / B) - (x / Math.tan(B));
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (x * ((-1.0 / B) - (B * -0.3333333333333333))) + (math.pow((((F * F) + 2.0) + (x * 2.0)), -0.5) * (F / B))
	t_1 = x * (-1.0 / math.tan(B))
	tmp = 0
	if F <= -1.2e-9:
		tmp = t_1 + (-1.0 / B)
	elif F <= -2.1e-109:
		tmp = t_0
	elif F <= -1.8e-140:
		tmp = t_1 + (1.0 / B)
	elif F <= -6.6e-217:
		tmp = t_0
	elif F <= 1.92e-128:
		tmp = t_1 + ((F / B) * (-1.0 / F))
	elif F <= 3.3e-37:
		tmp = (math.sqrt((1.0 / (2.0 + (x * 2.0)))) * (F * (1.0 / B))) - (x / B)
	else:
		tmp = (1.0 / B) - (x / math.tan(B))
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(x * Float64(Float64(-1.0 / B) - Float64(B * -0.3333333333333333))) + Float64((Float64(Float64(Float64(F * F) + 2.0) + Float64(x * 2.0)) ^ -0.5) * Float64(F / B)))
	t_1 = Float64(x * Float64(-1.0 / tan(B)))
	tmp = 0.0
	if (F <= -1.2e-9)
		tmp = Float64(t_1 + Float64(-1.0 / B));
	elseif (F <= -2.1e-109)
		tmp = t_0;
	elseif (F <= -1.8e-140)
		tmp = Float64(t_1 + Float64(1.0 / B));
	elseif (F <= -6.6e-217)
		tmp = t_0;
	elseif (F <= 1.92e-128)
		tmp = Float64(t_1 + Float64(Float64(F / B) * Float64(-1.0 / F)));
	elseif (F <= 3.3e-37)
		tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0)))) * Float64(F * Float64(1.0 / B))) - Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / B) - Float64(x / tan(B)));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = (x * ((-1.0 / B) - (B * -0.3333333333333333))) + (((((F * F) + 2.0) + (x * 2.0)) ^ -0.5) * (F / B));
	t_1 = x * (-1.0 / tan(B));
	tmp = 0.0;
	if (F <= -1.2e-9)
		tmp = t_1 + (-1.0 / B);
	elseif (F <= -2.1e-109)
		tmp = t_0;
	elseif (F <= -1.8e-140)
		tmp = t_1 + (1.0 / B);
	elseif (F <= -6.6e-217)
		tmp = t_0;
	elseif (F <= 1.92e-128)
		tmp = t_1 + ((F / B) * (-1.0 / F));
	elseif (F <= 3.3e-37)
		tmp = (sqrt((1.0 / (2.0 + (x * 2.0)))) * (F * (1.0 / B))) - (x / B);
	else
		tmp = (1.0 / B) - (x / tan(B));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(x * N[(N[(-1.0 / B), $MachinePrecision] - N[(B * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.2e-9], N[(t$95$1 + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -2.1e-109], t$95$0, If[LessEqual[F, -1.8e-140], N[(t$95$1 + N[(1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -6.6e-217], t$95$0, If[LessEqual[F, 1.92e-128], N[(t$95$1 + N[(N[(F / B), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.3e-37], N[(N[(N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -2.1 \cdot 10^{-109}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq -1.8 \cdot 10^{-140}:\\
\;\;\;\;t_1 + \frac{1}{B}\\

\mathbf{elif}\;F \leq -6.6 \cdot 10^{-217}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\
\;\;\;\;t_1 + \frac{F}{B} \cdot \frac{-1}{F}\\

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

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


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

    1. Initial program 57.1%

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

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

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

    if -1.2e-9 < F < -2.09999999999999996e-109 or -1.8e-140 < F < -6.59999999999999986e-217

    1. Initial program 99.6%

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

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

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

    if -2.09999999999999996e-109 < F < -1.8e-140

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

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

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

    if -6.59999999999999986e-217 < F < 1.91999999999999991e-128

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

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

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

    if 1.91999999999999991e-128 < F < 3.29999999999999982e-37

    1. Initial program 99.2%

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

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

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

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

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

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

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

    if 3.29999999999999982e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.2 \cdot 10^{-9}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -2.1 \cdot 10^{-109}:\\ \;\;\;\;x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ \mathbf{elif}\;F \leq -1.8 \cdot 10^{-140}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\ \mathbf{elif}\;F \leq -6.6 \cdot 10^{-217}:\\ \;\;\;\;x \cdot \left(\frac{-1}{B} - B \cdot -0.3333333333333333\right) + {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ \mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 3.3 \cdot 10^{-37}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \left(F \cdot \frac{1}{B}\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 13: 64.4% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{2 + x \cdot 2}}\\ t_1 := \left(t_0 \cdot \frac{F}{B} + 0.3333333333333333 \cdot \left(x \cdot B\right)\right) - \frac{x}{B}\\ t_2 := x \cdot \frac{-1}{\tan B}\\ \mathbf{if}\;F \leq -1.45 \cdot 10^{-9}:\\ \;\;\;\;t_2 + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -1.7 \cdot 10^{-97}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;F \leq -1.25 \cdot 10^{-140}:\\ \;\;\;\;t_2 + \frac{1}{B}\\ \mathbf{elif}\;F \leq -3.6 \cdot 10^{-217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\ \;\;\;\;t_2 + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 4.5 \cdot 10^{-38}:\\ \;\;\;\;t_0 \cdot \left(F \cdot \frac{1}{B}\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (sqrt (/ 1.0 (+ 2.0 (* x 2.0)))))
        (t_1 (- (+ (* t_0 (/ F B)) (* 0.3333333333333333 (* x B))) (/ x B)))
        (t_2 (* x (/ -1.0 (tan B)))))
   (if (<= F -1.45e-9)
     (+ t_2 (/ -1.0 B))
     (if (<= F -1.7e-97)
       t_1
       (if (<= F -1.25e-140)
         (+ t_2 (/ 1.0 B))
         (if (<= F -3.6e-217)
           t_1
           (if (<= F 1.92e-128)
             (+ t_2 (* (/ F B) (/ -1.0 F)))
             (if (<= F 4.5e-38)
               (- (* t_0 (* F (/ 1.0 B))) (/ x B))
               (- (/ 1.0 B) (/ x (tan B)))))))))))
double code(double F, double B, double x) {
	double t_0 = sqrt((1.0 / (2.0 + (x * 2.0))));
	double t_1 = ((t_0 * (F / B)) + (0.3333333333333333 * (x * B))) - (x / B);
	double t_2 = x * (-1.0 / tan(B));
	double tmp;
	if (F <= -1.45e-9) {
		tmp = t_2 + (-1.0 / B);
	} else if (F <= -1.7e-97) {
		tmp = t_1;
	} else if (F <= -1.25e-140) {
		tmp = t_2 + (1.0 / B);
	} else if (F <= -3.6e-217) {
		tmp = t_1;
	} else if (F <= 1.92e-128) {
		tmp = t_2 + ((F / B) * (-1.0 / F));
	} else if (F <= 4.5e-38) {
		tmp = (t_0 * (F * (1.0 / B))) - (x / B);
	} else {
		tmp = (1.0 / B) - (x / tan(B));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = sqrt((1.0d0 / (2.0d0 + (x * 2.0d0))))
    t_1 = ((t_0 * (f / b)) + (0.3333333333333333d0 * (x * b))) - (x / b)
    t_2 = x * ((-1.0d0) / tan(b))
    if (f <= (-1.45d-9)) then
        tmp = t_2 + ((-1.0d0) / b)
    else if (f <= (-1.7d-97)) then
        tmp = t_1
    else if (f <= (-1.25d-140)) then
        tmp = t_2 + (1.0d0 / b)
    else if (f <= (-3.6d-217)) then
        tmp = t_1
    else if (f <= 1.92d-128) then
        tmp = t_2 + ((f / b) * ((-1.0d0) / f))
    else if (f <= 4.5d-38) then
        tmp = (t_0 * (f * (1.0d0 / b))) - (x / b)
    else
        tmp = (1.0d0 / b) - (x / tan(b))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = Math.sqrt((1.0 / (2.0 + (x * 2.0))));
	double t_1 = ((t_0 * (F / B)) + (0.3333333333333333 * (x * B))) - (x / B);
	double t_2 = x * (-1.0 / Math.tan(B));
	double tmp;
	if (F <= -1.45e-9) {
		tmp = t_2 + (-1.0 / B);
	} else if (F <= -1.7e-97) {
		tmp = t_1;
	} else if (F <= -1.25e-140) {
		tmp = t_2 + (1.0 / B);
	} else if (F <= -3.6e-217) {
		tmp = t_1;
	} else if (F <= 1.92e-128) {
		tmp = t_2 + ((F / B) * (-1.0 / F));
	} else if (F <= 4.5e-38) {
		tmp = (t_0 * (F * (1.0 / B))) - (x / B);
	} else {
		tmp = (1.0 / B) - (x / Math.tan(B));
	}
	return tmp;
}
def code(F, B, x):
	t_0 = math.sqrt((1.0 / (2.0 + (x * 2.0))))
	t_1 = ((t_0 * (F / B)) + (0.3333333333333333 * (x * B))) - (x / B)
	t_2 = x * (-1.0 / math.tan(B))
	tmp = 0
	if F <= -1.45e-9:
		tmp = t_2 + (-1.0 / B)
	elif F <= -1.7e-97:
		tmp = t_1
	elif F <= -1.25e-140:
		tmp = t_2 + (1.0 / B)
	elif F <= -3.6e-217:
		tmp = t_1
	elif F <= 1.92e-128:
		tmp = t_2 + ((F / B) * (-1.0 / F))
	elif F <= 4.5e-38:
		tmp = (t_0 * (F * (1.0 / B))) - (x / B)
	else:
		tmp = (1.0 / B) - (x / math.tan(B))
	return tmp
function code(F, B, x)
	t_0 = sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0))))
	t_1 = Float64(Float64(Float64(t_0 * Float64(F / B)) + Float64(0.3333333333333333 * Float64(x * B))) - Float64(x / B))
	t_2 = Float64(x * Float64(-1.0 / tan(B)))
	tmp = 0.0
	if (F <= -1.45e-9)
		tmp = Float64(t_2 + Float64(-1.0 / B));
	elseif (F <= -1.7e-97)
		tmp = t_1;
	elseif (F <= -1.25e-140)
		tmp = Float64(t_2 + Float64(1.0 / B));
	elseif (F <= -3.6e-217)
		tmp = t_1;
	elseif (F <= 1.92e-128)
		tmp = Float64(t_2 + Float64(Float64(F / B) * Float64(-1.0 / F)));
	elseif (F <= 4.5e-38)
		tmp = Float64(Float64(t_0 * Float64(F * Float64(1.0 / B))) - Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / B) - Float64(x / tan(B)));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = sqrt((1.0 / (2.0 + (x * 2.0))));
	t_1 = ((t_0 * (F / B)) + (0.3333333333333333 * (x * B))) - (x / B);
	t_2 = x * (-1.0 / tan(B));
	tmp = 0.0;
	if (F <= -1.45e-9)
		tmp = t_2 + (-1.0 / B);
	elseif (F <= -1.7e-97)
		tmp = t_1;
	elseif (F <= -1.25e-140)
		tmp = t_2 + (1.0 / B);
	elseif (F <= -3.6e-217)
		tmp = t_1;
	elseif (F <= 1.92e-128)
		tmp = t_2 + ((F / B) * (-1.0 / F));
	elseif (F <= 4.5e-38)
		tmp = (t_0 * (F * (1.0 / B))) - (x / B);
	else
		tmp = (1.0 / B) - (x / tan(B));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(x * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.45e-9], N[(t$95$2 + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.7e-97], t$95$1, If[LessEqual[F, -1.25e-140], N[(t$95$2 + N[(1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -3.6e-217], t$95$1, If[LessEqual[F, 1.92e-128], N[(t$95$2 + N[(N[(F / B), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.5e-38], N[(N[(t$95$0 * N[(F * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{2 + x \cdot 2}}\\
t_1 := \left(t_0 \cdot \frac{F}{B} + 0.3333333333333333 \cdot \left(x \cdot B\right)\right) - \frac{x}{B}\\
t_2 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -1.45 \cdot 10^{-9}:\\
\;\;\;\;t_2 + \frac{-1}{B}\\

\mathbf{elif}\;F \leq -1.7 \cdot 10^{-97}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;F \leq -1.25 \cdot 10^{-140}:\\
\;\;\;\;t_2 + \frac{1}{B}\\

\mathbf{elif}\;F \leq -3.6 \cdot 10^{-217}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\
\;\;\;\;t_2 + \frac{F}{B} \cdot \frac{-1}{F}\\

\mathbf{elif}\;F \leq 4.5 \cdot 10^{-38}:\\
\;\;\;\;t_0 \cdot \left(F \cdot \frac{1}{B}\right) - \frac{x}{B}\\

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


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

    1. Initial program 57.1%

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

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

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

    if -1.44999999999999996e-9 < F < -1.6999999999999999e-97 or -1.25000000000000004e-140 < F < -3.59999999999999981e-217

    1. Initial program 99.6%

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

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

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

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

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

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def61.8%

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

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

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

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

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

    if -1.6999999999999999e-97 < F < -1.25000000000000004e-140

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

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

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

    if -3.59999999999999981e-217 < F < 1.91999999999999991e-128

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

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

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

    if 1.91999999999999991e-128 < F < 4.50000000000000009e-38

    1. Initial program 99.2%

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

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

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

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

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

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

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

    if 4.50000000000000009e-38 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.45 \cdot 10^{-9}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -1.7 \cdot 10^{-97}:\\ \;\;\;\;\left(\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} + 0.3333333333333333 \cdot \left(x \cdot B\right)\right) - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.25 \cdot 10^{-140}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\ \mathbf{elif}\;F \leq -3.6 \cdot 10^{-217}:\\ \;\;\;\;\left(\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} + 0.3333333333333333 \cdot \left(x \cdot B\right)\right) - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 4.5 \cdot 10^{-38}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \left(F \cdot \frac{1}{B}\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 14: 63.7% accurate, 2.6× speedup?

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

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

\mathbf{elif}\;F \leq -3.35 \cdot 10^{-217}:\\
\;\;\;\;t_0 \cdot \frac{F}{B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq 2.12 \cdot 10^{-128}:\\
\;\;\;\;t_1 + \frac{F}{B} \cdot \frac{-1}{F}\\

\mathbf{elif}\;F \leq 3.1 \cdot 10^{-40}:\\
\;\;\;\;t_0 \cdot \left(F \cdot \frac{1}{B}\right) - \frac{x}{B}\\

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


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

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

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

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

    if -1.05e-141 < F < -3.35e-217

    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. Step-by-step derivation
      1. clear-num99.8%

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

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

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

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

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

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

    if -3.35e-217 < F < 2.11999999999999989e-128

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

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

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

    if 2.11999999999999989e-128 < F < 3.10000000000000011e-40

    1. Initial program 99.2%

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

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

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

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

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

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

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

    if 3.10000000000000011e-40 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.05 \cdot 10^{-141}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -3.35 \cdot 10^{-217}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.12 \cdot 10^{-128}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 3.1 \cdot 10^{-40}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \left(F \cdot \frac{1}{B}\right) - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 15: 63.7% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{B}\\
t_1 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -6.1 \cdot 10^{-142}:\\
\;\;\;\;t_1 + \frac{-1}{B}\\

\mathbf{elif}\;F \leq -5.5 \cdot 10^{-217}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\
\;\;\;\;t_1 + \frac{F}{B} \cdot \frac{-1}{F}\\

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

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


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

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

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

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

    if -6.1000000000000001e-142 < F < -5.49999999999999975e-217 or 1.91999999999999991e-128 < F < 3.29999999999999982e-37

    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. clear-num99.6%

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

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

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

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

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

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

    if -5.49999999999999975e-217 < F < 1.91999999999999991e-128

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

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

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

    if 3.29999999999999982e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -6.1 \cdot 10^{-142}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -5.5 \cdot 10^{-217}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 3.3 \cdot 10^{-37}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 16: 63.6% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ t_1 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -4.5 \cdot 10^{-142}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -2.55 \cdot 10^{-259}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;F \leq 1.62 \cdot 10^{-130}:\\ \;\;\;\;\frac{F}{B} \cdot \frac{1}{F} - t_1\\ \mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - t_1\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ (- (* F (sqrt (/ 1.0 (+ 2.0 (* x 2.0))))) x) B))
        (t_1 (/ x (tan B))))
   (if (<= F -4.5e-142)
     (+ (* x (/ -1.0 (tan B))) (/ -1.0 B))
     (if (<= F -2.55e-259)
       t_0
       (if (<= F 1.62e-130)
         (- (* (/ F B) (/ 1.0 F)) t_1)
         (if (<= F 3.35e-37) t_0 (- (/ 1.0 B) t_1)))))))
double code(double F, double B, double x) {
	double t_0 = ((F * sqrt((1.0 / (2.0 + (x * 2.0))))) - x) / B;
	double t_1 = x / tan(B);
	double tmp;
	if (F <= -4.5e-142) {
		tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
	} else if (F <= -2.55e-259) {
		tmp = t_0;
	} else if (F <= 1.62e-130) {
		tmp = ((F / B) * (1.0 / F)) - t_1;
	} else if (F <= 3.35e-37) {
		tmp = t_0;
	} else {
		tmp = (1.0 / 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((1.0d0 / (2.0d0 + (x * 2.0d0))))) - x) / b
    t_1 = x / tan(b)
    if (f <= (-4.5d-142)) then
        tmp = (x * ((-1.0d0) / tan(b))) + ((-1.0d0) / b)
    else if (f <= (-2.55d-259)) then
        tmp = t_0
    else if (f <= 1.62d-130) then
        tmp = ((f / b) * (1.0d0 / f)) - t_1
    else if (f <= 3.35d-37) then
        tmp = t_0
    else
        tmp = (1.0d0 / 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((1.0 / (2.0 + (x * 2.0))))) - x) / B;
	double t_1 = x / Math.tan(B);
	double tmp;
	if (F <= -4.5e-142) {
		tmp = (x * (-1.0 / Math.tan(B))) + (-1.0 / B);
	} else if (F <= -2.55e-259) {
		tmp = t_0;
	} else if (F <= 1.62e-130) {
		tmp = ((F / B) * (1.0 / F)) - t_1;
	} else if (F <= 3.35e-37) {
		tmp = t_0;
	} else {
		tmp = (1.0 / B) - t_1;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = ((F * math.sqrt((1.0 / (2.0 + (x * 2.0))))) - x) / B
	t_1 = x / math.tan(B)
	tmp = 0
	if F <= -4.5e-142:
		tmp = (x * (-1.0 / math.tan(B))) + (-1.0 / B)
	elif F <= -2.55e-259:
		tmp = t_0
	elif F <= 1.62e-130:
		tmp = ((F / B) * (1.0 / F)) - t_1
	elif F <= 3.35e-37:
		tmp = t_0
	else:
		tmp = (1.0 / B) - t_1
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(Float64(F * sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0))))) - x) / B)
	t_1 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -4.5e-142)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B));
	elseif (F <= -2.55e-259)
		tmp = t_0;
	elseif (F <= 1.62e-130)
		tmp = Float64(Float64(Float64(F / B) * Float64(1.0 / F)) - t_1);
	elseif (F <= 3.35e-37)
		tmp = t_0;
	else
		tmp = Float64(Float64(1.0 / B) - t_1);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = ((F * sqrt((1.0 / (2.0 + (x * 2.0))))) - x) / B;
	t_1 = x / tan(B);
	tmp = 0.0;
	if (F <= -4.5e-142)
		tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
	elseif (F <= -2.55e-259)
		tmp = t_0;
	elseif (F <= 1.62e-130)
		tmp = ((F / B) * (1.0 / F)) - t_1;
	elseif (F <= 3.35e-37)
		tmp = t_0;
	else
		tmp = (1.0 / B) - t_1;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[(F * N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4.5e-142], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -2.55e-259], t$95$0, If[LessEqual[F, 1.62e-130], N[(N[(N[(F / B), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, 3.35e-37], t$95$0, N[(N[(1.0 / B), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\
t_1 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -4.5 \cdot 10^{-142}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\

\mathbf{elif}\;F \leq -2.55 \cdot 10^{-259}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq 1.62 \cdot 10^{-130}:\\
\;\;\;\;\frac{F}{B} \cdot \frac{1}{F} - t_1\\

\mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\
\;\;\;\;t_0\\

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


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

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

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

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

    if -4.50000000000000019e-142 < F < -2.5499999999999999e-259 or 1.62e-130 < F < 3.35e-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. Taylor expanded in B around 0 83.2%

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

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

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

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

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

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

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

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

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

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

    if -2.5499999999999999e-259 < F < 1.62e-130

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

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

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

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

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

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def56.4%

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

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

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

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

    if 3.35e-37 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -4.5 \cdot 10^{-142}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -2.55 \cdot 10^{-259}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{elif}\;F \leq 1.62 \cdot 10^{-130}:\\ \;\;\;\;\frac{F}{B} \cdot \frac{1}{F} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 3.35 \cdot 10^{-37}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 17: 63.7% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\
t_1 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -9.5 \cdot 10^{-142}:\\
\;\;\;\;t_1 + \frac{-1}{B}\\

\mathbf{elif}\;F \leq -5.6 \cdot 10^{-217}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\
\;\;\;\;t_1 + \frac{F}{B} \cdot \frac{-1}{F}\\

\mathbf{elif}\;F \leq 5.8 \cdot 10^{-41}:\\
\;\;\;\;t_0\\

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


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

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

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

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

    if -9.49999999999999967e-142 < F < -5.6e-217 or 1.91999999999999991e-128 < F < 5.79999999999999955e-41

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

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

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

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

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

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

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

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

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

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

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

    if -5.6e-217 < F < 1.91999999999999991e-128

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

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

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

    if 5.79999999999999955e-41 < F

    1. Initial program 58.0%

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

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

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

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -9.5 \cdot 10^{-142}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -5.6 \cdot 10^{-217}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{elif}\;F \leq 1.92 \cdot 10^{-128}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-41}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 18: 57.1% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{1}{B} - \frac{x}{\tan B}\\
\mathbf{if}\;x \leq -3.3 \cdot 10^{-40}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 3.1 \cdot 10^{-145}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x \leq 9.2 \cdot 10^{-10}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.29999999999999993e-40 or 9.20000000000000028e-10 < x

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

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

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

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt44.4%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod29.6%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg29.6%

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

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

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv2.2%

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

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

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

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

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      15. metadata-eval0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      16. metadata-eval0.8%

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub095.5%

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

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

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

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

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

    if -3.29999999999999993e-40 < x < 3.1e-145 or 5.3000000000000003e-49 < x < 9.20000000000000028e-10

    1. Initial program 71.2%

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

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod21.6%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg21.6%

        \[\leadsto 0 - \left(\sqrt{\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      6. sqrt-unprod9.5%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt21.7%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv21.7%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity21.7%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt6.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub037.5%

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

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

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

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

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

    if 3.1e-145 < x < 5.3000000000000003e-49

    1. Initial program 72.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 38.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{-40}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{-145}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{-49}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;x \leq 9.2 \cdot 10^{-10}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 19: 62.6% accurate, 2.8× speedup?

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

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

\mathbf{elif}\;F \leq 4.7 \cdot 10^{+45}:\\
\;\;\;\;\frac{F}{B} \cdot \frac{1}{F} - t_0\\

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

\mathbf{elif}\;F \leq 3.7 \cdot 10^{+94}:\\
\;\;\;\;\frac{1}{\sin B}\\

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


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

    1. Initial program 55.1%

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

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

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

    if -16 < F < 4.70000000000000002e45

    1. Initial program 99.6%

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

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

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

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

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

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def52.7%

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

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

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

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

    if 4.70000000000000002e45 < F < 4.79999999999999979e45

    1. Initial program 0.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    6. Taylor expanded in x around inf 100.0%

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

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

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

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

    if 4.79999999999999979e45 < F < 3.7000000000000001e94

    1. Initial program 92.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 8.6%

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

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

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt8.4%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod8.6%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg8.6%

        \[\leadsto 0 - \left(\sqrt{\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      6. sqrt-unprod0.4%

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

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv1.2%

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

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.5%

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

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      15. metadata-eval36.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      16. metadata-eval36.9%

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.8%

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

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

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

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

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

    if 3.7000000000000001e94 < F

    1. Initial program 46.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 44.7%

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

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

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt22.5%

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

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

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

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

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

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

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

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

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

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

      \[\leadsto \color{blue}{\frac{1}{B}} - \frac{x}{\tan B} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification66.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -16:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 4.7 \cdot 10^{+45}:\\ \;\;\;\;\frac{F}{B} \cdot \frac{1}{F} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.8 \cdot 10^{+45}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{elif}\;F \leq 3.7 \cdot 10^{+94}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 20: 44.6% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -7 \cdot 10^{+96}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -4.7 \cdot 10^{-12}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 485:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -7e+96)
   (/ (- -1.0 x) B)
   (if (<= F -4.7e-12)
     (/ -1.0 (sin B))
     (if (<= F 485.0)
       (* x (+ (* B 0.3333333333333333) (/ -1.0 B)))
       (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -7e+96) {
		tmp = (-1.0 - x) / B;
	} else if (F <= -4.7e-12) {
		tmp = -1.0 / sin(B);
	} else if (F <= 485.0) {
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	} else {
		tmp = 1.0 / sin(B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-7d+96)) then
        tmp = ((-1.0d0) - x) / b
    else if (f <= (-4.7d-12)) then
        tmp = (-1.0d0) / sin(b)
    else if (f <= 485.0d0) then
        tmp = x * ((b * 0.3333333333333333d0) + ((-1.0d0) / b))
    else
        tmp = 1.0d0 / sin(b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -7e+96) {
		tmp = (-1.0 - x) / B;
	} else if (F <= -4.7e-12) {
		tmp = -1.0 / Math.sin(B);
	} else if (F <= 485.0) {
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	} else {
		tmp = 1.0 / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -7e+96:
		tmp = (-1.0 - x) / B
	elif F <= -4.7e-12:
		tmp = -1.0 / math.sin(B)
	elif F <= 485.0:
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B))
	else:
		tmp = 1.0 / math.sin(B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -7e+96)
		tmp = Float64(Float64(-1.0 - x) / B);
	elseif (F <= -4.7e-12)
		tmp = Float64(-1.0 / sin(B));
	elseif (F <= 485.0)
		tmp = Float64(x * Float64(Float64(B * 0.3333333333333333) + Float64(-1.0 / B)));
	else
		tmp = Float64(1.0 / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -7e+96)
		tmp = (-1.0 - x) / B;
	elseif (F <= -4.7e-12)
		tmp = -1.0 / sin(B);
	elseif (F <= 485.0)
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	else
		tmp = 1.0 / sin(B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -7e+96], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -4.7e-12], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 485.0], N[(x * N[(N[(B * 0.3333333333333333), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -7 \cdot 10^{+96}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq -4.7 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{\sin B}\\

\mathbf{elif}\;F \leq 485:\\
\;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -6.9999999999999998e96

    1. Initial program 40.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 60.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/60.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in60.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval60.9%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-160.9%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified60.9%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]

    if -6.9999999999999998e96 < F < -4.69999999999999976e-12

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 87.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 51.9%

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\right) + \frac{-1}{\sin B} \]
    4. Taylor expanded in x around 0 56.6%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]

    if -4.69999999999999976e-12 < F < 485

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 39.2%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 25.7%

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\right) + \frac{-1}{\sin B} \]
    4. Taylor expanded in x around -inf 38.5%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(\frac{1}{B} - 0.3333333333333333 \cdot B\right)\right)} \]

    if 485 < F

    1. Initial program 56.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 39.1%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. neg-sub039.1%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} + \frac{-1}{\sin B} \]
      2. associate-+l-39.1%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt18.4%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod12.3%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg12.3%

        \[\leadsto 0 - \left(\sqrt{\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      6. sqrt-unprod0.3%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

        \[\leadsto 0 - \left(\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B}\right) \]
      8. div-inv0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

        \[\leadsto 0 - \color{blue}{\left(\left(-x \cdot \frac{1}{\tan B}\right) + \left(--1\right) \cdot \frac{1}{\sin B}\right)} \]
      10. metadata-eval0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}}\right) \]
      13. sqrt-unprod18.2%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B} \cdot \frac{1}{\sin B}}}\right) \]
      14. frac-times18.1%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      15. metadata-eval18.1%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      16. metadata-eval18.1%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{0 - \left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. associate--r+99.7%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub099.7%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      3. distribute-neg-frac99.7%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    7. Taylor expanded in x around 0 60.4%

      \[\leadsto \color{blue}{\frac{1}{\sin B}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification51.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -7 \cdot 10^{+96}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -4.7 \cdot 10^{-12}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 485:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]

Alternative 21: 62.2% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -6:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -6.0) (- (/ -1.0 (sin B)) (/ x B)) (- (/ 1.0 B) (/ x (tan B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -6.0) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else {
		tmp = (1.0 / B) - (x / tan(B));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-6.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else
        tmp = (1.0d0 / b) - (x / tan(b))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -6.0) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else {
		tmp = (1.0 / B) - (x / Math.tan(B));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -6.0:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	else:
		tmp = (1.0 / B) - (x / math.tan(B))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -6.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	else
		tmp = Float64(Float64(1.0 / B) - Float64(x / tan(B)));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -6.0)
		tmp = (-1.0 / sin(B)) - (x / B);
	else
		tmp = (1.0 / B) - (x / tan(B));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -6.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -6:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -6

    1. Initial program 55.1%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 99.8%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 79.3%

      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{-1}{\sin B} \]

    if -6 < F

    1. Initial program 82.2%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 39.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. neg-sub039.7%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} + \frac{-1}{\sin B} \]
      2. associate-+l-39.7%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt18.0%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod13.5%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg13.5%

        \[\leadsto 0 - \left(\sqrt{\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      6. sqrt-unprod0.7%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt2.0%

        \[\leadsto 0 - \left(\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B}\right) \]
      8. div-inv2.0%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv2.0%

        \[\leadsto 0 - \color{blue}{\left(\left(-x \cdot \frac{1}{\tan B}\right) + \left(--1\right) \cdot \frac{1}{\sin B}\right)} \]
      10. metadata-eval2.0%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity2.0%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt1.0%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}}\right) \]
      13. sqrt-unprod8.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B} \cdot \frac{1}{\sin B}}}\right) \]
      14. frac-times8.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      15. metadata-eval8.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      16. metadata-eval8.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
    4. Applied egg-rr64.2%

      \[\leadsto \color{blue}{0 - \left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. associate--r+64.2%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub064.2%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      3. distribute-neg-frac64.2%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval64.2%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified64.2%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    7. Taylor expanded in B around 0 58.8%

      \[\leadsto \color{blue}{\frac{1}{B}} - \frac{x}{\tan B} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -6:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]

Alternative 22: 44.6% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -8.8 \cdot 10^{+86}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -4.7 \cdot 10^{-12}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 3.2 \cdot 10^{-68}:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -8.8e+86)
   (/ (- -1.0 x) B)
   (if (<= F -4.7e-12)
     (/ -1.0 (sin B))
     (if (<= F 3.2e-68)
       (* x (+ (* B 0.3333333333333333) (/ -1.0 B)))
       (+
        (* B (+ 0.16666666666666666 (* x 0.3333333333333333)))
        (/ (- 1.0 x) B))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -8.8e+86) {
		tmp = (-1.0 - x) / B;
	} else if (F <= -4.7e-12) {
		tmp = -1.0 / sin(B);
	} else if (F <= 3.2e-68) {
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	} else {
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-8.8d+86)) then
        tmp = ((-1.0d0) - x) / b
    else if (f <= (-4.7d-12)) then
        tmp = (-1.0d0) / sin(b)
    else if (f <= 3.2d-68) then
        tmp = x * ((b * 0.3333333333333333d0) + ((-1.0d0) / b))
    else
        tmp = (b * (0.16666666666666666d0 + (x * 0.3333333333333333d0))) + ((1.0d0 - x) / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -8.8e+86) {
		tmp = (-1.0 - x) / B;
	} else if (F <= -4.7e-12) {
		tmp = -1.0 / Math.sin(B);
	} else if (F <= 3.2e-68) {
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	} else {
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -8.8e+86:
		tmp = (-1.0 - x) / B
	elif F <= -4.7e-12:
		tmp = -1.0 / math.sin(B)
	elif F <= 3.2e-68:
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B))
	else:
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -8.8e+86)
		tmp = Float64(Float64(-1.0 - x) / B);
	elseif (F <= -4.7e-12)
		tmp = Float64(-1.0 / sin(B));
	elseif (F <= 3.2e-68)
		tmp = Float64(x * Float64(Float64(B * 0.3333333333333333) + Float64(-1.0 / B)));
	else
		tmp = Float64(Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333))) + Float64(Float64(1.0 - x) / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -8.8e+86)
		tmp = (-1.0 - x) / B;
	elseif (F <= -4.7e-12)
		tmp = -1.0 / sin(B);
	elseif (F <= 3.2e-68)
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	else
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -8.8e+86], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -4.7e-12], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.2e-68], N[(x * N[(N[(B * 0.3333333333333333), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.8 \cdot 10^{+86}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq -4.7 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{\sin B}\\

\mathbf{elif}\;F \leq 3.2 \cdot 10^{-68}:\\
\;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\

\mathbf{else}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -8.80000000000000013e86

    1. Initial program 40.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 60.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/60.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in60.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval60.9%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-160.9%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified60.9%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]

    if -8.80000000000000013e86 < F < -4.69999999999999976e-12

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 87.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 51.9%

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\right) + \frac{-1}{\sin B} \]
    4. Taylor expanded in x around 0 56.6%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]

    if -4.69999999999999976e-12 < F < 3.1999999999999999e-68

    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 F around -inf 39.1%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 25.2%

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\right) + \frac{-1}{\sin B} \]
    4. Taylor expanded in x around -inf 39.1%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(\frac{1}{B} - 0.3333333333333333 \cdot B\right)\right)} \]

    if 3.1999999999999999e-68 < F

    1. Initial program 61.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 39.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. neg-sub039.3%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} + \frac{-1}{\sin B} \]
      2. associate-+l-39.3%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt18.6%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod12.3%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg12.3%

        \[\leadsto 0 - \left(\sqrt{\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      6. sqrt-unprod0.4%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

        \[\leadsto 0 - \left(\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B}\right) \]
      8. div-inv0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

        \[\leadsto 0 - \color{blue}{\left(\left(-x \cdot \frac{1}{\tan B}\right) + \left(--1\right) \cdot \frac{1}{\sin B}\right)} \]
      10. metadata-eval0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}}\right) \]
      13. sqrt-unprod16.5%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B} \cdot \frac{1}{\sin B}}}\right) \]
      14. frac-times16.5%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      15. metadata-eval16.5%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      16. metadata-eval16.5%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
    4. Applied egg-rr93.4%

      \[\leadsto \color{blue}{0 - \left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. associate--r+93.4%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub093.4%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      3. distribute-neg-frac93.4%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval93.4%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified93.4%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    7. Taylor expanded in B around 0 49.7%

      \[\leadsto \color{blue}{\left(B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) + \frac{1}{B}\right) - \frac{x}{B}} \]
    8. Step-by-step derivation
      1. associate--l+49.7%

        \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) + \left(\frac{1}{B} - \frac{x}{B}\right)} \]
      2. *-commutative49.7%

        \[\leadsto B \cdot \left(0.16666666666666666 + \color{blue}{x \cdot 0.3333333333333333}\right) + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      3. div-sub49.7%

        \[\leadsto B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \color{blue}{\frac{1 - x}{B}} \]
    9. Simplified49.7%

      \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification48.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -8.8 \cdot 10^{+86}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -4.7 \cdot 10^{-12}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 3.2 \cdot 10^{-68}:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \]

Alternative 23: 44.5% accurate, 18.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.58 \cdot 10^{-34}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 3.2 \cdot 10^{-68}:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.58e-34)
   (/ (- -1.0 x) B)
   (if (<= F 3.2e-68)
     (* x (+ (* B 0.3333333333333333) (/ -1.0 B)))
     (+
      (* B (+ 0.16666666666666666 (* x 0.3333333333333333)))
      (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.58e-34) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 3.2e-68) {
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	} else {
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-1.58d-34)) then
        tmp = ((-1.0d0) - x) / b
    else if (f <= 3.2d-68) then
        tmp = x * ((b * 0.3333333333333333d0) + ((-1.0d0) / b))
    else
        tmp = (b * (0.16666666666666666d0 + (x * 0.3333333333333333d0))) + ((1.0d0 - x) / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.58e-34) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 3.2e-68) {
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	} else {
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.58e-34:
		tmp = (-1.0 - x) / B
	elif F <= 3.2e-68:
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B))
	else:
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.58e-34)
		tmp = Float64(Float64(-1.0 - x) / B);
	elseif (F <= 3.2e-68)
		tmp = Float64(x * Float64(Float64(B * 0.3333333333333333) + Float64(-1.0 / B)));
	else
		tmp = Float64(Float64(B * Float64(0.16666666666666666 + Float64(x * 0.3333333333333333))) + Float64(Float64(1.0 - x) / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1.58e-34)
		tmp = (-1.0 - x) / B;
	elseif (F <= 3.2e-68)
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	else
		tmp = (B * (0.16666666666666666 + (x * 0.3333333333333333))) + ((1.0 - x) / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.58e-34], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.2e-68], N[(x * N[(N[(B * 0.3333333333333333), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(B * N[(0.16666666666666666 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.58 \cdot 10^{-34}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq 3.2 \cdot 10^{-68}:\\
\;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\

\mathbf{else}:\\
\;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.57999999999999997e-34

    1. Initial program 61.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 91.5%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 51.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/51.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in51.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval51.0%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-151.0%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified51.0%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]

    if -1.57999999999999997e-34 < F < 3.1999999999999999e-68

    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 F around -inf 39.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 25.2%

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\right) + \frac{-1}{\sin B} \]
    4. Taylor expanded in x around -inf 40.0%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(\frac{1}{B} - 0.3333333333333333 \cdot B\right)\right)} \]

    if 3.1999999999999999e-68 < F

    1. Initial program 61.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 39.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. neg-sub039.3%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} + \frac{-1}{\sin B} \]
      2. associate-+l-39.3%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt18.6%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod12.3%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg12.3%

        \[\leadsto 0 - \left(\sqrt{\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      6. sqrt-unprod0.4%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.8%

        \[\leadsto 0 - \left(\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B}\right) \]
      8. div-inv0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.8%

        \[\leadsto 0 - \color{blue}{\left(\left(-x \cdot \frac{1}{\tan B}\right) + \left(--1\right) \cdot \frac{1}{\sin B}\right)} \]
      10. metadata-eval0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.8%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}}\right) \]
      13. sqrt-unprod16.5%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B} \cdot \frac{1}{\sin B}}}\right) \]
      14. frac-times16.5%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      15. metadata-eval16.5%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      16. metadata-eval16.5%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
    4. Applied egg-rr93.4%

      \[\leadsto \color{blue}{0 - \left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. associate--r+93.4%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub093.4%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      3. distribute-neg-frac93.4%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval93.4%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified93.4%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    7. Taylor expanded in B around 0 49.7%

      \[\leadsto \color{blue}{\left(B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) + \frac{1}{B}\right) - \frac{x}{B}} \]
    8. Step-by-step derivation
      1. associate--l+49.7%

        \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right) + \left(\frac{1}{B} - \frac{x}{B}\right)} \]
      2. *-commutative49.7%

        \[\leadsto B \cdot \left(0.16666666666666666 + \color{blue}{x \cdot 0.3333333333333333}\right) + \left(\frac{1}{B} - \frac{x}{B}\right) \]
      3. div-sub49.7%

        \[\leadsto B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \color{blue}{\frac{1 - x}{B}} \]
    9. Simplified49.7%

      \[\leadsto \color{blue}{B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification46.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.58 \cdot 10^{-34}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 3.2 \cdot 10^{-68}:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;B \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right) + \frac{1 - x}{B}\\ \end{array} \]

Alternative 24: 37.0% accurate, 24.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x}{B}\\ \mathbf{if}\;F \leq -1.05 \cdot 10^{+177}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{elif}\;F \leq -2 \cdot 10^{+94}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;F \leq -4.7 \cdot 10^{-12}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{elif}\;F \leq 7.5 \cdot 10^{-161}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ (- x) B)))
   (if (<= F -1.05e+177)
     (/ -1.0 B)
     (if (<= F -2e+94)
       t_0
       (if (<= F -4.7e-12)
         (/ -1.0 B)
         (if (<= F 7.5e-161) t_0 (/ (- 1.0 x) B)))))))
double code(double F, double B, double x) {
	double t_0 = -x / B;
	double tmp;
	if (F <= -1.05e+177) {
		tmp = -1.0 / B;
	} else if (F <= -2e+94) {
		tmp = t_0;
	} else if (F <= -4.7e-12) {
		tmp = -1.0 / B;
	} else if (F <= 7.5e-161) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = -x / b
    if (f <= (-1.05d+177)) then
        tmp = (-1.0d0) / b
    else if (f <= (-2d+94)) then
        tmp = t_0
    else if (f <= (-4.7d-12)) then
        tmp = (-1.0d0) / b
    else if (f <= 7.5d-161) then
        tmp = t_0
    else
        tmp = (1.0d0 - x) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = -x / B;
	double tmp;
	if (F <= -1.05e+177) {
		tmp = -1.0 / B;
	} else if (F <= -2e+94) {
		tmp = t_0;
	} else if (F <= -4.7e-12) {
		tmp = -1.0 / B;
	} else if (F <= 7.5e-161) {
		tmp = t_0;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = -x / B
	tmp = 0
	if F <= -1.05e+177:
		tmp = -1.0 / B
	elif F <= -2e+94:
		tmp = t_0
	elif F <= -4.7e-12:
		tmp = -1.0 / B
	elif F <= 7.5e-161:
		tmp = t_0
	else:
		tmp = (1.0 - x) / B
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(-x) / B)
	tmp = 0.0
	if (F <= -1.05e+177)
		tmp = Float64(-1.0 / B);
	elseif (F <= -2e+94)
		tmp = t_0;
	elseif (F <= -4.7e-12)
		tmp = Float64(-1.0 / B);
	elseif (F <= 7.5e-161)
		tmp = t_0;
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = -x / B;
	tmp = 0.0;
	if (F <= -1.05e+177)
		tmp = -1.0 / B;
	elseif (F <= -2e+94)
		tmp = t_0;
	elseif (F <= -4.7e-12)
		tmp = -1.0 / B;
	elseif (F <= 7.5e-161)
		tmp = t_0;
	else
		tmp = (1.0 - x) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / B), $MachinePrecision]}, If[LessEqual[F, -1.05e+177], N[(-1.0 / B), $MachinePrecision], If[LessEqual[F, -2e+94], t$95$0, If[LessEqual[F, -4.7e-12], N[(-1.0 / B), $MachinePrecision], If[LessEqual[F, 7.5e-161], t$95$0, N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-x}{B}\\
\mathbf{if}\;F \leq -1.05 \cdot 10^{+177}:\\
\;\;\;\;\frac{-1}{B}\\

\mathbf{elif}\;F \leq -2 \cdot 10^{+94}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq -4.7 \cdot 10^{-12}:\\
\;\;\;\;\frac{-1}{B}\\

\mathbf{elif}\;F \leq 7.5 \cdot 10^{-161}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.05000000000000006e177 or -2e94 < F < -4.69999999999999976e-12

    1. Initial program 58.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 94.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 52.3%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/52.3%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in52.3%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval52.3%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-152.3%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified52.3%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    6. Taylor expanded in x around 0 39.7%

      \[\leadsto \color{blue}{\frac{-1}{B}} \]

    if -1.05000000000000006e177 < F < -2e94 or -4.69999999999999976e-12 < F < 7.49999999999999991e-161

    1. Initial program 90.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 53.1%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 33.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/33.4%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in33.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval33.4%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-133.4%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified33.4%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    6. Taylor expanded in x around inf 43.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    7. Step-by-step derivation
      1. neg-mul-143.8%

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-neg-frac43.8%

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    8. Simplified43.8%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]

    if 7.49999999999999991e-161 < F

    1. Initial program 68.4%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 39.0%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. neg-sub039.0%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} + \frac{-1}{\sin B} \]
      2. associate-+l-39.0%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt19.1%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod12.3%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg12.3%

        \[\leadsto 0 - \left(\sqrt{\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      6. sqrt-unprod0.4%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.9%

        \[\leadsto 0 - \left(\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B}\right) \]
      8. div-inv0.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.9%

        \[\leadsto 0 - \color{blue}{\left(\left(-x \cdot \frac{1}{\tan B}\right) + \left(--1\right) \cdot \frac{1}{\sin B}\right)} \]
      10. metadata-eval0.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}}\right) \]
      13. sqrt-unprod14.0%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B} \cdot \frac{1}{\sin B}}}\right) \]
      14. frac-times13.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      15. metadata-eval13.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      16. metadata-eval13.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
    4. Applied egg-rr84.0%

      \[\leadsto \color{blue}{0 - \left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. associate--r+84.0%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub084.0%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      3. distribute-neg-frac84.0%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval84.0%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified84.0%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    7. Taylor expanded in B around 0 44.1%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification43.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.05 \cdot 10^{+177}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{elif}\;F \leq -2 \cdot 10^{+94}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{elif}\;F \leq -4.7 \cdot 10^{-12}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{elif}\;F \leq 7.5 \cdot 10^{-161}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]

Alternative 25: 44.0% accurate, 24.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.05 \cdot 10^{-34}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 5.6 \cdot 10^{-142}:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.05e-34)
   (/ (- -1.0 x) B)
   (if (<= F 5.6e-142)
     (* x (+ (* B 0.3333333333333333) (/ -1.0 B)))
     (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.05e-34) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 5.6e-142) {
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-1.05d-34)) then
        tmp = ((-1.0d0) - x) / b
    else if (f <= 5.6d-142) then
        tmp = x * ((b * 0.3333333333333333d0) + ((-1.0d0) / b))
    else
        tmp = (1.0d0 - x) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.05e-34) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 5.6e-142) {
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.05e-34:
		tmp = (-1.0 - x) / B
	elif F <= 5.6e-142:
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B))
	else:
		tmp = (1.0 - x) / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.05e-34)
		tmp = Float64(Float64(-1.0 - x) / B);
	elseif (F <= 5.6e-142)
		tmp = Float64(x * Float64(Float64(B * 0.3333333333333333) + Float64(-1.0 / B)));
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1.05e-34)
		tmp = (-1.0 - x) / B;
	elseif (F <= 5.6e-142)
		tmp = x * ((B * 0.3333333333333333) + (-1.0 / B));
	else
		tmp = (1.0 - x) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.05e-34], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.6e-142], N[(x * N[(N[(B * 0.3333333333333333), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.05 \cdot 10^{-34}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq 5.6 \cdot 10^{-142}:\\
\;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.05e-34

    1. Initial program 61.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 91.5%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 51.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/51.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in51.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval51.0%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-151.0%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified51.0%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]

    if -1.05e-34 < F < 5.60000000000000009e-142

    1. Initial program 99.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 41.0%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 26.9%

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\right) + \frac{-1}{\sin B} \]
    4. Taylor expanded in x around -inf 44.8%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(\frac{1}{B} - 0.3333333333333333 \cdot B\right)\right)} \]

    if 5.60000000000000009e-142 < F

    1. Initial program 68.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 38.4%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. neg-sub038.4%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} + \frac{-1}{\sin B} \]
      2. associate-+l-38.4%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt18.4%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod12.3%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg12.3%

        \[\leadsto 0 - \left(\sqrt{\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      6. sqrt-unprod0.4%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.9%

        \[\leadsto 0 - \left(\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B}\right) \]
      8. div-inv0.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.9%

        \[\leadsto 0 - \color{blue}{\left(\left(-x \cdot \frac{1}{\tan B}\right) + \left(--1\right) \cdot \frac{1}{\sin B}\right)} \]
      10. metadata-eval0.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}}\right) \]
      13. sqrt-unprod14.1%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B} \cdot \frac{1}{\sin B}}}\right) \]
      14. frac-times14.1%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      15. metadata-eval14.1%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      16. metadata-eval14.1%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
    4. Applied egg-rr83.9%

      \[\leadsto \color{blue}{0 - \left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. associate--r+83.9%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub083.9%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      3. distribute-neg-frac83.9%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval83.9%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified83.9%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    7. Taylor expanded in B around 0 44.5%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification46.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.05 \cdot 10^{-34}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 5.6 \cdot 10^{-142}:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]

Alternative 26: 32.0% accurate, 35.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{-145} \lor \neg \left(x \leq 5.3 \cdot 10^{-49}\right):\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -1}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (or (<= x -5.6e-145) (not (<= x 5.3e-49))) (/ (- x) B) (/ (+ x -1.0) B)))
double code(double F, double B, double x) {
	double tmp;
	if ((x <= -5.6e-145) || !(x <= 5.3e-49)) {
		tmp = -x / B;
	} else {
		tmp = (x + -1.0) / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if ((x <= (-5.6d-145)) .or. (.not. (x <= 5.3d-49))) then
        tmp = -x / b
    else
        tmp = (x + (-1.0d0)) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if ((x <= -5.6e-145) || !(x <= 5.3e-49)) {
		tmp = -x / B;
	} else {
		tmp = (x + -1.0) / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if (x <= -5.6e-145) or not (x <= 5.3e-49):
		tmp = -x / B
	else:
		tmp = (x + -1.0) / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if ((x <= -5.6e-145) || !(x <= 5.3e-49))
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(Float64(x + -1.0) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if ((x <= -5.6e-145) || ~((x <= 5.3e-49)))
		tmp = -x / B;
	else
		tmp = (x + -1.0) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[Or[LessEqual[x, -5.6e-145], N[Not[LessEqual[x, 5.3e-49]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(N[(x + -1.0), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-145} \lor \neg \left(x \leq 5.3 \cdot 10^{-49}\right):\\
\;\;\;\;\frac{-x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + -1}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.6000000000000002e-145 or 5.3000000000000003e-49 < x

    1. Initial program 80.0%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 73.9%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 41.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/41.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in41.7%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval41.7%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-141.7%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified41.7%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    6. Taylor expanded in x around inf 45.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    7. Step-by-step derivation
      1. neg-mul-145.5%

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-neg-frac45.5%

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    8. Simplified45.5%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]

    if -5.6000000000000002e-145 < x < 5.3000000000000003e-49

    1. Initial program 69.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 30.5%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 19.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/19.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in19.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval19.0%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-119.0%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified19.0%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    6. Step-by-step derivation
      1. expm1-log1p-u14.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-1 + \left(-x\right)}{B}\right)\right)} \]
      2. expm1-udef14.6%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-1 + \left(-x\right)}{B}\right)} - 1} \]
      3. +-commutative14.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\left(-x\right) + -1}}{B}\right)} - 1 \]
      4. add-sqr-sqrt6.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}} + -1}{B}\right)} - 1 \]
      5. sqrt-unprod14.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} + -1}{B}\right)} - 1 \]
      6. sqr-neg14.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{x \cdot x}} + -1}{B}\right)} - 1 \]
      7. sqrt-unprod8.0%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}} + -1}{B}\right)} - 1 \]
      8. add-sqr-sqrt14.6%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{x} + -1}{B}\right)} - 1 \]
    7. Applied egg-rr14.6%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x + -1}{B}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def14.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x + -1}{B}\right)\right)} \]
      2. expm1-log1p19.0%

        \[\leadsto \color{blue}{\frac{x + -1}{B}} \]
    9. Simplified19.0%

      \[\leadsto \color{blue}{\frac{x + -1}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification33.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{-145} \lor \neg \left(x \leq 5.3 \cdot 10^{-49}\right):\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -1}{B}\\ \end{array} \]

Alternative 27: 43.2% accurate, 35.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.06 \cdot 10^{-141}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 7.5 \cdot 10^{-161}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.06e-141)
   (/ (- -1.0 x) B)
   (if (<= F 7.5e-161) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.06e-141) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 7.5e-161) {
		tmp = -x / B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-1.06d-141)) then
        tmp = ((-1.0d0) - x) / b
    else if (f <= 7.5d-161) then
        tmp = -x / b
    else
        tmp = (1.0d0 - x) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.06e-141) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 7.5e-161) {
		tmp = -x / B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.06e-141:
		tmp = (-1.0 - x) / B
	elif F <= 7.5e-161:
		tmp = -x / B
	else:
		tmp = (1.0 - x) / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.06e-141)
		tmp = Float64(Float64(-1.0 - x) / B);
	elseif (F <= 7.5e-161)
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1.06e-141)
		tmp = (-1.0 - x) / B;
	elseif (F <= 7.5e-161)
		tmp = -x / B;
	else
		tmp = (1.0 - x) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.06e-141], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.5e-161], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.06 \cdot 10^{-141}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq 7.5 \cdot 10^{-161}:\\
\;\;\;\;\frac{-x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.06e-141

    1. Initial program 68.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 82.7%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 46.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/46.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in46.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval46.0%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-146.0%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified46.0%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]

    if -1.06e-141 < F < 7.49999999999999991e-161

    1. Initial program 99.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 39.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 28.6%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/28.6%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in28.6%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval28.6%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-128.6%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified28.6%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    6. Taylor expanded in x around inf 51.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    7. Step-by-step derivation
      1. neg-mul-151.8%

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-neg-frac51.8%

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    8. Simplified51.8%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]

    if 7.49999999999999991e-161 < F

    1. Initial program 68.4%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 39.0%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. neg-sub039.0%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} + \frac{-1}{\sin B} \]
      2. associate-+l-39.0%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} - \frac{-1}{\sin B}\right)} \]
      3. add-sqr-sqrt19.1%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{x \cdot \frac{1}{\tan B}} \cdot \sqrt{x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      4. sqrt-unprod12.3%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{\left(x \cdot \frac{1}{\tan B}\right) \cdot \left(x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      5. sqr-neg12.3%

        \[\leadsto 0 - \left(\sqrt{\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}} - \frac{-1}{\sin B}\right) \]
      6. sqrt-unprod0.4%

        \[\leadsto 0 - \left(\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} - \frac{-1}{\sin B}\right) \]
      7. add-sqr-sqrt0.9%

        \[\leadsto 0 - \left(\color{blue}{\left(-x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B}\right) \]
      8. div-inv0.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{-1 \cdot \frac{1}{\sin B}}\right) \]
      9. cancel-sign-sub-inv0.9%

        \[\leadsto 0 - \color{blue}{\left(\left(-x \cdot \frac{1}{\tan B}\right) + \left(--1\right) \cdot \frac{1}{\sin B}\right)} \]
      10. metadata-eval0.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1} \cdot \frac{1}{\sin B}\right) \]
      11. *-un-lft-identity0.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}}\right) \]
      12. add-sqr-sqrt0.4%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}}\right) \]
      13. sqrt-unprod14.0%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B} \cdot \frac{1}{\sin B}}}\right) \]
      14. frac-times13.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) \]
      15. metadata-eval13.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}}\right) \]
      16. metadata-eval13.9%

        \[\leadsto 0 - \left(\left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{-1 \cdot -1}}{\sin B \cdot \sin B}}\right) \]
    4. Applied egg-rr84.0%

      \[\leadsto \color{blue}{0 - \left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. associate--r+84.0%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      2. neg-sub084.0%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      3. distribute-neg-frac84.0%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      4. metadata-eval84.0%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified84.0%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    7. Taylor expanded in B around 0 44.1%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification46.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.06 \cdot 10^{-141}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 7.5 \cdot 10^{-161}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]

Alternative 28: 32.0% accurate, 39.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{-154} \lor \neg \left(x \leq 5.3 \cdot 10^{-49}\right):\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (or (<= x -2.5e-154) (not (<= x 5.3e-49))) (/ (- x) B) (/ -1.0 B)))
double code(double F, double B, double x) {
	double tmp;
	if ((x <= -2.5e-154) || !(x <= 5.3e-49)) {
		tmp = -x / B;
	} else {
		tmp = -1.0 / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if ((x <= (-2.5d-154)) .or. (.not. (x <= 5.3d-49))) then
        tmp = -x / b
    else
        tmp = (-1.0d0) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if ((x <= -2.5e-154) || !(x <= 5.3e-49)) {
		tmp = -x / B;
	} else {
		tmp = -1.0 / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if (x <= -2.5e-154) or not (x <= 5.3e-49):
		tmp = -x / B
	else:
		tmp = -1.0 / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if ((x <= -2.5e-154) || !(x <= 5.3e-49))
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(-1.0 / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if ((x <= -2.5e-154) || ~((x <= 5.3e-49)))
		tmp = -x / B;
	else
		tmp = -1.0 / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[Or[LessEqual[x, -2.5e-154], N[Not[LessEqual[x, 5.3e-49]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(-1.0 / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-154} \lor \neg \left(x \leq 5.3 \cdot 10^{-49}\right):\\
\;\;\;\;\frac{-x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.5000000000000001e-154 or 5.3000000000000003e-49 < x

    1. Initial program 80.0%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 73.9%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 41.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/41.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in41.7%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval41.7%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-141.7%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified41.7%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    6. Taylor expanded in x around inf 45.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    7. Step-by-step derivation
      1. neg-mul-145.5%

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-neg-frac45.5%

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    8. Simplified45.5%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]

    if -2.5000000000000001e-154 < x < 5.3000000000000003e-49

    1. Initial program 69.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Taylor expanded in F around -inf 30.5%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    3. Taylor expanded in B around 0 19.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    4. Step-by-step derivation
      1. associate-*r/19.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in19.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval19.0%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-119.0%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    5. Simplified19.0%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    6. Taylor expanded in x around 0 19.0%

      \[\leadsto \color{blue}{\frac{-1}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification33.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{-154} \lor \neg \left(x \leq 5.3 \cdot 10^{-49}\right):\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{B}\\ \end{array} \]

Alternative 29: 10.6% accurate, 108.0× speedup?

\[\begin{array}{l} \\ \frac{-1}{B} \end{array} \]
(FPCore (F B x) :precision binary64 (/ -1.0 B))
double code(double F, double B, double x) {
	return -1.0 / B;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = (-1.0d0) / b
end function
public static double code(double F, double B, double x) {
	return -1.0 / B;
}
def code(F, B, x):
	return -1.0 / B
function code(F, B, x)
	return Float64(-1.0 / B)
end
function tmp = code(F, B, x)
	tmp = -1.0 / B;
end
code[F_, B_, x_] := N[(-1.0 / B), $MachinePrecision]
\begin{array}{l}

\\
\frac{-1}{B}
\end{array}
Derivation
  1. Initial program 75.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 54.9%

    \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
  3. Taylor expanded in B around 0 31.8%

    \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
  4. Step-by-step derivation
    1. associate-*r/31.8%

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
    2. distribute-lft-in31.8%

      \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
    3. metadata-eval31.8%

      \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
    4. neg-mul-131.8%

      \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
  5. Simplified31.8%

    \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
  6. Taylor expanded in x around 0 11.2%

    \[\leadsto \color{blue}{\frac{-1}{B}} \]
  7. Final simplification11.2%

    \[\leadsto \frac{-1}{B} \]

Reproduce

?
herbie shell --seed 2023302 
(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))))))