VandenBroeck and Keller, Equation (23)

Percentage Accurate: 75.9% → 99.6%
Time: 16.8s
Alternatives: 20
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 20 alternatives:

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

Initial Program: 75.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1 \cdot 10^{+32}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\frac{F \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}}{\sin B} - t\_0\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1e+32)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 2e+136)
       (- (/ (* F (pow (fma F F 2.0) -0.5)) (sin B)) t_0)
       (- (* F (/ 1.0 (* F (sin B)))) t_0)))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1e+32) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 2e+136) {
		tmp = ((F * pow(fma(F, F, 2.0), -0.5)) / sin(B)) - t_0;
	} else {
		tmp = (F * (1.0 / (F * sin(B)))) - t_0;
	}
	return tmp;
}
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1e+32)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 2e+136)
		tmp = Float64(Float64(Float64(F * (fma(F, F, 2.0) ^ -0.5)) / sin(B)) - t_0);
	else
		tmp = Float64(Float64(F * Float64(1.0 / Float64(F * sin(B)))) - t_0);
	end
	return tmp
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1e+32], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 2e+136], N[(N[(N[(F * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(F * N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $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^{+32}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\

\mathbf{elif}\;F \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\frac{F \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}}{\sin B} - t\_0\\

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


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

    1. Initial program 56.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. Simplified77.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 x around 0 77.0%

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity77.1%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine77.1%

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

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

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

    if -1.00000000000000005e32 < F < 2.00000000000000012e136

    1. Initial program 96.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. 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 x around 0 99.6%

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity99.6%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine99.6%

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

      \[\leadsto F \cdot \color{blue}{\frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B}} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. associate-*r/99.7%

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

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

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

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

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

    if 2.00000000000000012e136 < F

    1. Initial program 33.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. Simplified60.5%

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

      \[\leadsto F \cdot \color{blue}{\frac{1}{F \cdot \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 -1.2 \cdot 10^{+26}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 2.7 \cdot 10^{+18}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{\frac{1}{F}}{\sin B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1.2e+26)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 2.7e+18)
       (+
        (* x (/ -1.0 (tan B)))
        (* (/ F (sin B)) (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5)))
       (- (* F (/ (/ 1.0 F) (sin B))) t_0)))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1.2e+26) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 2.7e+18) {
		tmp = (x * (-1.0 / tan(B))) + ((F / sin(B)) * pow(((2.0 + (F * F)) + (x * 2.0)), -0.5));
	} else {
		tmp = (F * ((1.0 / F) / 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.2d+26)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= 2.7d+18) then
        tmp = (x * ((-1.0d0) / tan(b))) + ((f / sin(b)) * (((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0)))
    else
        tmp = (f * ((1.0d0 / f) / 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.2e+26) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= 2.7e+18) {
		tmp = (x * (-1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5));
	} else {
		tmp = (F * ((1.0 / F) / Math.sin(B))) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -1.2e+26:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= 2.7e+18:
		tmp = (x * (-1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5))
	else:
		tmp = (F * ((1.0 / F) / math.sin(B))) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1.2e+26)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 2.7e+18)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / sin(B)) * (Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5)));
	else
		tmp = Float64(Float64(F * Float64(Float64(1.0 / F) / 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.2e+26)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= 2.7e+18)
		tmp = (x * (-1.0 / tan(B))) + ((F / sin(B)) * (((2.0 + (F * F)) + (x * 2.0)) ^ -0.5));
	else
		tmp = (F * ((1.0 / F) / 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.2e+26], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 2.7e+18], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $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[(F * N[(N[(1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 56.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. Simplified77.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 x around 0 77.0%

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity77.1%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine77.1%

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

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

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

    if -1.20000000000000002e26 < F < 2.7e18

    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

    if 2.7e18 < F

    1. Initial program 54.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. Simplified77.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 x around 0 77.7%

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity77.7%

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{{F}^{2} + 2}}}}{\sin B} - \frac{x}{\tan B} \]
      4. unpow277.7%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine77.7%

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

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

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

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

Alternative 3: 98.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 61.6%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity79.6%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine79.6%

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

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

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

    if -1.44999999999999996 < F < 165000

    1. Initial program 99.5%

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity99.7%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine99.7%

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{0.5} \cdot F}}{\sin B} - \frac{x}{\tan B} \]
    9. Simplified98.7%

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

    if 165000 < F

    1. Initial program 56.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.45:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 165000:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 98.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 61.6%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity79.6%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine79.6%

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

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

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

    if -1.44999999999999996 < F < 165000

    1. Initial program 99.5%

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity99.7%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine99.7%

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

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

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

    if 165000 < F

    1. Initial program 56.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.45:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 165000:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 89.1% 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}\\ \mathbf{if}\;F \leq -0.058:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.65 \cdot 10^{-193}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 1.6 \cdot 10^{-105}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{elif}\;F \leq 165000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\ \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))))
   (if (<= F -0.058)
     (- (/ -1.0 (sin B)) (/ x (tan B)))
     (if (<= F -1.65e-193)
       t_0
       (if (<= F 1.6e-105)
         (/ (- x) (tan B))
         (if (<= F 165000.0)
           t_0
           (+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B)))))))))
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 tmp;
	if (F <= -0.058) {
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	} else if (F <= -1.65e-193) {
		tmp = t_0;
	} else if (F <= 1.6e-105) {
		tmp = -x / tan(B);
	} else if (F <= 165000.0) {
		tmp = t_0;
	} else {
		tmp = (x * (-1.0 / tan(B))) + (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) :: t_0
    real(8) :: tmp
    t_0 = ((f / sin(b)) * sqrt((1.0d0 / (2.0d0 + (x * 2.0d0))))) - (x / b)
    if (f <= (-0.058d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / tan(b))
    else if (f <= (-1.65d-193)) then
        tmp = t_0
    else if (f <= 1.6d-105) then
        tmp = -x / tan(b)
    else if (f <= 165000.0d0) then
        tmp = t_0
    else
        tmp = (x * ((-1.0d0) / tan(b))) + (1.0d0 / sin(b))
    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 tmp;
	if (F <= -0.058) {
		tmp = (-1.0 / Math.sin(B)) - (x / Math.tan(B));
	} else if (F <= -1.65e-193) {
		tmp = t_0;
	} else if (F <= 1.6e-105) {
		tmp = -x / Math.tan(B);
	} else if (F <= 165000.0) {
		tmp = t_0;
	} else {
		tmp = (x * (-1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
	}
	return tmp;
}
def code(F, B, x):
	t_0 = ((F / math.sin(B)) * math.sqrt((1.0 / (2.0 + (x * 2.0))))) - (x / B)
	tmp = 0
	if F <= -0.058:
		tmp = (-1.0 / math.sin(B)) - (x / math.tan(B))
	elif F <= -1.65e-193:
		tmp = t_0
	elif F <= 1.6e-105:
		tmp = -x / math.tan(B)
	elif F <= 165000.0:
		tmp = t_0
	else:
		tmp = (x * (-1.0 / math.tan(B))) + (1.0 / math.sin(B))
	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))
	tmp = 0.0
	if (F <= -0.058)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B)));
	elseif (F <= -1.65e-193)
		tmp = t_0;
	elseif (F <= 1.6e-105)
		tmp = Float64(Float64(-x) / tan(B));
	elseif (F <= 165000.0)
		tmp = t_0;
	else
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B)));
	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);
	tmp = 0.0;
	if (F <= -0.058)
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	elseif (F <= -1.65e-193)
		tmp = t_0;
	elseif (F <= 1.6e-105)
		tmp = -x / tan(B);
	elseif (F <= 165000.0)
		tmp = t_0;
	else
		tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
	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]}, If[LessEqual[F, -0.058], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.65e-193], t$95$0, If[LessEqual[F, 1.6e-105], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 165000.0], t$95$0, N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -1.65 \cdot 10^{-193}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 62.1%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity79.8%

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

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

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

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

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

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

    if -0.0580000000000000029 < F < -1.6499999999999999e-193 or 1.59999999999999991e-105 < F < 165000

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

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

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

    if -1.6499999999999999e-193 < F < 1.59999999999999991e-105

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub088.5%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr88.5%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub088.5%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac88.5%

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

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

    if 165000 < F

    1. Initial program 56.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.058:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.65 \cdot 10^{-193}:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.6 \cdot 10^{-105}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{elif}\;F \leq 165000:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 91.8% accurate, 1.4× speedup?

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

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

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

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

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


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

    1. Initial program 62.1%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity79.8%

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

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

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

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

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

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

    if -0.170000000000000012 < F < -7.9999999999999996e-126

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

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

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

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

    if -7.9999999999999996e-126 < F < 1.15000000000000004e-17

    1. Initial program 99.5%

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

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

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

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

    if 1.15000000000000004e-17 < F

    1. Initial program 58.0%

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

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

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

Alternative 7: 91.8% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -8.6 \cdot 10^{-126}:\\
\;\;\;\;\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 1.15 \cdot 10^{-17}:\\
\;\;\;\;F \cdot \left(\frac{1}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - t\_0\\

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


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

    1. Initial program 62.1%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity79.8%

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

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

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

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

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

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

    if -0.17999999999999999 < F < -8.60000000000000065e-126

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

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

    if -8.60000000000000065e-126 < F < 1.15000000000000004e-17

    1. Initial program 99.5%

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

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

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

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

    if 1.15000000000000004e-17 < F

    1. Initial program 58.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.18:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -8.6 \cdot 10^{-126}:\\ \;\;\;\;\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 1.15 \cdot 10^{-17}:\\ \;\;\;\;F \cdot \left(\frac{1}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 88.2% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -5.5 \cdot 10^{-126}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 62.1%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity79.8%

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

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

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

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

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

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

    if -0.0359999999999999973 < F < -5.49999999999999987e-126 or 7.6000000000000001e-103 < F < 165000

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

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

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

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

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

    if -5.49999999999999987e-126 < F < 7.6000000000000001e-103

    1. Initial program 99.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified81.7%

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub082.0%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr82.0%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub082.0%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac82.0%

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

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

    if 165000 < F

    1. Initial program 56.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.036:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -5.5 \cdot 10^{-126}:\\ \;\;\;\;F \cdot \left(\frac{\sqrt{0.5}}{\sin B} - \frac{x}{F \cdot B}\right)\\ \mathbf{elif}\;F \leq 7.6 \cdot 10^{-103}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{elif}\;F \leq 165000:\\ \;\;\;\;F \cdot \left(\frac{\sqrt{0.5}}{\sin B} - \frac{x}{F \cdot B}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 91.1% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 63.1%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity80.4%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine80.4%

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

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

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

    if -0.00379999999999999999 < F < 1.15000000000000004e-17

    1. Initial program 99.5%

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

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

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

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

    if 1.15000000000000004e-17 < F

    1. Initial program 58.0%

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

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

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

Alternative 10: 84.4% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -3.3 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.3 \cdot 10^{-126}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 1.55 \cdot 10^{-105}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -3.3e-15)
   (- (/ -1.0 (sin B)) (/ x (tan B)))
   (if (<= F -1.3e-126)
     (/ (* F (sqrt 0.5)) (sin B))
     (if (<= F 1.55e-105)
       (/ (- x) (tan B))
       (+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.3e-15) {
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	} else if (F <= -1.3e-126) {
		tmp = (F * sqrt(0.5)) / sin(B);
	} else if (F <= 1.55e-105) {
		tmp = -x / tan(B);
	} else {
		tmp = (x * (-1.0 / tan(B))) + (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.3d-15)) then
        tmp = ((-1.0d0) / sin(b)) - (x / tan(b))
    else if (f <= (-1.3d-126)) then
        tmp = (f * sqrt(0.5d0)) / sin(b)
    else if (f <= 1.55d-105) then
        tmp = -x / tan(b)
    else
        tmp = (x * ((-1.0d0) / tan(b))) + (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.3e-15) {
		tmp = (-1.0 / Math.sin(B)) - (x / Math.tan(B));
	} else if (F <= -1.3e-126) {
		tmp = (F * Math.sqrt(0.5)) / Math.sin(B);
	} else if (F <= 1.55e-105) {
		tmp = -x / Math.tan(B);
	} else {
		tmp = (x * (-1.0 / Math.tan(B))) + (1.0 / Math.sin(B));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -3.3e-15:
		tmp = (-1.0 / math.sin(B)) - (x / math.tan(B))
	elif F <= -1.3e-126:
		tmp = (F * math.sqrt(0.5)) / math.sin(B)
	elif F <= 1.55e-105:
		tmp = -x / math.tan(B)
	else:
		tmp = (x * (-1.0 / math.tan(B))) + (1.0 / math.sin(B))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -3.3e-15)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B)));
	elseif (F <= -1.3e-126)
		tmp = Float64(Float64(F * sqrt(0.5)) / sin(B));
	elseif (F <= 1.55e-105)
		tmp = Float64(Float64(-x) / tan(B));
	else
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B)));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -3.3e-15)
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	elseif (F <= -1.3e-126)
		tmp = (F * sqrt(0.5)) / sin(B);
	elseif (F <= 1.55e-105)
		tmp = -x / tan(B);
	else
		tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -3.3e-15], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.3e-126], N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.55e-105], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

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

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


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

    1. Initial program 63.6%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity80.6%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine80.6%

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

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

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

    if -3.3e-15 < F < -1.3e-126

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

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

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

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

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

    if -1.3e-126 < F < 1.55000000000000007e-105

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub082.9%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr82.9%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub082.9%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac82.9%

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

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

    if 1.55000000000000007e-105 < F

    1. Initial program 65.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.3 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.3 \cdot 10^{-126}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 1.55 \cdot 10^{-105}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 78.2% accurate, 1.5× speedup?

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

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

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

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

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


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

    1. Initial program 63.6%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity80.6%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine80.6%

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

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

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

    if -3.7999999999999998e-11 < F < -4.50000000000000025e-126

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

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

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

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

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

    if -4.50000000000000025e-126 < F < 2.65e17

    1. Initial program 99.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified74.4%

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub074.8%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr74.8%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub074.8%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac74.8%

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

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

    if 2.65e17 < F

    1. Initial program 54.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. Add Preprocessing
    3. Taylor expanded in B around 0 34.7%

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

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

Alternative 12: 71.1% accurate, 1.5× speedup?

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

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

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

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

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


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

    1. Initial program 63.6%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity80.6%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine80.6%

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

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

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

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

    if -4.19999999999999977e-13 < F < -8.2000000000000004e-131

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

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

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

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

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

    if -8.2000000000000004e-131 < F < 2.65e17

    1. Initial program 99.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified74.4%

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub074.8%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr74.8%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub074.8%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac74.8%

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

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

    if 2.65e17 < F

    1. Initial program 54.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. Add Preprocessing
    3. Taylor expanded in B around 0 34.7%

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

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

Alternative 13: 71.1% accurate, 1.5× speedup?

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

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

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

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

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


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

    1. Initial program 63.6%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity80.6%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine80.6%

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

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

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

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

    if -1.24999999999999992e-12 < F < -3.5e-126

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

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

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

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

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

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

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

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

    if -3.5e-126 < F < 2.65e17

    1. Initial program 99.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified74.4%

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub074.8%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr74.8%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub074.8%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac74.8%

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

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

    if 2.65e17 < F

    1. Initial program 54.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. Add Preprocessing
    3. Taylor expanded in B around 0 34.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.25 \cdot 10^{-12}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -3.5 \cdot 10^{-126}:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{0.5}\\ \mathbf{elif}\;F \leq 2.65 \cdot 10^{+17}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 71.1% accurate, 2.6× speedup?

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

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

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

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

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


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

    1. Initial program 62.1%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity79.8%

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

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

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

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

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

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

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

    if -0.0210000000000000013 < F < -8.0000000000000005e-133

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

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

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

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

    if -8.0000000000000005e-133 < F < 2.65e17

    1. Initial program 99.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified74.4%

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub074.8%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr74.8%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub074.8%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac74.8%

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

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

    if 2.65e17 < F

    1. Initial program 54.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. Add Preprocessing
    3. Taylor expanded in B around 0 34.7%

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

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

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

Alternative 15: 60.7% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1.5 \cdot 10^{-160}:\\ \;\;\;\;\frac{-1}{B} - t\_0\\ \mathbf{elif}\;F \leq 1.9 \cdot 10^{+65} \lor \neg \left(F \leq 1.15 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;t\_0 + \frac{1}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1.5e-160)
     (- (/ -1.0 B) t_0)
     (if (or (<= F 1.9e+65) (not (<= F 1.15e+120)))
       (/ (- x) (tan B))
       (+ t_0 (/ 1.0 B))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1.5e-160) {
		tmp = (-1.0 / B) - t_0;
	} else if ((F <= 1.9e+65) || !(F <= 1.15e+120)) {
		tmp = -x / tan(B);
	} else {
		tmp = t_0 + (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) :: t_0
    real(8) :: tmp
    t_0 = x / tan(b)
    if (f <= (-1.5d-160)) then
        tmp = ((-1.0d0) / b) - t_0
    else if ((f <= 1.9d+65) .or. (.not. (f <= 1.15d+120))) then
        tmp = -x / tan(b)
    else
        tmp = t_0 + (1.0d0 / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x / Math.tan(B);
	double tmp;
	if (F <= -1.5e-160) {
		tmp = (-1.0 / B) - t_0;
	} else if ((F <= 1.9e+65) || !(F <= 1.15e+120)) {
		tmp = -x / Math.tan(B);
	} else {
		tmp = t_0 + (1.0 / B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -1.5e-160:
		tmp = (-1.0 / B) - t_0
	elif (F <= 1.9e+65) or not (F <= 1.15e+120):
		tmp = -x / math.tan(B)
	else:
		tmp = t_0 + (1.0 / B)
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1.5e-160)
		tmp = Float64(Float64(-1.0 / B) - t_0);
	elseif ((F <= 1.9e+65) || !(F <= 1.15e+120))
		tmp = Float64(Float64(-x) / tan(B));
	else
		tmp = Float64(t_0 + Float64(1.0 / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= -1.5e-160)
		tmp = (-1.0 / B) - t_0;
	elseif ((F <= 1.9e+65) || ~((F <= 1.15e+120)))
		tmp = -x / tan(B);
	else
		tmp = t_0 + (1.0 / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.5e-160], N[(N[(-1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], If[Or[LessEqual[F, 1.9e+65], N[Not[LessEqual[F, 1.15e+120]], $MachinePrecision]], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq 1.9 \cdot 10^{+65} \lor \neg \left(F \leq 1.15 \cdot 10^{+120}\right):\\
\;\;\;\;\frac{-x}{\tan B}\\

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


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

    1. Initial program 72.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. Simplified85.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 x around 0 85.2%

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity85.2%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine85.2%

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

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

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

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

    if -1.49999999999999998e-160 < F < 1.90000000000000006e65 or 1.14999999999999996e120 < F

    1. Initial program 81.4%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified67.9%

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub068.2%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr68.2%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub068.2%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac68.2%

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

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

    if 1.90000000000000006e65 < F < 1.14999999999999996e120

    1. Initial program 72.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{1}{B}, -x \cdot \frac{1}{\tan B}\right)} \]
      4. add-sqr-sqrt9.1%

        \[\leadsto \mathsf{fma}\left(-1, \color{blue}{\sqrt{\frac{1}{B}} \cdot \sqrt{\frac{1}{B}}}, -x \cdot \frac{1}{\tan B}\right) \]
      5. sqrt-unprod26.7%

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

        \[\leadsto \mathsf{fma}\left(-1, \sqrt{\color{blue}{\frac{1 \cdot 1}{B \cdot B}}}, -x \cdot \frac{1}{\tan B}\right) \]
      7. metadata-eval26.7%

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

        \[\leadsto \mathsf{fma}\left(-1, \sqrt{\frac{\color{blue}{-1 \cdot -1}}{B \cdot B}}, -x \cdot \frac{1}{\tan B}\right) \]
      9. frac-times26.7%

        \[\leadsto \mathsf{fma}\left(-1, \sqrt{\color{blue}{\frac{-1}{B} \cdot \frac{-1}{B}}}, -x \cdot \frac{1}{\tan B}\right) \]
      10. sqrt-unprod38.8%

        \[\leadsto \mathsf{fma}\left(-1, \color{blue}{\sqrt{\frac{-1}{B}} \cdot \sqrt{\frac{-1}{B}}}, -x \cdot \frac{1}{\tan B}\right) \]
      11. add-sqr-sqrt63.5%

        \[\leadsto \mathsf{fma}\left(-1, \color{blue}{\frac{-1}{B}}, -x \cdot \frac{1}{\tan B}\right) \]
      12. add-sqr-sqrt24.1%

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{-1}{B}, \color{blue}{\sqrt{\left(-x \cdot \frac{1}{\tan B}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}}\right) \]
      14. div-inv34.3%

        \[\leadsto \mathsf{fma}\left(-1, \frac{-1}{B}, \sqrt{\left(-\color{blue}{\frac{x}{\tan B}}\right) \cdot \left(-x \cdot \frac{1}{\tan B}\right)}\right) \]
      15. div-inv34.3%

        \[\leadsto \mathsf{fma}\left(-1, \frac{-1}{B}, \sqrt{\left(-\frac{x}{\tan B}\right) \cdot \left(-\color{blue}{\frac{x}{\tan B}}\right)}\right) \]
      16. sqr-neg34.3%

        \[\leadsto \mathsf{fma}\left(-1, \frac{-1}{B}, \sqrt{\color{blue}{\frac{x}{\tan B} \cdot \frac{x}{\tan B}}}\right) \]
      17. sqrt-unprod23.8%

        \[\leadsto \mathsf{fma}\left(-1, \frac{-1}{B}, \color{blue}{\sqrt{\frac{x}{\tan B}} \cdot \sqrt{\frac{x}{\tan B}}}\right) \]
      18. add-sqr-sqrt47.8%

        \[\leadsto \mathsf{fma}\left(-1, \frac{-1}{B}, \color{blue}{\frac{x}{\tan B}}\right) \]
    6. Applied egg-rr47.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-1, \frac{-1}{B}, \frac{x}{\tan B}\right)} \]
    7. Step-by-step derivation
      1. fma-undefine47.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{-1}{B} + \frac{x}{\tan B}} \]
      2. associate-*r/47.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot -1}{B}} + \frac{x}{\tan B} \]
      3. metadata-eval47.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.5 \cdot 10^{-160}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.9 \cdot 10^{+65} \lor \neg \left(F \leq 1.15 \cdot 10^{+120}\right):\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\tan B} + \frac{1}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 69.9% accurate, 2.8× speedup?

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

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

\mathbf{elif}\;F \leq 2.65 \cdot 10^{+17}:\\
\;\;\;\;\frac{-x}{\tan 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.49999999999999998e-160

    1. Initial program 72.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. Simplified85.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 x around 0 85.2%

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

        \[\leadsto F \cdot \color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} - \frac{x}{\tan B} \]
      2. *-lft-identity85.2%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} - \frac{x}{\tan B} \]
      5. fma-undefine85.2%

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

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

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

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

    if -1.49999999999999998e-160 < F < 2.65e17

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub075.4%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr75.4%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub075.4%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac75.4%

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

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

    if 2.65e17 < F

    1. Initial program 54.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. Add Preprocessing
    3. Taylor expanded in B around 0 34.7%

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

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

Alternative 17: 43.4% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B \leq 9.5 \cdot 10^{-129}:\\
\;\;\;\;\frac{-1 - x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 9.5000000000000006e-129

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

    if 9.5000000000000006e-129 < B

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{x}{\tan B}} \]
      5. neg-sub064.2%

        \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    8. Applied egg-rr64.2%

      \[\leadsto \color{blue}{0 - \frac{x}{\tan B}} \]
    9. Step-by-step derivation
      1. neg-sub064.2%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      2. distribute-neg-frac64.2%

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

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

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

Alternative 18: 30.4% accurate, 23.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.0000000000000004e-192 or 2.1499999999999998e-62 < x

    1. Initial program 79.8%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    6. Simplified40.3%

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

    if -4.0000000000000004e-192 < x < 2.1499999999999998e-62

    1. Initial program 71.6%

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

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

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

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

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

Alternative 19: 35.5% accurate, 32.3× speedup?

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

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

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


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

    1. Initial program 72.2%

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

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

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

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

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

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

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

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

    if -1.49999999999999998e-160 < F

    1. Initial program 80.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 51.0%

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    6. Simplified34.0%

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

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

Alternative 20: 10.9% 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 77.3%

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

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

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

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

Reproduce

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