VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.3% → 99.6%
Time: 16.2s
Alternatives: 18
Speedup: 1.4×

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 18 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.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.0× speedup?

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

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

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


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

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num73.4%

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

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

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

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

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

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

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

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

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

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

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

    if -8.00000000000000011e43 < F < 1.2e8

    1. Initial program 99.5%

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

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

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

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

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

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

      \[\leadsto \left(-\frac{1}{\frac{\tan B}{x}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\color{blue}{-0.5}} \]
    7. Step-by-step derivation
      1. clear-num99.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)}^{-0.5} \]
      2. add-sqr-sqrt50.9%

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

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

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

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

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

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

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

        \[\leadsto \left(-\sqrt{\left(-x \cdot \frac{\cos B}{\sin B}\right) \cdot \left(-x \cdot \frac{1}{\color{blue}{\frac{\sin B}{\cos B}}}\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{-0.5} \]
      10. clear-num56.8%

        \[\leadsto \left(-\sqrt{\left(-x \cdot \frac{\cos B}{\sin B}\right) \cdot \left(-x \cdot \color{blue}{\frac{\cos B}{\sin B}}\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{-0.5} \]
      11. sqrt-unprod16.9%

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

        \[\leadsto \left(-\color{blue}{\left(-x \cdot \frac{\cos B}{\sin B}\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{-0.5} \]
      13. clear-num33.7%

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

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

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

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

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

      \[\leadsto \left(-\color{blue}{\left(0 + \frac{x}{\tan B}\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{-0.5} \]
    9. Step-by-step derivation
      1. +-lft-identity99.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)}^{-0.5} \]
    10. 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)}^{-0.5} \]

    if 1.2e8 < F

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num82.6%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 61.6%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num75.7%

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

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

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999 < F < 1.44999999999999996

    1. Initial program 99.5%

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

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

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

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

    if 1.44999999999999996 < F

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num83.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 92.0% accurate, 1.4× speedup?

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

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

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

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

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


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

    1. Initial program 62.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. Simplified76.2%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num76.1%

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

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

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

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

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

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

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

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

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

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

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

    if -3.50000000000000019e-11 < F < 1.59999999999999988e-103

    1. Initial program 99.5%

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

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

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

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

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

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

    if 1.59999999999999988e-103 < F < 6.1999999999999999e-6

    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. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv99.7%

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

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

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

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

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

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

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

    if 6.1999999999999999e-6 < F

    1. Initial program 70.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. Simplified83.7%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num83.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.5 \cdot 10^{-11}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.6 \cdot 10^{-103}:\\ \;\;\;\;\left(F \cdot \frac{1}{B}\right) \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-6}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 85.4% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -1.25 \cdot 10^{-47}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 61.6%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num75.7%

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

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

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

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

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

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

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

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

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

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

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

    if -4.80000000000000012e-4 < F < -1.25000000000000003e-47 or 5.800000000000001e-101 < F < 6.1999999999999999e-6

    1. Initial program 99.4%

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

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

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

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

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

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

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

    if -1.25000000000000003e-47 < F < 5.800000000000001e-101

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    10. Simplified82.9%

      \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    11. Step-by-step derivation
      1. div-inv83.1%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      2. add-sqr-sqrt43.6%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}} \]
      3. sqrt-unprod29.1%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}} \]
      4. sqr-neg29.1%

        \[\leadsto -\sqrt{\color{blue}{\left(-\frac{x}{\tan B}\right) \cdot \left(-\frac{x}{\tan B}\right)}} \]
      5. div-inv29.0%

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

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

        \[\leadsto -\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} \]
      8. add-sqr-sqrt1.9%

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

        \[\leadsto -\left(-\color{blue}{\frac{x}{\tan B}}\right) \]
      10. neg-sub01.9%

        \[\leadsto -\color{blue}{\left(0 - \frac{x}{\tan B}\right)} \]
      11. sub-neg1.9%

        \[\leadsto -\color{blue}{\left(0 + \left(-\frac{x}{\tan B}\right)\right)} \]
      12. div-inv1.9%

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

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

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

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

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

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

      \[\leadsto -\color{blue}{\left(0 + \frac{x}{\tan B}\right)} \]
    13. Step-by-step derivation
      1. +-lft-identity83.1%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    14. Simplified83.1%

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

    if 6.1999999999999999e-6 < F

    1. Initial program 70.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. Simplified83.7%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num83.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.00048:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.25 \cdot 10^{-47}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-6}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 90.4% accurate, 1.4× speedup?

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

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

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

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

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


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

    1. Initial program 62.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. Simplified76.2%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num76.1%

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

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

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

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

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

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

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

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

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

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

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

    if -3.50000000000000019e-11 < F < 3.0000000000000001e-100

    1. Initial program 99.5%

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

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

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

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

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

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

    if 3.0000000000000001e-100 < F < 2.8999999999999998e-7

    1. Initial program 99.6%

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

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

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

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

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

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

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

    if 2.8999999999999998e-7 < F

    1. Initial program 70.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. Simplified83.7%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num83.7%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 78.6% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -1.5 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 1.95 \cdot 10^{-101}:\\
\;\;\;\;\frac{x}{-\tan B}\\

\mathbf{elif}\;F \leq 0.022:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 2.5 \cdot 10^{+251}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\

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


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

    1. Initial program 61.6%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num75.7%

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

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

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

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

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

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

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

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

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

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

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

    if -0.016 < F < -1.49999999999999994e-46 or 1.95000000000000008e-101 < F < 0.021999999999999999

    1. Initial program 99.4%

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

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

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

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

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

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

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

    if -1.49999999999999994e-46 < F < 1.95000000000000008e-101

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    10. Simplified82.9%

      \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    11. Step-by-step derivation
      1. div-inv83.1%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      2. add-sqr-sqrt43.6%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}} \]
      3. sqrt-unprod29.1%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}} \]
      4. sqr-neg29.1%

        \[\leadsto -\sqrt{\color{blue}{\left(-\frac{x}{\tan B}\right) \cdot \left(-\frac{x}{\tan B}\right)}} \]
      5. div-inv29.0%

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

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

        \[\leadsto -\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} \]
      8. add-sqr-sqrt1.9%

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

        \[\leadsto -\left(-\color{blue}{\frac{x}{\tan B}}\right) \]
      10. neg-sub01.9%

        \[\leadsto -\color{blue}{\left(0 - \frac{x}{\tan B}\right)} \]
      11. sub-neg1.9%

        \[\leadsto -\color{blue}{\left(0 + \left(-\frac{x}{\tan B}\right)\right)} \]
      12. div-inv1.9%

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

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

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

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

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

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

      \[\leadsto -\color{blue}{\left(0 + \frac{x}{\tan B}\right)} \]
    13. Step-by-step derivation
      1. +-lft-identity83.1%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    14. Simplified83.1%

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

    if 0.021999999999999999 < F < 2.5000000000000002e251

    1. Initial program 70.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. Add Preprocessing
    3. Taylor expanded in F around inf 87.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-168.6%

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

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

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

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

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

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

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

    if 2.5000000000000002e251 < F

    1. Initial program 64.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.016:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.5 \cdot 10^{-46}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 1.95 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{elif}\;F \leq 0.022:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 2.5 \cdot 10^{+251}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 90.4% accurate, 1.4× speedup?

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

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

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

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

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


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

    1. Initial program 62.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. Simplified76.2%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num76.1%

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

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

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

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

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

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

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

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

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

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

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

    if -3.50000000000000019e-11 < F < 3.0000000000000001e-100

    1. Initial program 99.5%

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

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

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

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

    if 3.0000000000000001e-100 < F < 6.1999999999999999e-6

    1. Initial program 99.6%

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

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

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

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

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

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

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

    if 6.1999999999999999e-6 < F

    1. Initial program 70.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. Simplified83.7%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num83.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.5 \cdot 10^{-11}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 3 \cdot 10^{-100}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-6}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 70.9% accurate, 1.5× speedup?

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

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

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

\mathbf{elif}\;F \leq 0.092:\\
\;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\

\mathbf{elif}\;F \leq 3.2 \cdot 10^{+253}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\

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


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

    1. Initial program 58.6%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-122.3%

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
    6. Simplified78.7%

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

    if -3.34999999999999984e37 < F < 2.14999999999999999e-100

    1. Initial program 99.5%

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

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

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

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

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

      \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity78.1%

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

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

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

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

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    10. Simplified78.1%

      \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    11. Step-by-step derivation
      1. div-inv78.3%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      2. add-sqr-sqrt39.5%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}} \]
      3. sqrt-unprod26.8%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}} \]
      4. sqr-neg26.8%

        \[\leadsto -\sqrt{\color{blue}{\left(-\frac{x}{\tan B}\right) \cdot \left(-\frac{x}{\tan B}\right)}} \]
      5. div-inv26.8%

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

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

        \[\leadsto -\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} \]
      8. add-sqr-sqrt1.9%

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

        \[\leadsto -\left(-\color{blue}{\frac{x}{\tan B}}\right) \]
      10. neg-sub01.9%

        \[\leadsto -\color{blue}{\left(0 - \frac{x}{\tan B}\right)} \]
      11. sub-neg1.9%

        \[\leadsto -\color{blue}{\left(0 + \left(-\frac{x}{\tan B}\right)\right)} \]
      12. div-inv1.9%

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

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

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

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

        \[\leadsto -\left(0 + \sqrt{\left(-\frac{x}{\tan B}\right) \cdot \left(-\color{blue}{\frac{x}{\tan B}}\right)}\right) \]
      17. sqr-neg26.8%

        \[\leadsto -\left(0 + \sqrt{\color{blue}{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}}\right) \]
    12. Applied egg-rr78.3%

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    14. Simplified78.3%

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

    if 2.14999999999999999e-100 < F < 0.091999999999999998

    1. Initial program 99.6%

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

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

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

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

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

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

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

    if 0.091999999999999998 < F < 3.2000000000000003e253

    1. Initial program 70.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. Add Preprocessing
    3. Taylor expanded in F around inf 87.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-168.6%

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

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

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

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

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

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

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

    if 3.2000000000000003e253 < F

    1. Initial program 64.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.35 \cdot 10^{+37}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.15 \cdot 10^{-100}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{elif}\;F \leq 0.092:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 3.2 \cdot 10^{+253}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 70.8% accurate, 2.5× speedup?

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

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

\mathbf{elif}\;F \leq 7.4 \cdot 10^{-118}:\\
\;\;\;\;\frac{x}{-\tan B}\\

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

\mathbf{elif}\;F \leq 8 \cdot 10^{+252}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\

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


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

    1. Initial program 58.6%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-122.3%

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
    6. Simplified78.7%

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

    if -3.34999999999999984e37 < F < 7.40000000000000029e-118

    1. Initial program 99.5%

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

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

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

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

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

      \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity77.7%

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

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

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

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

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    10. Simplified77.7%

      \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    11. Step-by-step derivation
      1. div-inv77.8%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      2. add-sqr-sqrt40.3%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}} \]
      3. sqrt-unprod27.4%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}} \]
      4. sqr-neg27.4%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} \]
      8. add-sqr-sqrt1.9%

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

        \[\leadsto -\left(-\color{blue}{\frac{x}{\tan B}}\right) \]
      10. neg-sub01.9%

        \[\leadsto -\color{blue}{\left(0 - \frac{x}{\tan B}\right)} \]
      11. sub-neg1.9%

        \[\leadsto -\color{blue}{\left(0 + \left(-\frac{x}{\tan B}\right)\right)} \]
      12. div-inv1.9%

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

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

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

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

        \[\leadsto -\left(0 + \sqrt{\left(-\frac{x}{\tan B}\right) \cdot \left(-\color{blue}{\frac{x}{\tan B}}\right)}\right) \]
      17. sqr-neg27.4%

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

      \[\leadsto -\color{blue}{\left(0 + \frac{x}{\tan B}\right)} \]
    13. Step-by-step derivation
      1. +-lft-identity77.8%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    14. Simplified77.8%

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

    if 7.40000000000000029e-118 < F < 6.1999999999999999e-6

    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. Simplified99.4%

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

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

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

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

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

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

    if 6.1999999999999999e-6 < F < 8.0000000000000008e252

    1. Initial program 71.7%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-165.8%

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
    6. Simplified65.8%

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

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

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

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

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

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

    if 8.0000000000000008e252 < F

    1. Initial program 64.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.35 \cdot 10^{+37}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 7.4 \cdot 10^{-118}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-6}:\\ \;\;\;\;\left(F \cdot \frac{1}{B}\right) \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 8 \cdot 10^{+252}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 70.8% accurate, 2.5× speedup?

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

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

\mathbf{elif}\;F \leq 1.15 \cdot 10^{-105}:\\
\;\;\;\;\frac{x}{-\tan B}\\

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

\mathbf{elif}\;F \leq 7.2 \cdot 10^{+249}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\

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


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

    1. Initial program 58.6%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-122.3%

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
    6. Simplified78.7%

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

    if -3.34999999999999984e37 < F < 1.15e-105

    1. Initial program 99.5%

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

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

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

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

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

      \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity77.7%

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

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

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

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

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    10. Simplified77.7%

      \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    11. Step-by-step derivation
      1. div-inv77.8%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      2. add-sqr-sqrt40.3%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}} \]
      3. sqrt-unprod27.4%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}} \]
      4. sqr-neg27.4%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} \]
      8. add-sqr-sqrt1.9%

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

        \[\leadsto -\left(-\color{blue}{\frac{x}{\tan B}}\right) \]
      10. neg-sub01.9%

        \[\leadsto -\color{blue}{\left(0 - \frac{x}{\tan B}\right)} \]
      11. sub-neg1.9%

        \[\leadsto -\color{blue}{\left(0 + \left(-\frac{x}{\tan B}\right)\right)} \]
      12. div-inv1.9%

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

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

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

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

        \[\leadsto -\left(0 + \sqrt{\left(-\frac{x}{\tan B}\right) \cdot \left(-\color{blue}{\frac{x}{\tan B}}\right)}\right) \]
      17. sqr-neg27.4%

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

      \[\leadsto -\color{blue}{\left(0 + \frac{x}{\tan B}\right)} \]
    13. Step-by-step derivation
      1. +-lft-identity77.8%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    14. Simplified77.8%

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

    if 1.15e-105 < F < 6.1999999999999999e-6

    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. Simplified99.4%

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

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

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

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

    if 6.1999999999999999e-6 < F < 7.1999999999999994e249

    1. Initial program 71.7%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-165.8%

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
    6. Simplified65.8%

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

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

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

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

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

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

    if 7.1999999999999994e249 < F

    1. Initial program 64.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.35 \cdot 10^{+37}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.15 \cdot 10^{-105}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-6}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 7.2 \cdot 10^{+249}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - x \cdot \frac{1}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 69.5% accurate, 2.5× speedup?

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

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

\mathbf{elif}\;F \leq 2.45 \cdot 10^{-114}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;F \leq 8 \cdot 10^{+253}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\

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


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

    1. Initial program 58.6%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-122.3%

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
    6. Simplified78.7%

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

    if -3.34999999999999984e37 < F < 2.4499999999999999e-114 or 7.9999999999999995e253 < F

    1. Initial program 94.2%

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified79.3%

      \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity79.3%

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

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

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

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

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    10. Simplified79.2%

      \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    11. Step-by-step derivation
      1. div-inv79.4%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      2. add-sqr-sqrt42.2%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}} \]
      3. sqrt-unprod27.2%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}} \]
      4. sqr-neg27.2%

        \[\leadsto -\sqrt{\color{blue}{\left(-\frac{x}{\tan B}\right) \cdot \left(-\frac{x}{\tan B}\right)}} \]
      5. div-inv27.2%

        \[\leadsto -\sqrt{\left(-\color{blue}{x \cdot \frac{1}{\tan B}}\right) \cdot \left(-\frac{x}{\tan B}\right)} \]
      6. div-inv27.2%

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

        \[\leadsto -\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} \]
      8. add-sqr-sqrt1.8%

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

        \[\leadsto -\left(-\color{blue}{\frac{x}{\tan B}}\right) \]
      10. neg-sub01.8%

        \[\leadsto -\color{blue}{\left(0 - \frac{x}{\tan B}\right)} \]
      11. sub-neg1.8%

        \[\leadsto -\color{blue}{\left(0 + \left(-\frac{x}{\tan B}\right)\right)} \]
      12. div-inv1.8%

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

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

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

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

        \[\leadsto -\left(0 + \sqrt{\left(-\frac{x}{\tan B}\right) \cdot \left(-\color{blue}{\frac{x}{\tan B}}\right)}\right) \]
      17. sqr-neg27.2%

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

      \[\leadsto -\color{blue}{\left(0 + \frac{x}{\tan B}\right)} \]
    13. Step-by-step derivation
      1. +-lft-identity79.4%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    14. Simplified79.4%

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

    if 2.4499999999999999e-114 < F < 6.1999999999999999e-6

    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. Simplified99.4%

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

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

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

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

    if 6.1999999999999999e-6 < F < 7.9999999999999995e253

    1. Initial program 71.7%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-165.8%

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
    6. Simplified65.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.35 \cdot 10^{+37}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.45 \cdot 10^{-114}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-6}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 8 \cdot 10^{+253}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 62.7% accurate, 2.7× speedup?

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

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

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

\mathbf{elif}\;F \leq 8 \cdot 10^{+253}:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < 9.2000000000000006e-109 or 7.9999999999999995e253 < F

    1. Initial program 81.4%

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified69.2%

      \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity69.2%

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

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

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

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

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    10. Simplified69.2%

      \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    11. Step-by-step derivation
      1. div-inv69.3%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      2. add-sqr-sqrt34.7%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}} \]
      3. sqrt-unprod22.7%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}} \]
      4. sqr-neg22.7%

        \[\leadsto -\sqrt{\color{blue}{\left(-\frac{x}{\tan B}\right) \cdot \left(-\frac{x}{\tan B}\right)}} \]
      5. div-inv22.7%

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

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

        \[\leadsto -\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} \]
      8. add-sqr-sqrt1.9%

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

        \[\leadsto -\left(-\color{blue}{\frac{x}{\tan B}}\right) \]
      10. neg-sub01.9%

        \[\leadsto -\color{blue}{\left(0 - \frac{x}{\tan B}\right)} \]
      11. sub-neg1.9%

        \[\leadsto -\color{blue}{\left(0 + \left(-\frac{x}{\tan B}\right)\right)} \]
      12. div-inv1.9%

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

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

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

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

        \[\leadsto -\left(0 + \sqrt{\left(-\frac{x}{\tan B}\right) \cdot \left(-\color{blue}{\frac{x}{\tan B}}\right)}\right) \]
      17. sqr-neg22.7%

        \[\leadsto -\left(0 + \sqrt{\color{blue}{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}}\right) \]
    12. Applied egg-rr69.3%

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    14. Simplified69.3%

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

    if 9.2000000000000006e-109 < F < 6.1999999999999999e-6

    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. Simplified99.4%

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

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

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

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

    if 6.1999999999999999e-6 < F < 7.9999999999999995e253

    1. Initial program 71.7%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-165.8%

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
    6. Simplified65.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 9.2 \cdot 10^{-109}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{elif}\;F \leq 6.2 \cdot 10^{-6}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 8 \cdot 10^{+253}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 62.4% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq 0.0082 \lor \neg \left(F \leq 8 \cdot 10^{+253}\right):\\
\;\;\;\;\frac{x}{-\tan B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 0.00820000000000000069 or 7.9999999999999995e253 < F

    1. Initial program 83.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. Add Preprocessing
    3. Taylor expanded in F around -inf 60.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    10. Simplified64.9%

      \[\leadsto -x \cdot \color{blue}{\frac{1}{\tan B}} \]
    11. Step-by-step derivation
      1. div-inv65.0%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      2. add-sqr-sqrt32.3%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}} \]
      3. sqrt-unprod21.7%

        \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}} \]
      4. sqr-neg21.7%

        \[\leadsto -\sqrt{\color{blue}{\left(-\frac{x}{\tan B}\right) \cdot \left(-\frac{x}{\tan B}\right)}} \]
      5. div-inv21.7%

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

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

        \[\leadsto -\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} \]
      8. add-sqr-sqrt2.0%

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

        \[\leadsto -\left(-\color{blue}{\frac{x}{\tan B}}\right) \]
      10. neg-sub02.0%

        \[\leadsto -\color{blue}{\left(0 - \frac{x}{\tan B}\right)} \]
      11. sub-neg2.0%

        \[\leadsto -\color{blue}{\left(0 + \left(-\frac{x}{\tan B}\right)\right)} \]
      12. div-inv2.0%

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

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

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

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

        \[\leadsto -\left(0 + \sqrt{\left(-\frac{x}{\tan B}\right) \cdot \left(-\color{blue}{\frac{x}{\tan B}}\right)}\right) \]
      17. sqr-neg21.7%

        \[\leadsto -\left(0 + \sqrt{\color{blue}{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}}\right) \]
    12. Applied egg-rr65.0%

      \[\leadsto -\color{blue}{\left(0 + \frac{x}{\tan B}\right)} \]
    13. Step-by-step derivation
      1. +-lft-identity65.0%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    14. Simplified65.0%

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

    if 0.00820000000000000069 < F < 7.9999999999999995e253

    1. Initial program 70.8%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
      2. neg-mul-167.8%

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{F}{\sin B} \cdot \frac{1}{F} \]
    6. Simplified67.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 0.0082 \lor \neg \left(F \leq 8 \cdot 10^{+253}\right):\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 55.7% accurate, 3.1× speedup?

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

\\
\frac{x}{-\tan B}
\end{array}
Derivation
  1. Initial program 80.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. Add Preprocessing
  3. Taylor expanded in F around -inf 55.8%

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

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

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

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

    \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
  7. Step-by-step derivation
    1. *-un-lft-identity59.5%

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

      \[\leadsto -x \cdot \left(1 \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}}\right) \]
    3. tan-quot59.5%

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

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

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

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

      \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    2. add-sqr-sqrt29.4%

      \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}} \]
    3. sqrt-unprod19.6%

      \[\leadsto -\color{blue}{\sqrt{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}} \]
    4. sqr-neg19.6%

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

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

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

      \[\leadsto -\color{blue}{\sqrt{-x \cdot \frac{1}{\tan B}} \cdot \sqrt{-x \cdot \frac{1}{\tan B}}} \]
    8. add-sqr-sqrt2.1%

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

      \[\leadsto -\left(-\color{blue}{\frac{x}{\tan B}}\right) \]
    10. neg-sub02.1%

      \[\leadsto -\color{blue}{\left(0 - \frac{x}{\tan B}\right)} \]
    11. sub-neg2.1%

      \[\leadsto -\color{blue}{\left(0 + \left(-\frac{x}{\tan B}\right)\right)} \]
    12. div-inv2.1%

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

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

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

      \[\leadsto -\left(0 + \sqrt{\left(-\color{blue}{\frac{x}{\tan B}}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}\right) \]
    16. div-inv19.6%

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

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

    \[\leadsto -\color{blue}{\left(0 + \frac{x}{\tan B}\right)} \]
  13. Step-by-step derivation
    1. +-lft-identity59.6%

      \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
  14. Simplified59.6%

    \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
  15. Final simplification59.6%

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

Alternative 15: 43.9% accurate, 21.6× speedup?

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

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

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

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


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

    1. Initial program 65.1%

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

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

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

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

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

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

    if -8.20000000000000003e-47 < F < 2.6000000000000001e-101

    1. Initial program 99.6%

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

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

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

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

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

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

    if 2.6000000000000001e-101 < F

    1. Initial program 75.0%

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

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

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

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

Alternative 16: 36.6% accurate, 32.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq 2.9 \cdot 10^{-100}:\\
\;\;\;\;\frac{x}{-B}\\

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


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

    1. Initial program 83.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    7. Simplified38.4%

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

    if 2.89999999999999975e-100 < F

    1. Initial program 75.0%

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

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

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

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

Alternative 17: 29.5% accurate, 81.0× speedup?

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

\\
\frac{x}{-B}
\end{array}
Derivation
  1. Initial program 80.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. Add Preprocessing
  3. Taylor expanded in F around inf 51.6%

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

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

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

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

    \[\leadsto \frac{\color{blue}{-x}}{B} \]
  8. Final simplification32.7%

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

Alternative 18: 10.0% accurate, 108.0× speedup?

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

\\
\frac{1}{B}
\end{array}
Derivation
  1. Initial program 80.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. Add Preprocessing
  3. Taylor expanded in F around inf 51.6%

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

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

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

Reproduce

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