VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.5% → 99.6%
Time: 15.3s
Alternatives: 20
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 20 alternatives:

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

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

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

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

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


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

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

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

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

    if -1.45e15 < F < 7.8e6

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

        \[\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. neg-mul-199.6%

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

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

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

    if 7.8e6 < F

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

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

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

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

\mathbf{elif}\;F \leq 0.00037:\\
\;\;\;\;\frac{{\left(2 + x \cdot 2\right)}^{-0.5}}{\frac{\sin B}{F}} - 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.4199999999999999

    1. Initial program 63.6%

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

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

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

    if -1.4199999999999999 < F < 3.6999999999999999e-4

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.6999999999999999e-4 < F

    1. Initial program 71.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. Simplified77.9%

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

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

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

Alternative 3: 99.1% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq 0.00037:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{2 + x \cdot 2}} - 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.4199999999999999

    1. Initial program 63.6%

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

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

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

    if -1.4199999999999999 < F < 3.6999999999999999e-4

    1. Initial program 99.4%

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

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

        \[\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. un-div-inv99.5%

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

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

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

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

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

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

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

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

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

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

    if 3.6999999999999999e-4 < F

    1. Initial program 71.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. Simplified77.9%

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

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

Alternative 4: 91.9% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq 2.05 \cdot 10^{-178}:\\
\;\;\;\;\frac{-1}{\frac{\tan B}{x}} + t\_0 \cdot \frac{F}{B}\\

\mathbf{elif}\;F \leq 23500:\\
\;\;\;\;\frac{F}{\sin B} \cdot t\_0 - \frac{x}{B}\\

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


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

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

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

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

    if -1.45e15 < F < 2.05e-178

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

        \[\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. neg-mul-199.6%

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

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

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

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

    if 2.05e-178 < F < 23500

    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. neg-mul-199.7%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\frac{\tan B}{x}}} + \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 \color{blue}{\frac{-1}{\frac{\tan B}{x}}} + \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 \frac{-1}{\frac{\tan B}{x}} + \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 \frac{-1}{\frac{\tan B}{x}} + \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 \frac{-1}{\frac{\tan B}{x}} + \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 83.8%

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

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

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

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

    if 23500 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.45 \cdot 10^{+15}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2.05 \cdot 10^{-178}:\\ \;\;\;\;\frac{-1}{\frac{\tan B}{x}} + {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ \mathbf{elif}\;F \leq 23500:\\ \;\;\;\;\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 5: 91.8% accurate, 1.4× speedup?

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

\mathbf{elif}\;F \leq 2.8 \cdot 10^{-178}:\\
\;\;\;\;\frac{-1}{\frac{\tan B}{x}} + \frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\

\mathbf{elif}\;F \leq 215000:\\
\;\;\;\;\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 < -1.0200000000000001e-16

    1. Initial program 64.6%

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

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

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

    if -1.0200000000000001e-16 < F < 2.80000000000000019e-178

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

        \[\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. neg-mul-199.6%

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

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

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

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

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

    if 2.80000000000000019e-178 < F < 215000

    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. neg-mul-199.7%

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

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

        \[\leadsto \color{blue}{\frac{-1}{\frac{\tan B}{x}}} + \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 \color{blue}{\frac{-1}{\frac{\tan B}{x}}} + \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 \frac{-1}{\frac{\tan B}{x}} + \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 \frac{-1}{\frac{\tan B}{x}} + \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 \frac{-1}{\frac{\tan B}{x}} + \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 83.8%

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

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

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

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

    if 215000 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.02 \cdot 10^{-16}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2.8 \cdot 10^{-178}:\\ \;\;\;\;\frac{-1}{\frac{\tan B}{x}} + \frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\\ \mathbf{elif}\;F \leq 215000:\\ \;\;\;\;\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 6: 91.9% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 64.6%

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

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

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

    if -1.0200000000000001e-16 < F < 3.6999999999999999e-4

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

        \[\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. neg-mul-199.6%

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

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

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

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

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

    if 3.6999999999999999e-4 < F

    1. Initial program 71.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. Simplified77.9%

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

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

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

Alternative 7: 85.2% accurate, 1.5× speedup?

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

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

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


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

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

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

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

    if -6.00000000000000021e-83 < F < 1.39999999999999992e-55

    1. Initial program 99.4%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num99.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. un-div-inv99.6%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-neg-out70.1%

        \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
      2. clear-num70.1%

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      3. tan-quot70.1%

        \[\leadsto -x \cdot \frac{1}{\color{blue}{\tan B}} \]
      4. div-inv70.3%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    10. Applied egg-rr70.3%

      \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
    11. Step-by-step derivation
      1. distribute-neg-frac270.3%

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

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

    if 1.39999999999999992e-55 < F

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

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

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

Alternative 8: 77.5% accurate, 1.5× speedup?

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

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

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

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


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

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

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

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

    if -6.00000000000000021e-83 < F < 8.20000000000000056e-58

    1. Initial program 99.4%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num99.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. un-div-inv99.6%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-neg-out70.1%

        \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
      2. clear-num70.1%

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      3. tan-quot70.1%

        \[\leadsto -x \cdot \frac{1}{\color{blue}{\tan B}} \]
      4. div-inv70.3%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    10. Applied egg-rr70.3%

      \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
    11. Step-by-step derivation
      1. distribute-neg-frac270.3%

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

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

    if 8.20000000000000056e-58 < F

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -6 \cdot 10^{-83}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 8.2 \cdot 10^{-58}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 69.7% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2.55 \cdot 10^{+165}:\\
\;\;\;\;F \cdot \left(\frac{1}{F} \cdot \frac{-1}{B}\right) - t\_0\\

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

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

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


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

    1. Initial program 50.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. Simplified64.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \color{blue}{\left(\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}\right)}\right) - \frac{x}{\tan B} \]
      9. add-sqr-sqrt99.6%

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

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

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

    if -2.5500000000000002e165 < F < -1.09999999999999996e51

    1. Initial program 72.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. Simplified93.0%

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

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

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

    if -1.09999999999999996e51 < F < 6.99999999999999983e-57

    1. Initial program 99.4%

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

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

        \[\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. un-div-inv99.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in65.5%

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-neg-out65.5%

        \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
      2. clear-num65.4%

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      3. tan-quot65.5%

        \[\leadsto -x \cdot \frac{1}{\color{blue}{\tan B}} \]
      4. div-inv65.6%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    10. Applied egg-rr65.6%

      \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
    11. Step-by-step derivation
      1. distribute-neg-frac265.6%

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

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

    if 6.99999999999999983e-57 < F

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.55 \cdot 10^{+165}:\\ \;\;\;\;F \cdot \left(\frac{1}{F} \cdot \frac{-1}{B}\right) - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.1 \cdot 10^{+51}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-57}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 69.5% accurate, 2.7× speedup?

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

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

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

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


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

    1. Initial program 60.3%

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

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

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

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

    if -1.41999999999999998e51 < F < 5.4999999999999999e-55

    1. Initial program 99.4%

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

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

        \[\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. un-div-inv99.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in65.5%

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-neg-out65.5%

        \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
      2. clear-num65.4%

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      3. tan-quot65.5%

        \[\leadsto -x \cdot \frac{1}{\color{blue}{\tan B}} \]
      4. div-inv65.6%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    10. Applied egg-rr65.6%

      \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
    11. Step-by-step derivation
      1. distribute-neg-frac265.6%

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

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

    if 5.4999999999999999e-55 < F

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.42 \cdot 10^{+51}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 5.5 \cdot 10^{-55}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 58.2% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-62}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.8499999999999999e-62

    1. Initial program 79.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. Simplified94.0%

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

        \[\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. un-div-inv94.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in87.0%

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. neg-sub087.0%

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(0 - \frac{1}{\tan B}\right)} \]
    11. Step-by-step derivation
      1. sub0-neg87.1%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-1 \cdot 1}{\tan B}} \]
      4. metadata-eval87.1%

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

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

    if -1.8499999999999999e-62 < x < -1.02000000000000002e-252

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{x \cdot \sin B} - \frac{\cos B}{\sin B}\right)} \]
    6. Taylor expanded in x around 0 35.4%

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

    if -1.02000000000000002e-252 < x < 1.55000000000000011e-181

    1. Initial program 68.4%

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

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

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

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) - \frac{x}{\tan B} \]
      5. metadata-eval17.8%

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \color{blue}{\left(\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}\right)}\right) - \frac{x}{\tan B} \]
      9. add-sqr-sqrt28.5%

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

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

      \[\leadsto F \cdot \left(\frac{1}{F} \cdot \frac{-1}{\sin B}\right) - \color{blue}{\frac{x}{B}} \]
    8. Taylor expanded in B around inf 28.7%

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

    if 1.55000000000000011e-181 < x

    1. Initial program 89.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. Simplified92.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-num92.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. un-div-inv92.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in78.0%

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-neg-out78.0%

        \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
      2. clear-num77.8%

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

        \[\leadsto -x \cdot \frac{1}{\color{blue}{\tan B}} \]
      4. div-inv78.2%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    10. Applied egg-rr78.2%

      \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
    11. Step-by-step derivation
      1. distribute-neg-frac278.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.85 \cdot 10^{-62}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B}\\ \mathbf{elif}\;x \leq -1.02 \cdot 10^{-252}:\\ \;\;\;\;x \cdot \frac{1}{\sin B \cdot x}\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{-181}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 69.5% accurate, 2.8× speedup?

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

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

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

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


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

    1. Initial program 60.3%

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

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

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

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

    if -1.16e51 < F < 5.0000000000000002e-57

    1. Initial program 99.4%

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

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

        \[\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. un-div-inv99.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in65.5%

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-neg-out65.5%

        \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
      2. clear-num65.4%

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      3. tan-quot65.5%

        \[\leadsto -x \cdot \frac{1}{\color{blue}{\tan B}} \]
      4. div-inv65.6%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    10. Applied egg-rr65.6%

      \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
    11. Step-by-step derivation
      1. distribute-neg-frac265.6%

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

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

    if 5.0000000000000002e-57 < F

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

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

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

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

Alternative 13: 60.5% accurate, 2.8× speedup?

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

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

\mathbf{elif}\;F \leq 8.6 \cdot 10^{+201}:\\
\;\;\;\;\frac{x}{-\tan B}\\

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


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

    1. Initial program 60.3%

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

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

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

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

    if -1.09999999999999996e51 < F < 8.59999999999999981e201

    1. Initial program 97.2%

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

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

        \[\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. un-div-inv99.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in62.2%

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-neg-out62.2%

        \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
      2. clear-num62.1%

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      3. tan-quot62.2%

        \[\leadsto -x \cdot \frac{1}{\color{blue}{\tan B}} \]
      4. div-inv62.3%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    10. Applied egg-rr62.3%

      \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
    11. Step-by-step derivation
      1. distribute-neg-frac262.3%

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

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

    if 8.59999999999999981e201 < F

    1. Initial program 23.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. Simplified32.3%

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

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

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{x \cdot \sin B} - \frac{\cos B}{\sin B}\right)} \]
    6. Taylor expanded in x around 0 54.1%

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

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

Alternative 14: 59.0% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-224} \lor \neg \left(x \leq 2.7 \cdot 10^{-181}\right):\\
\;\;\;\;\frac{x}{-\tan B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.79999999999999984e-224 or 2.6999999999999999e-181 < x

    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. Simplified90.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-num90.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. un-div-inv90.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in72.2%

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-neg-out72.2%

        \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
      2. clear-num72.1%

        \[\leadsto -x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      3. tan-quot72.2%

        \[\leadsto -x \cdot \frac{1}{\color{blue}{\tan B}} \]
      4. div-inv72.3%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    10. Applied egg-rr72.3%

      \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
    11. Step-by-step derivation
      1. distribute-neg-frac272.3%

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

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

    if -6.79999999999999984e-224 < x < 2.6999999999999999e-181

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

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

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

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) - \frac{x}{\tan B} \]
      5. metadata-eval16.8%

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

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

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

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

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

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

      \[\leadsto F \cdot \left(\frac{1}{F} \cdot \frac{-1}{\sin B}\right) - \color{blue}{\frac{x}{B}} \]
    8. Taylor expanded in B around inf 25.9%

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

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

Alternative 15: 59.0% accurate, 2.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.9999999999999998e-218

    1. Initial program 74.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. Simplified87.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. Step-by-step derivation
      1. clear-num87.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. un-div-inv87.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in63.3%

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

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

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

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

        \[\leadsto x \cdot \left(0 - \frac{1}{\color{blue}{\tan B}}\right) \]
    10. Applied egg-rr63.3%

      \[\leadsto x \cdot \color{blue}{\left(0 - \frac{1}{\tan B}\right)} \]
    11. Step-by-step derivation
      1. sub0-neg63.3%

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-1 \cdot 1}{\tan B}} \]
      4. metadata-eval63.3%

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

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

    if -2.9999999999999998e-218 < x < 6.49999999999999997e-182

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

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

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

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) - \frac{x}{\tan B} \]
      5. metadata-eval16.8%

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

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

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

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

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

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

      \[\leadsto F \cdot \left(\frac{1}{F} \cdot \frac{-1}{\sin B}\right) - \color{blue}{\frac{x}{B}} \]
    8. Taylor expanded in B around inf 25.9%

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

    if 6.49999999999999997e-182 < x

    1. Initial program 89.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. Simplified92.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-num92.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. un-div-inv92.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
      3. distribute-rgt-neg-in78.0%

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

      \[\leadsto \color{blue}{x \cdot \left(-\frac{\cos B}{\sin B}\right)} \]
    9. Step-by-step derivation
      1. distribute-rgt-neg-out78.0%

        \[\leadsto \color{blue}{-x \cdot \frac{\cos B}{\sin B}} \]
      2. clear-num77.8%

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

        \[\leadsto -x \cdot \frac{1}{\color{blue}{\tan B}} \]
      4. div-inv78.2%

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
    10. Applied egg-rr78.2%

      \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
    11. Step-by-step derivation
      1. distribute-neg-frac278.2%

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

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

Alternative 16: 43.9% accurate, 2.9× speedup?

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

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

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

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

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


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

    1. Initial program 53.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. Simplified71.3%

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

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

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) - \frac{x}{\tan B} \]
      5. metadata-eval67.1%

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \color{blue}{\left(\sqrt{\frac{-1}{\sin B}} \cdot \sqrt{\frac{-1}{\sin B}}\right)}\right) - \frac{x}{\tan B} \]
      9. add-sqr-sqrt99.6%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. neg-mul-149.3%

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

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

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

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

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

    if -1.3000000000000001e106 < F < -2.10000000000000004e36

    1. Initial program 88.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 inf 30.2%

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

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) - \frac{x}{\tan B} \]
      5. metadata-eval71.4%

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

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

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

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

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

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

      \[\leadsto F \cdot \left(\frac{1}{F} \cdot \frac{-1}{\sin B}\right) - \color{blue}{\frac{x}{B}} \]
    8. Taylor expanded in B around inf 68.7%

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

    if -2.10000000000000004e36 < F < 3.39999999999999982e-56

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

    if 3.39999999999999982e-56 < F

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.3 \cdot 10^{+106}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -2.1 \cdot 10^{+36}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 3.4 \cdot 10^{-56}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 44.0% accurate, 21.6× speedup?

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

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

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

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


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

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

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

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

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) - \frac{x}{\tan B} \]
      5. metadata-eval59.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. neg-mul-139.3%

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

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

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

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

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

    if -2.4000000000000001e-93 < F < 4.5000000000000003e-58

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

    if 4.5000000000000003e-58 < F

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

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

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

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

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

Alternative 18: 31.5% accurate, 23.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-62} \lor \neg \left(x \leq 1.4 \cdot 10^{-208}\right):\\
\;\;\;\;\frac{x}{-B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.79999999999999971e-62 or 1.40000000000000001e-208 < x

    1. Initial program 86.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. Simplified92.7%

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

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

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

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

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

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

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

    if -5.79999999999999971e-62 < x < 1.40000000000000001e-208

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.8 \cdot 10^{-62} \lor \neg \left(x \leq 1.4 \cdot 10^{-208}\right):\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 36.4% accurate, 23.1× speedup?

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

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

\mathbf{elif}\;F \leq 6.5 \cdot 10^{+190}:\\
\;\;\;\;\frac{x}{-B}\\

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


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

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

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

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

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

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

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

        \[\leadsto F \cdot \left(\frac{1}{F} \cdot \sqrt{\color{blue}{\frac{1 \cdot 1}{\sin B \cdot \sin B}}}\right) - \frac{x}{\tan B} \]
      5. metadata-eval59.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. neg-mul-139.3%

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

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

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

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

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

    if -2.35e-93 < F < 6.5000000000000001e190

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

    if 6.5000000000000001e190 < F

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.35 \cdot 10^{-93}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 6.5 \cdot 10^{+190}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 10.2% 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.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. Simplified87.3%

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

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

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

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

Reproduce

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