VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.0% → 99.6%
Time: 18.2s
Alternatives: 23
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 23 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.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.8× speedup?

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

\mathbf{elif}\;F \leq 6800:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{2 + {F}^{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 < -7.4999999999999999e35

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

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

    if -7.4999999999999999e35 < F < 6800

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

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

    if 6800 < F

    1. Initial program 52.6%

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

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

Alternative 2: 99.5% accurate, 1.0× speedup?

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

\mathbf{elif}\;F \leq 6800:\\
\;\;\;\;\frac{-1}{\frac{\tan B}{x}} + \frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\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 < -2.50000000000000013e31

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

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

    if -2.50000000000000013e31 < F < 6800

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

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

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

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

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

      \[\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)} \]

    if 6800 < F

    1. Initial program 52.6%

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

      \[\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 -2.5 \cdot 10^{+31}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 6800:\\ \;\;\;\;\frac{-1}{\frac{\tan B}{x}} + \frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

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

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

    if -8.6e7 < F < 6800

    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. metadata-eval99.4%

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

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

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

    if 6800 < F

    1. Initial program 52.6%

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

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

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

Alternative 4: 99.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 64.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. Simplified77.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 98.6%

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

    if -1.3999999999999999 < F < 1.44999999999999996

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

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

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

    if 1.44999999999999996 < F

    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. Simplified68.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.3%

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

Alternative 5: 90.3% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -2.05 \cdot 10^{-150}:\\
\;\;\;\;t\_0\\

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

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

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


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

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

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

    if -2e14 < F < -2.0499999999999999e-150 or 8e-205 < F < 6800

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

    if -2.0499999999999999e-150 < F < 8e-205

    1. Initial program 99.3%

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. *-commutative88.3%

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

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

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

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

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

    if 6800 < F

    1. Initial program 52.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2 \cdot 10^{+14}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -2.05 \cdot 10^{-150}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 8 \cdot 10^{-205}:\\ \;\;\;\;\cos B \cdot \frac{x}{-\sin B}\\ \mathbf{elif}\;F \leq 6800:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\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: 89.7% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -2.25 \cdot 10^{-150}:\\
\;\;\;\;t\_0\\

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

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

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


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

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

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

    if -1.00000000000000007e-17 < F < -2.2500000000000001e-150 or 1.02e-207 < F < 0.440000000000000002

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-x}{B} + \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} \]
    12. Simplified85.9%

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

    if -2.2500000000000001e-150 < F < 1.02e-207

    1. Initial program 99.3%

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. *-commutative88.3%

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

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

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

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

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

    if 0.440000000000000002 < F

    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. Simplified68.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.3%

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

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

Alternative 7: 84.6% accurate, 1.4× speedup?

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

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

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

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

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

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


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

    1. Initial program 67.7%

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

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

    if -9.99999999999999924e-25 < F < 4.59999999999999992e-180

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

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

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

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

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

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

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

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

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

    if 4.59999999999999992e-180 < F < 8.19999999999999955e-70

    1. Initial program 99.6%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.8%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.8%

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

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

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

    if 8.19999999999999955e-70 < F < 1.0499999999999999e-14

    1. Initial program 99.2%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.3%

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

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

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

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

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

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

    if 1.0499999999999999e-14 < F

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1 \cdot 10^{-24}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.6 \cdot 10^{-180}:\\ \;\;\;\;\cos B \cdot \frac{x}{-\sin B}\\ \mathbf{elif}\;F \leq 8.2 \cdot 10^{-70}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{-14}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 78.2% accurate, 1.4× speedup?

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

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

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

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

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

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


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

    1. Initial program 67.7%

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

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

    if -5.9999999999999995e-25 < F < 1.05e-170

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

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

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

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

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

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

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

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

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

    if 1.05e-170 < F < 1.2999999999999999e-68

    1. Initial program 99.6%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.8%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.8%

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

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

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

    if 1.2999999999999999e-68 < F < 5.79999999999999982e-9

    1. Initial program 99.3%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.4%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.4%

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

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

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

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

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

    if 5.79999999999999982e-9 < F

    1. Initial program 54.4%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -6 \cdot 10^{-25}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{-170}:\\ \;\;\;\;\cos B \cdot \frac{x}{-\sin B}\\ \mathbf{elif}\;F \leq 1.3 \cdot 10^{-68}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-9}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 71.9% accurate, 1.4× speedup?

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

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

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

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

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

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


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

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

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

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

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

    if -1.3499999999999999e-5 < F < 3.00000000000000009e-159

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

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

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

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

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

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

        \[\leadsto \color{blue}{\cos B \cdot \left(-\frac{x}{\sin B}\right)} \]
      5. distribute-neg-frac271.7%

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

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

    if 3.00000000000000009e-159 < F < 7.9999999999999997e-69

    1. Initial program 99.6%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.8%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.8%

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

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

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

    if 7.9999999999999997e-69 < F < 5.79999999999999982e-9

    1. Initial program 99.3%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.4%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.4%

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

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

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

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

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

    if 5.79999999999999982e-9 < F

    1. Initial program 54.4%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.35 \cdot 10^{-5}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 3 \cdot 10^{-159}:\\ \;\;\;\;\cos B \cdot \frac{x}{-\sin B}\\ \mathbf{elif}\;F \leq 8 \cdot 10^{-69}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-9}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 71.9% accurate, 1.4× speedup?

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

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

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

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

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

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


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

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

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

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

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

    if -2.00000000000000016e-5 < F < 3.00000000000000009e-159

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

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

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

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

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

    if 3.00000000000000009e-159 < F < 5.29999999999999983e-70

    1. Initial program 99.6%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.8%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.8%

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

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

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

    if 5.29999999999999983e-70 < F < 5.79999999999999982e-9

    1. Initial program 99.3%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.4%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.4%

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

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

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

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

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

    if 5.79999999999999982e-9 < F

    1. Initial program 54.4%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2 \cdot 10^{-5}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 3 \cdot 10^{-159}:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 5.3 \cdot 10^{-70}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-9}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 63.9% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.35 \cdot 10^{-285}:\\
\;\;\;\;\frac{-1}{B \cdot \left(1 + \left(B \cdot B\right) \cdot -0.16666666666666666\right)} - \frac{x}{\tan B}\\

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

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

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


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

    1. Initial program 81.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. Simplified87.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 76.0%

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

      \[\leadsto \frac{-1}{\color{blue}{B \cdot \left(1 + -0.16666666666666666 \cdot {B}^{2}\right)}} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. *-commutative64.4%

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

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

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

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

    if -1.3499999999999999e-285 < F < 5.20000000000000004e-70

    1. Initial program 99.3%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.8%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.8%

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

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

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

    if 5.20000000000000004e-70 < F < 4.5999999999999998e-9

    1. Initial program 99.3%

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

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.4%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.4%

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

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

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

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

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

    if 4.5999999999999998e-9 < F

    1. Initial program 54.4%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.35 \cdot 10^{-285}:\\ \;\;\;\;\frac{-1}{B \cdot \left(1 + \left(B \cdot B\right) \cdot -0.16666666666666666\right)} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 5.2 \cdot 10^{-70}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{elif}\;F \leq 4.6 \cdot 10^{-9}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 55.4% accurate, 2.5× speedup?

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.35000000000000016e-27 or 3.39999999999999974e-7 < x

    1. Initial program 84.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. Simplified96.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 94.9%

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

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

    if -2.35000000000000016e-27 < x < -1.49999999999999987e-181

    1. Initial program 69.3%

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

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

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

    if -1.49999999999999987e-181 < x < -2.4999999999999998e-246

    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. Simplified89.1%

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

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} - \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. *-commutative80.4%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/80.4%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative80.4%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\cos B \cdot \frac{x}{\sin B}} \]
    6. Simplified80.4%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{0.5}}{\sin B}} \]
    8. Taylor expanded in B around 0 40.2%

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

    if -2.4999999999999998e-246 < x < 3.39999999999999974e-7

    1. Initial program 66.7%

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

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

Alternative 13: 44.7% accurate, 2.6× speedup?

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

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

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

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

\mathbf{elif}\;F \leq 5.9 \cdot 10^{+81}:\\
\;\;\;\;\frac{1 - x}{B}\\

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


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

    1. Initial program 75.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. Simplified84.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 83.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-\left(x + 1\right)}{B}} \]
    8. Taylor expanded in x around 0 36.5%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(-x\right) - 1}{B}} \]
      4. sub-neg36.5%

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

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

        \[\leadsto \frac{\color{blue}{\left(-x\right) + \left(-1\right)}}{B} \]
      7. metadata-eval36.5%

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

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

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

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

    if -2.2000000000000001e-116 < F < 4.8e-36

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified44.3%

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

    if 4.8e-36 < F < 4.99999999999999999e-15

    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. Simplified100.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 0 99.4%

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.4%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.4%

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

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{0.5}}{\sin B}} \]
    8. Taylor expanded in B around 0 63.7%

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

        \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{B}} \]
    10. Simplified64.1%

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

    if 4.99999999999999999e-15 < F < 5.9000000000000004e81

    1. Initial program 94.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. Simplified99.8%

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

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

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

    if 5.9000000000000004e81 < F

    1. Initial program 40.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. Simplified58.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.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.2 \cdot 10^{-116}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 4.8 \cdot 10^{-36}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-15}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{B}\\ \mathbf{elif}\;F \leq 5.9 \cdot 10^{+81}:\\ \;\;\;\;\frac{1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 63.6% accurate, 2.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.85 \cdot 10^{-281}:\\
\;\;\;\;\frac{-1}{B \cdot \left(1 + \left(B \cdot B\right) \cdot -0.16666666666666666\right)} - \frac{x}{\tan B}\\

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

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


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

    1. Initial program 81.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. Simplified87.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 76.0%

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

      \[\leadsto \frac{-1}{\color{blue}{B \cdot \left(1 + -0.16666666666666666 \cdot {B}^{2}\right)}} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. *-commutative64.4%

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

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

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

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

    if -1.84999999999999996e-281 < F < 1.25e-14

    1. Initial program 99.3%

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.7%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.7%

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

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

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

    if 1.25e-14 < F

    1. Initial program 55.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \frac{-x}{B}} \]
      4. distribute-frac-neg75.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.85 \cdot 10^{-281}:\\ \;\;\;\;\frac{-1}{B \cdot \left(1 + \left(B \cdot B\right) \cdot -0.16666666666666666\right)} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.25 \cdot 10^{-14}:\\ \;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 63.1% accurate, 2.6× speedup?

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

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

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

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


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

    1. Initial program 81.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. Simplified87.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 76.0%

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

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

    if -1.00000000000000004e-284 < F < 1.25e-14

    1. Initial program 99.3%

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

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

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/99.7%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative99.7%

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

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

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

    if 1.25e-14 < F

    1. Initial program 55.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \frac{-x}{B}} \]
      4. distribute-frac-neg75.1%

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

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

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

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

Alternative 16: 54.3% accurate, 2.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.0499999999999999e-27 or 9.4999999999999997e-68 < x

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

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

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

    if -2.0499999999999999e-27 < x < -3.49999999999999996e-181

    1. Initial program 69.3%

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

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

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

    if -3.49999999999999996e-181 < x < 9.4999999999999997e-68

    1. Initial program 71.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. Simplified73.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 0 56.3%

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} - \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. *-commutative56.3%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + \color{blue}{x \cdot 2}}} - \frac{x \cdot \cos B}{\sin B} \]
      2. associate-*l/56.3%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
      3. *-commutative56.3%

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \color{blue}{\cos B \cdot \frac{x}{\sin B}} \]
    6. Simplified56.3%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{0.5}}{\sin B}} \]
    8. Taylor expanded in B around 0 28.2%

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{0.5}}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 17: 44.4% accurate, 2.7× speedup?

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

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

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

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

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


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

    1. Initial program 75.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. Simplified84.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 83.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-\left(x + 1\right)}{B}} \]
    8. Taylor expanded in x around 0 36.5%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(-x\right) - 1}{B}} \]
      4. sub-neg36.5%

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

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

        \[\leadsto \frac{\color{blue}{\left(-x\right) + \left(-1\right)}}{B} \]
      7. metadata-eval36.5%

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

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

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

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

    if -3.8000000000000001e-116 < F < 2.4999999999999998e-78

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

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

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

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

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

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

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

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

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

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

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

    if 2.4999999999999998e-78 < F < 1.80000000000000003e81

    1. Initial program 96.6%

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

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

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

    if 1.80000000000000003e81 < F

    1. Initial program 40.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. Simplified58.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.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.8 \cdot 10^{-116}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 2.5 \cdot 10^{-78}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 1.8 \cdot 10^{+81}:\\ \;\;\;\;\frac{1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 61.2% accurate, 2.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 4.2999999999999999e23

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

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

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

    if 4.2999999999999999e23 < F

    1. Initial program 49.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 19: 44.4% accurate, 21.6× speedup?

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

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

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

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


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

    1. Initial program 75.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. Simplified84.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 83.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-\left(x + 1\right)}{B}} \]
    8. Taylor expanded in x around 0 36.5%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(-x\right) - 1}{B}} \]
      4. sub-neg36.5%

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

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

        \[\leadsto \frac{\color{blue}{\left(-x\right) + \left(-1\right)}}{B} \]
      7. metadata-eval36.5%

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

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

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

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

    if -2.0999999999999999e-116 < F < 1.64999999999999991e-78

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

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

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

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

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

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

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

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

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

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

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

    if 1.64999999999999991e-78 < F

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.1 \cdot 10^{-116}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.65 \cdot 10^{-78}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 36.9% accurate, 21.6× speedup?

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

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

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

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


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

    1. Initial program 75.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. Simplified84.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 83.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-\left(x + 1\right)}{B}} \]
    8. Taylor expanded in x around 0 36.5%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(-x\right) - 1}{B}} \]
      4. sub-neg36.5%

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

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

        \[\leadsto \frac{\color{blue}{\left(-x\right) + \left(-1\right)}}{B} \]
      7. metadata-eval36.5%

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

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

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

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

    if -3.8000000000000001e-116 < F < 1.79999999999999996e227

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified36.7%

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

    if 1.79999999999999996e227 < F

    1. Initial program 26.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. Simplified36.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot \frac{\color{blue}{\sqrt{\left(-\left(x + 1\right)\right) \cdot \left(-\left(x + 1\right)\right)}}}{B} \]
      4. sqr-neg36.5%

        \[\leadsto 1 \cdot \frac{\sqrt{\color{blue}{\left(x + 1\right) \cdot \left(x + 1\right)}}}{B} \]
      5. sqrt-unprod31.8%

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

        \[\leadsto 1 \cdot \frac{\color{blue}{x + 1}}{B} \]
    9. Applied egg-rr32.8%

      \[\leadsto \color{blue}{1 \cdot \frac{x + 1}{B}} \]
    10. Step-by-step derivation
      1. *-lft-identity32.8%

        \[\leadsto \color{blue}{\frac{x + 1}{B}} \]
    11. Simplified32.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.8 \cdot 10^{-116}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.8 \cdot 10^{+227}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + 1}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 30.0% accurate, 32.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 4.0000000000000004e227

    1. Initial program 82.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. Simplified89.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 60.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    10. Simplified30.2%

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

    if 4.0000000000000004e227 < F

    1. Initial program 26.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. Simplified36.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot \frac{\color{blue}{\sqrt{\left(-\left(x + 1\right)\right) \cdot \left(-\left(x + 1\right)\right)}}}{B} \]
      4. sqr-neg36.5%

        \[\leadsto 1 \cdot \frac{\sqrt{\color{blue}{\left(x + 1\right) \cdot \left(x + 1\right)}}}{B} \]
      5. sqrt-unprod31.8%

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

        \[\leadsto 1 \cdot \frac{\color{blue}{x + 1}}{B} \]
    9. Applied egg-rr32.8%

      \[\leadsto \color{blue}{1 \cdot \frac{x + 1}{B}} \]
    10. Step-by-step derivation
      1. *-lft-identity32.8%

        \[\leadsto \color{blue}{\frac{x + 1}{B}} \]
    11. Simplified32.8%

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

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

Alternative 22: 30.0% accurate, 81.0× speedup?

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

\\
\frac{x}{-B}
\end{array}
Derivation
  1. Initial program 76.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. Simplified84.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 57.9%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-x}}{B} \]
  10. Simplified28.4%

    \[\leadsto \color{blue}{\frac{-x}{B}} \]
  11. Final simplification28.4%

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

Alternative 23: 10.6% accurate, 108.0× speedup?

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

\\
\frac{-1}{B}
\end{array}
Derivation
  1. Initial program 76.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. Simplified84.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 57.9%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-\left(x + 1\right)}{B}} \]
  8. Taylor expanded in x around 0 9.2%

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

Reproduce

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