VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.1% → 99.7%
Time: 25.0s
Alternatives: 27
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 27 alternatives:

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

Initial Program: 77.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.6× speedup?

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

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

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

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


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

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

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

      \[\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/71.4%

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

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

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

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

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

      \[\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/71.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1e7 < F < 9.9999999999999997e106

    1. Initial program 97.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.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

    if 9.9999999999999997e106 < F

    1. Initial program 38.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. Simplified67.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 67.1%

      \[\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/67.1%

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

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

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified67.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.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -10000000:\\ \;\;\;\;\frac{\frac{1}{{F}^{2}} + -1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 10^{+107}:\\ \;\;\;\;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}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.7% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;F \leq 155000000:\\
\;\;\;\;F \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B} - t\_0\\

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


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

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

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

      \[\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/71.4%

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

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

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

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

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

      \[\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/71.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1e7 < F < 1.55e8

    1. Initial program 99.4%

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

    if 1.55e8 < F

    1. Initial program 54.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. Simplified78.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 78.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/78.0%

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

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

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

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

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

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

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

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

Alternative 3: 99.7% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 38.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. Simplified58.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 58.1%

      \[\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/58.1%

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

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

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified58.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.8%

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

    if -1.0000000000000001e130 < F < 9.9999999999999997e106

    1. Initial program 95.6%

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999997e106 < F

    1. Initial program 38.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. Simplified67.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 67.1%

      \[\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/67.1%

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

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

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified67.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.8%

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

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

Alternative 4: 99.6% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;F \leq 2000:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B} - t\_0\\

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


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

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

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

      \[\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/71.4%

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

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

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

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

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

      \[\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/71.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1e7 < F < 2e3

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{F \cdot \color{blue}{\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    13. Step-by-step derivation
      1. un-div-inv99.6%

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

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

    if 2e3 < F

    1. Initial program 54.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. Simplified78.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 78.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/78.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -10000000:\\ \;\;\;\;\frac{\frac{1}{{F}^{2}} + -1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2000:\\ \;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 54.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. Simplified72.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 72.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/72.3%

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

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

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

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

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

      \[\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/72.4%

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

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

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

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

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

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

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

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

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

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

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

    if -12000 < F < 4.1e7

    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 4.1e7 < F

    1. Initial program 54.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. Simplified78.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 78.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/78.0%

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

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

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

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

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

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

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

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

Alternative 6: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

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

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

      \[\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/71.8%

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

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

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

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

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

      \[\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/72.0%

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

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

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

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

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

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

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

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

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

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

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

    if -55000 < F < 1e8

    1. Initial program 99.4%

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

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

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

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

    if 1e8 < F

    1. Initial program 54.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. Simplified78.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 78.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/78.0%

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

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

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

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

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

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

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

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

Alternative 7: 99.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 54.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. Simplified72.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 72.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/72.7%

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

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

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified72.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.1%

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

    if -1.3999999999999999 < F < 0.044999999999999998

    1. Initial program 99.4%

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

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

    if 0.044999999999999998 < F

    1. Initial program 57.2%

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

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

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

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified79.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 97.2%

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

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

Alternative 8: 99.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 54.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. Simplified72.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 72.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/72.7%

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

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

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

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

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

      \[\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/72.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999 < F < 0.044999999999999998

    1. Initial program 99.4%

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

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

    if 0.044999999999999998 < F

    1. Initial program 57.2%

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

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

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

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified79.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 97.2%

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

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

Alternative 9: 89.8% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -4 \cdot 10^{-123}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 54.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. Simplified72.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 72.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/72.3%

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

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

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

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

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

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

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

    if -15500 < F < -4.0000000000000002e-123 or 9.4999999999999995e-111 < F < 8.9e5

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

      \[\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 -4.0000000000000002e-123 < F < 9.4999999999999995e-111

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

      \[\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. associate-*r/88.2%

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

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

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

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

    if 8.9e5 < F

    1. Initial program 54.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. Simplified78.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 78.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/78.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -15500:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -4 \cdot 10^{-123}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 9.5 \cdot 10^{-111}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 890000:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 89.7% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -3.9 \cdot 10^{-121}:\\
\;\;\;\;t\_0 \cdot \left(F \cdot t\_2\right) - \frac{x}{B}\\

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

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

\mathbf{else}:\\
\;\;\;\;t\_2 - t\_1\\


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

    1. Initial program 54.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. Simplified72.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 72.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/72.3%

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

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

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

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

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

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

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

    if -8200 < F < -3.9e-121

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

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

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

      \[\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 -3.9e-121 < F < 2.2e-111

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

      \[\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. associate-*r/88.2%

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

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

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

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

    if 2.2e-111 < F < 22500

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

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

    if 22500 < F

    1. Initial program 54.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. Simplified78.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 78.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/78.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -8200:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -3.9 \cdot 10^{-121}:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} \cdot \left(F \cdot \frac{1}{\sin B}\right) - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.2 \cdot 10^{-111}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 22500:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 89.5% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -1.4 \cdot 10^{-119}:\\
\;\;\;\;t\_0\\

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

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

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


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

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 73.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/73.5%

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

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

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

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

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

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

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

    if -0.0058 < F < -1.4e-119 or 2.90000000000000002e-111 < F < 0.0030000000000000001

    1. Initial program 99.3%

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

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

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

    if -1.4e-119 < F < 2.90000000000000002e-111

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

      \[\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. associate-*r/88.2%

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

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

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

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

    if 0.0030000000000000001 < F

    1. Initial program 57.2%

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

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

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

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified79.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 97.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.0058:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.4 \cdot 10^{-119}:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.9 \cdot 10^{-111}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.003:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 72.9% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -18000000:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -15600:\\
\;\;\;\;F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq -4 \cdot 10^{-120}:\\
\;\;\;\;t\_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if F < -2.7999999999999999e132

    1. Initial program 39.6%

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

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

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

    if -2.7999999999999999e132 < F < -1.8e7

    1. Initial program 77.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 72.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Simplified94.2%

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

    if -1.8e7 < F < -15600

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 100.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/100.0%

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

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

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

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

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

      \[\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 100.0%

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

      \[\leadsto F \cdot \color{blue}{\frac{-1}{B \cdot F}} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. *-commutative100.0%

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

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

    if -15600 < F < -3.99999999999999991e-120 or 2.90000000000000005e-67 < F < 0.044999999999999998

    1. Initial program 99.3%

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

      \[\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 B around 0 53.3%

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

    if -3.99999999999999991e-120 < F < 2.90000000000000005e-67

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

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

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

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

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

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

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

    if 0.044999999999999998 < F

    1. Initial program 57.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 B around 0 37.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 inf 77.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.8 \cdot 10^{+132}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -18000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -15600:\\ \;\;\;\;F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -4 \cdot 10^{-120}:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 2.9 \cdot 10^{-67}:\\ \;\;\;\;x \cdot \frac{\cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 0.045:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 72.9% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -4700000:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -6700:\\
\;\;\;\;F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq -5.3 \cdot 10^{-120}:\\
\;\;\;\;t\_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if F < -4.99999999999999995e131

    1. Initial program 39.6%

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

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

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

    if -4.99999999999999995e131 < F < -4.7e6

    1. Initial program 77.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 72.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Simplified94.2%

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

    if -4.7e6 < F < -6700

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 100.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/100.0%

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

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

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

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

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

      \[\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 100.0%

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

      \[\leadsto F \cdot \color{blue}{\frac{-1}{B \cdot F}} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. *-commutative100.0%

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

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

    if -6700 < F < -5.29999999999999997e-120 or 1.7499999999999999e-47 < F < 0.035000000000000003

    1. Initial program 99.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0 89.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 B around 0 52.4%

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

    if -5.29999999999999997e-120 < F < 1.7499999999999999e-47

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

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

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

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

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

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

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

    if 0.035000000000000003 < F

    1. Initial program 57.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 B around 0 37.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 inf 77.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5 \cdot 10^{+131}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -4700000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -6700:\\ \;\;\;\;F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -5.3 \cdot 10^{-120}:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.75 \cdot 10^{-47}:\\ \;\;\;\;\frac{x \cdot \left(-\cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 0.035:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 85.4% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -5.3 \cdot 10^{-120}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 54.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. Simplified72.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 72.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/72.3%

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

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

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

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

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

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

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

    if -6e3 < F < -5.29999999999999997e-120 or 1.2e-47 < F < 0.0122000000000000008

    1. Initial program 99.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0 89.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 B around 0 52.4%

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

    if -5.29999999999999997e-120 < F < 1.2e-47

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

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

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

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

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

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

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

    if 0.0122000000000000008 < F

    1. Initial program 57.2%

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

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

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

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} - \frac{x}{\tan B} \]
    6. Simplified79.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 97.2%

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

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

Alternative 15: 79.0% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -1 \cdot 10^{-119}:\\
\;\;\;\;t\_0\\

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

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

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


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

    1. Initial program 54.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. Simplified72.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 72.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/72.3%

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

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

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

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

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

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

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

    if -6e3 < F < -1.00000000000000001e-119 or 3.9999999999999999e-48 < F < 0.044999999999999998

    1. Initial program 99.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0 89.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 B around 0 52.4%

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

    if -1.00000000000000001e-119 < F < 3.9999999999999999e-48

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

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

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

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

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

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

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

    if 0.044999999999999998 < F

    1. Initial program 57.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 B around 0 37.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 inf 77.5%

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

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

Alternative 16: 64.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ t_1 := x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ t_2 := F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -8.5 \cdot 10^{+131}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;F \leq -12000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -8000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;F \leq -1.7 \cdot 10^{-136}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq -2.5 \cdot 10^{-256}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;F \leq 4.9 \cdot 10^{-287}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 9.8 \cdot 10^{-71}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;F \leq 0.045:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (* (pow (+ (+ 2.0 (* F F)) (* 2.0 x)) -0.5) (/ F B)) (/ x B)))
        (t_1 (+ (* x (/ -1.0 (tan B))) (/ -1.0 B)))
        (t_2 (- (* F (/ -1.0 (* F B))) (/ x (tan B)))))
   (if (<= F -8.5e+131)
     t_1
     (if (<= F -12000000.0)
       (- (/ -1.0 (sin B)) (/ x B))
       (if (<= F -8000.0)
         t_2
         (if (<= F -1.7e-136)
           t_0
           (if (<= F -2.5e-256)
             t_2
             (if (<= F 4.9e-287)
               (/ x (- B))
               (if (<= F 9.8e-71)
                 t_1
                 (if (<= F 0.045) t_0 (- (/ 1.0 (sin B)) (/ x B))))))))))))
double code(double F, double B, double x) {
	double t_0 = (pow(((2.0 + (F * F)) + (2.0 * x)), -0.5) * (F / B)) - (x / B);
	double t_1 = (x * (-1.0 / tan(B))) + (-1.0 / B);
	double t_2 = (F * (-1.0 / (F * B))) - (x / tan(B));
	double tmp;
	if (F <= -8.5e+131) {
		tmp = t_1;
	} else if (F <= -12000000.0) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= -8000.0) {
		tmp = t_2;
	} else if (F <= -1.7e-136) {
		tmp = t_0;
	} else if (F <= -2.5e-256) {
		tmp = t_2;
	} else if (F <= 4.9e-287) {
		tmp = x / -B;
	} else if (F <= 9.8e-71) {
		tmp = t_1;
	} else if (F <= 0.045) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = ((((2.0d0 + (f * f)) + (2.0d0 * x)) ** (-0.5d0)) * (f / b)) - (x / b)
    t_1 = (x * ((-1.0d0) / tan(b))) + ((-1.0d0) / b)
    t_2 = (f * ((-1.0d0) / (f * b))) - (x / tan(b))
    if (f <= (-8.5d+131)) then
        tmp = t_1
    else if (f <= (-12000000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= (-8000.0d0)) then
        tmp = t_2
    else if (f <= (-1.7d-136)) then
        tmp = t_0
    else if (f <= (-2.5d-256)) then
        tmp = t_2
    else if (f <= 4.9d-287) then
        tmp = x / -b
    else if (f <= 9.8d-71) then
        tmp = t_1
    else if (f <= 0.045d0) then
        tmp = t_0
    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 t_0 = (Math.pow(((2.0 + (F * F)) + (2.0 * x)), -0.5) * (F / B)) - (x / B);
	double t_1 = (x * (-1.0 / Math.tan(B))) + (-1.0 / B);
	double t_2 = (F * (-1.0 / (F * B))) - (x / Math.tan(B));
	double tmp;
	if (F <= -8.5e+131) {
		tmp = t_1;
	} else if (F <= -12000000.0) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= -8000.0) {
		tmp = t_2;
	} else if (F <= -1.7e-136) {
		tmp = t_0;
	} else if (F <= -2.5e-256) {
		tmp = t_2;
	} else if (F <= 4.9e-287) {
		tmp = x / -B;
	} else if (F <= 9.8e-71) {
		tmp = t_1;
	} else if (F <= 0.045) {
		tmp = t_0;
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (math.pow(((2.0 + (F * F)) + (2.0 * x)), -0.5) * (F / B)) - (x / B)
	t_1 = (x * (-1.0 / math.tan(B))) + (-1.0 / B)
	t_2 = (F * (-1.0 / (F * B))) - (x / math.tan(B))
	tmp = 0
	if F <= -8.5e+131:
		tmp = t_1
	elif F <= -12000000.0:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= -8000.0:
		tmp = t_2
	elif F <= -1.7e-136:
		tmp = t_0
	elif F <= -2.5e-256:
		tmp = t_2
	elif F <= 4.9e-287:
		tmp = x / -B
	elif F <= 9.8e-71:
		tmp = t_1
	elif F <= 0.045:
		tmp = t_0
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64((Float64(Float64(2.0 + Float64(F * F)) + Float64(2.0 * x)) ^ -0.5) * Float64(F / B)) - Float64(x / B))
	t_1 = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B))
	t_2 = Float64(Float64(F * Float64(-1.0 / Float64(F * B))) - Float64(x / tan(B)))
	tmp = 0.0
	if (F <= -8.5e+131)
		tmp = t_1;
	elseif (F <= -12000000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= -8000.0)
		tmp = t_2;
	elseif (F <= -1.7e-136)
		tmp = t_0;
	elseif (F <= -2.5e-256)
		tmp = t_2;
	elseif (F <= 4.9e-287)
		tmp = Float64(x / Float64(-B));
	elseif (F <= 9.8e-71)
		tmp = t_1;
	elseif (F <= 0.045)
		tmp = t_0;
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = ((((2.0 + (F * F)) + (2.0 * x)) ^ -0.5) * (F / B)) - (x / B);
	t_1 = (x * (-1.0 / tan(B))) + (-1.0 / B);
	t_2 = (F * (-1.0 / (F * B))) - (x / tan(B));
	tmp = 0.0;
	if (F <= -8.5e+131)
		tmp = t_1;
	elseif (F <= -12000000.0)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= -8000.0)
		tmp = t_2;
	elseif (F <= -1.7e-136)
		tmp = t_0;
	elseif (F <= -2.5e-256)
		tmp = t_2;
	elseif (F <= 4.9e-287)
		tmp = x / -B;
	elseif (F <= 9.8e-71)
		tmp = t_1;
	elseif (F <= 0.045)
		tmp = t_0;
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[Power[N[(N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(F * N[(-1.0 / N[(F * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -8.5e+131], t$95$1, If[LessEqual[F, -12000000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -8000.0], t$95$2, If[LessEqual[F, -1.7e-136], t$95$0, If[LessEqual[F, -2.5e-256], t$95$2, If[LessEqual[F, 4.9e-287], N[(x / (-B)), $MachinePrecision], If[LessEqual[F, 9.8e-71], t$95$1, If[LessEqual[F, 0.045], t$95$0, N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -12000000:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -8000:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;F \leq -1.7 \cdot 10^{-136}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq -2.5 \cdot 10^{-256}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;F \leq 9.8 \cdot 10^{-71}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if F < -8.50000000000000063e131 or 4.9000000000000001e-287 < F < 9.7999999999999994e-71

    1. Initial program 66.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 72.8%

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

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

    if -8.50000000000000063e131 < F < -1.2e7

    1. Initial program 77.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 72.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Simplified94.2%

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

    if -1.2e7 < F < -8e3 or -1.7e-136 < F < -2.5e-256

    1. Initial program 99.3%

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

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

      \[\leadsto F \cdot \color{blue}{\frac{-1}{B \cdot F}} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. *-commutative64.8%

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

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

    if -8e3 < F < -1.7e-136 or 9.7999999999999994e-71 < F < 0.044999999999999998

    1. Initial program 99.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0 88.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. Taylor expanded in B around 0 53.2%

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

    if -2.5e-256 < F < 4.9000000000000001e-287

    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 B around 0 71.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 71.9%

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    6. Simplified71.9%

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

    if 0.044999999999999998 < F

    1. Initial program 57.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 B around 0 37.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 inf 77.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -8.5 \cdot 10^{+131}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -12000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -8000:\\ \;\;\;\;F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.7 \cdot 10^{-136}:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -2.5 \cdot 10^{-256}:\\ \;\;\;\;F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.9 \cdot 10^{-287}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 9.8 \cdot 10^{-71}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq 0.045:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 64.5% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{1}{2 + 2 \cdot x}} \cdot \frac{F}{B} - \frac{x}{B}\\ t_1 := x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ t_2 := F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -6.9 \cdot 10^{+131}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;F \leq -10200000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.02 \cdot 10^{-5}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;F \leq -1.65 \cdot 10^{-136}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq -1.45 \cdot 10^{-262}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;F \leq 8 \cdot 10^{-287}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-59}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;F \leq 0.04:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (* (sqrt (/ 1.0 (+ 2.0 (* 2.0 x)))) (/ F B)) (/ x B)))
        (t_1 (+ (* x (/ -1.0 (tan B))) (/ -1.0 B)))
        (t_2 (- (* F (/ -1.0 (* F B))) (/ x (tan B)))))
   (if (<= F -6.9e+131)
     t_1
     (if (<= F -10200000.0)
       (- (/ -1.0 (sin B)) (/ x B))
       (if (<= F -1.02e-5)
         t_2
         (if (<= F -1.65e-136)
           t_0
           (if (<= F -1.45e-262)
             t_2
             (if (<= F 8e-287)
               (/ x (- B))
               (if (<= F 5e-59)
                 t_1
                 (if (<= F 0.04) t_0 (- (/ 1.0 (sin B)) (/ x B))))))))))))
double code(double F, double B, double x) {
	double t_0 = (sqrt((1.0 / (2.0 + (2.0 * x)))) * (F / B)) - (x / B);
	double t_1 = (x * (-1.0 / tan(B))) + (-1.0 / B);
	double t_2 = (F * (-1.0 / (F * B))) - (x / tan(B));
	double tmp;
	if (F <= -6.9e+131) {
		tmp = t_1;
	} else if (F <= -10200000.0) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= -1.02e-5) {
		tmp = t_2;
	} else if (F <= -1.65e-136) {
		tmp = t_0;
	} else if (F <= -1.45e-262) {
		tmp = t_2;
	} else if (F <= 8e-287) {
		tmp = x / -B;
	} else if (F <= 5e-59) {
		tmp = t_1;
	} else if (F <= 0.04) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (sqrt((1.0d0 / (2.0d0 + (2.0d0 * x)))) * (f / b)) - (x / b)
    t_1 = (x * ((-1.0d0) / tan(b))) + ((-1.0d0) / b)
    t_2 = (f * ((-1.0d0) / (f * b))) - (x / tan(b))
    if (f <= (-6.9d+131)) then
        tmp = t_1
    else if (f <= (-10200000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= (-1.02d-5)) then
        tmp = t_2
    else if (f <= (-1.65d-136)) then
        tmp = t_0
    else if (f <= (-1.45d-262)) then
        tmp = t_2
    else if (f <= 8d-287) then
        tmp = x / -b
    else if (f <= 5d-59) then
        tmp = t_1
    else if (f <= 0.04d0) then
        tmp = t_0
    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 t_0 = (Math.sqrt((1.0 / (2.0 + (2.0 * x)))) * (F / B)) - (x / B);
	double t_1 = (x * (-1.0 / Math.tan(B))) + (-1.0 / B);
	double t_2 = (F * (-1.0 / (F * B))) - (x / Math.tan(B));
	double tmp;
	if (F <= -6.9e+131) {
		tmp = t_1;
	} else if (F <= -10200000.0) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= -1.02e-5) {
		tmp = t_2;
	} else if (F <= -1.65e-136) {
		tmp = t_0;
	} else if (F <= -1.45e-262) {
		tmp = t_2;
	} else if (F <= 8e-287) {
		tmp = x / -B;
	} else if (F <= 5e-59) {
		tmp = t_1;
	} else if (F <= 0.04) {
		tmp = t_0;
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (math.sqrt((1.0 / (2.0 + (2.0 * x)))) * (F / B)) - (x / B)
	t_1 = (x * (-1.0 / math.tan(B))) + (-1.0 / B)
	t_2 = (F * (-1.0 / (F * B))) - (x / math.tan(B))
	tmp = 0
	if F <= -6.9e+131:
		tmp = t_1
	elif F <= -10200000.0:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= -1.02e-5:
		tmp = t_2
	elif F <= -1.65e-136:
		tmp = t_0
	elif F <= -1.45e-262:
		tmp = t_2
	elif F <= 8e-287:
		tmp = x / -B
	elif F <= 5e-59:
		tmp = t_1
	elif F <= 0.04:
		tmp = t_0
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(sqrt(Float64(1.0 / Float64(2.0 + Float64(2.0 * x)))) * Float64(F / B)) - Float64(x / B))
	t_1 = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B))
	t_2 = Float64(Float64(F * Float64(-1.0 / Float64(F * B))) - Float64(x / tan(B)))
	tmp = 0.0
	if (F <= -6.9e+131)
		tmp = t_1;
	elseif (F <= -10200000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= -1.02e-5)
		tmp = t_2;
	elseif (F <= -1.65e-136)
		tmp = t_0;
	elseif (F <= -1.45e-262)
		tmp = t_2;
	elseif (F <= 8e-287)
		tmp = Float64(x / Float64(-B));
	elseif (F <= 5e-59)
		tmp = t_1;
	elseif (F <= 0.04)
		tmp = t_0;
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = (sqrt((1.0 / (2.0 + (2.0 * x)))) * (F / B)) - (x / B);
	t_1 = (x * (-1.0 / tan(B))) + (-1.0 / B);
	t_2 = (F * (-1.0 / (F * B))) - (x / tan(B));
	tmp = 0.0;
	if (F <= -6.9e+131)
		tmp = t_1;
	elseif (F <= -10200000.0)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= -1.02e-5)
		tmp = t_2;
	elseif (F <= -1.65e-136)
		tmp = t_0;
	elseif (F <= -1.45e-262)
		tmp = t_2;
	elseif (F <= 8e-287)
		tmp = x / -B;
	elseif (F <= 5e-59)
		tmp = t_1;
	elseif (F <= 0.04)
		tmp = t_0;
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(1.0 / N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(F * N[(-1.0 / N[(F * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -6.9e+131], t$95$1, If[LessEqual[F, -10200000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.02e-5], t$95$2, If[LessEqual[F, -1.65e-136], t$95$0, If[LessEqual[F, -1.45e-262], t$95$2, If[LessEqual[F, 8e-287], N[(x / (-B)), $MachinePrecision], If[LessEqual[F, 5e-59], t$95$1, If[LessEqual[F, 0.04], t$95$0, N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -10200000:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -1.02 \cdot 10^{-5}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;F \leq -1.45 \cdot 10^{-262}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;F \leq 5 \cdot 10^{-59}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if F < -6.9000000000000001e131 or 8.00000000000000017e-287 < F < 5.0000000000000001e-59

    1. Initial program 66.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 72.8%

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

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

    if -6.9000000000000001e131 < F < -1.02e7

    1. Initial program 77.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 72.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Simplified94.2%

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

    if -1.02e7 < F < -1.0200000000000001e-5 or -1.65000000000000009e-136 < F < -1.44999999999999998e-262

    1. Initial program 99.3%

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

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in x around 0 99.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/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. Taylor expanded in F around -inf 46.7%

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

      \[\leadsto F \cdot \color{blue}{\frac{-1}{B \cdot F}} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. *-commutative61.2%

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

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

    if -1.0200000000000001e-5 < F < -1.65000000000000009e-136 or 5.0000000000000001e-59 < F < 0.0400000000000000008

    1. Initial program 99.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0 89.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 B around 0 53.4%

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

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

    if -1.44999999999999998e-262 < F < 8.00000000000000017e-287

    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 B around 0 71.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 71.9%

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    6. Simplified71.9%

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

    if 0.0400000000000000008 < F

    1. Initial program 57.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 B around 0 37.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 inf 77.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -6.9 \cdot 10^{+131}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -10200000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.02 \cdot 10^{-5}:\\ \;\;\;\;F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.65 \cdot 10^{-136}:\\ \;\;\;\;\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.45 \cdot 10^{-262}:\\ \;\;\;\;F \cdot \frac{-1}{F \cdot B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 8 \cdot 10^{-287}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-59}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq 0.04:\\ \;\;\;\;\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 62.5% accurate, 2.4× speedup?

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

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

\mathbf{elif}\;F \leq -5800000:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq -2.1 \cdot 10^{-256}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;F \leq 10^{-55}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -2.7999999999999999e132 or -5.8e6 < F < -2.10000000000000003e-256 or 3.5e-287 < F < 9.99999999999999995e-56

    1. Initial program 81.0%

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

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

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

    if -2.7999999999999999e132 < F < -5.8e6

    1. Initial program 77.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 72.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - \frac{x}{B}} \]
    6. Simplified94.2%

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

    if -2.10000000000000003e-256 < F < 3.5e-287

    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 B around 0 71.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 71.9%

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    6. Simplified71.9%

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

    if 9.99999999999999995e-56 < F

    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. Add Preprocessing
    3. Taylor expanded in B around 0 46.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. Taylor expanded in F around inf 70.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.8 \cdot 10^{+132}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -5800000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -2.1 \cdot 10^{-256}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq 3.5 \cdot 10^{-287}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 10^{-55}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 44.3% accurate, 2.7× speedup?

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

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

\mathbf{elif}\;F \leq 1.65:\\
\;\;\;\;\frac{x}{-B}\\

\mathbf{elif}\;F \leq 4.5 \cdot 10^{+160}:\\
\;\;\;\;\frac{1}{\sin B} + \frac{x}{B}\\

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


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

    1. Initial program 57.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 B around 0 32.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 B around 0 22.4%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{B} + \frac{x}{B}\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in48.1%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{B}} - \frac{x}{B} \]
      6. metadata-eval48.1%

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

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

    if -2.84999999999999986e-18 < F < 1.6499999999999999

    1. Initial program 99.5%

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

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

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

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-frac-neg30.3%

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

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

    if 1.6499999999999999 < F < 4.4999999999999998e160

    1. Initial program 76.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 66.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 F around inf 63.4%

      \[\leadsto \left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\frac{1}{F}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity63.4%

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

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

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

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

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

        \[\leadsto 1 \cdot \left(\color{blue}{\frac{x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F}\right) \]
      7. associate-*l/56.5%

        \[\leadsto 1 \cdot \left(\frac{x}{B} + \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}\right) \]
      8. pow156.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{B} + \frac{1}{\sin B}} \]
      2. +-commutative56.5%

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \frac{x}{B}} \]
    8. Simplified56.5%

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

    if 4.4999999999999998e160 < F

    1. Initial program 37.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 10.5%

      \[\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 40.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.85 \cdot 10^{-18}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.65:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 4.5 \cdot 10^{+160}:\\ \;\;\;\;\frac{1}{\sin B} + \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 51.1% accurate, 2.7× speedup?

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

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

\mathbf{elif}\;F \leq 8:\\
\;\;\;\;\frac{x}{-B}\\

\mathbf{elif}\;F \leq 2.95 \cdot 10^{+162}:\\
\;\;\;\;\frac{1}{\sin B} + \frac{x}{B}\\

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


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

    1. Initial program 59.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 35.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 67.7%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x}{B}\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg67.7%

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

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

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

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

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

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

    if -1.8500000000000002e-30 < F < 8

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0 65.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 x around inf 30.4%

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    6. Simplified30.4%

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

    if 8 < F < 2.95000000000000014e162

    1. Initial program 76.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 66.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 F around inf 63.4%

      \[\leadsto \left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\frac{1}{F}} \]
    5. Step-by-step derivation
      1. *-un-lft-identity63.4%

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

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

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

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

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

        \[\leadsto 1 \cdot \left(\color{blue}{\frac{x}{B}} + \frac{F}{\sin B} \cdot \frac{1}{F}\right) \]
      7. associate-*l/56.5%

        \[\leadsto 1 \cdot \left(\frac{x}{B} + \color{blue}{\frac{F \cdot \frac{1}{F}}{\sin B}}\right) \]
      8. pow156.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{B} + \frac{1}{\sin B}} \]
      2. +-commutative56.5%

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \frac{x}{B}} \]
    8. Simplified56.5%

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

    if 2.95000000000000014e162 < F

    1. Initial program 37.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 10.5%

      \[\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 40.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.85 \cdot 10^{-30}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 8:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 2.95 \cdot 10^{+162}:\\ \;\;\;\;\frac{1}{\sin B} + \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 58.1% accurate, 2.8× speedup?

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

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

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

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


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

    1. Initial program 59.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 35.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 67.7%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x}{B}\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg67.7%

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

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

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

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

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

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

    if -2.00000000000000008e-42 < F < 1.85999999999999997e-56

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0 61.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 30.3%

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

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-frac-neg30.3%

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

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

    if 1.85999999999999997e-56 < F

    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. Add Preprocessing
    3. Taylor expanded in B around 0 46.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. Taylor expanded in F around inf 70.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2 \cdot 10^{-42}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.86 \cdot 10^{-56}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 30.2% accurate, 12.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{-B}\\ \mathbf{if}\;x \leq -1.9 \cdot 10^{-54}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-271}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{elif}\;x \leq 3.9 \cdot 10^{-194} \lor \neg \left(x \leq 1.48 \cdot 10^{-36}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (- B))))
   (if (<= x -1.9e-54)
     t_0
     (if (<= x 4.5e-271)
       (/ -1.0 B)
       (if (or (<= x 3.9e-194) (not (<= x 1.48e-36))) t_0 (/ (+ 1.0 x) B))))))
double code(double F, double B, double x) {
	double t_0 = x / -B;
	double tmp;
	if (x <= -1.9e-54) {
		tmp = t_0;
	} else if (x <= 4.5e-271) {
		tmp = -1.0 / B;
	} else if ((x <= 3.9e-194) || !(x <= 1.48e-36)) {
		tmp = t_0;
	} else {
		tmp = (1.0 + x) / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x / -b
    if (x <= (-1.9d-54)) then
        tmp = t_0
    else if (x <= 4.5d-271) then
        tmp = (-1.0d0) / b
    else if ((x <= 3.9d-194) .or. (.not. (x <= 1.48d-36))) then
        tmp = t_0
    else
        tmp = (1.0d0 + x) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x / -B;
	double tmp;
	if (x <= -1.9e-54) {
		tmp = t_0;
	} else if (x <= 4.5e-271) {
		tmp = -1.0 / B;
	} else if ((x <= 3.9e-194) || !(x <= 1.48e-36)) {
		tmp = t_0;
	} else {
		tmp = (1.0 + x) / B;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / -B
	tmp = 0
	if x <= -1.9e-54:
		tmp = t_0
	elif x <= 4.5e-271:
		tmp = -1.0 / B
	elif (x <= 3.9e-194) or not (x <= 1.48e-36):
		tmp = t_0
	else:
		tmp = (1.0 + x) / B
	return tmp
function code(F, B, x)
	t_0 = Float64(x / Float64(-B))
	tmp = 0.0
	if (x <= -1.9e-54)
		tmp = t_0;
	elseif (x <= 4.5e-271)
		tmp = Float64(-1.0 / B);
	elseif ((x <= 3.9e-194) || !(x <= 1.48e-36))
		tmp = t_0;
	else
		tmp = Float64(Float64(1.0 + x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / -B;
	tmp = 0.0;
	if (x <= -1.9e-54)
		tmp = t_0;
	elseif (x <= 4.5e-271)
		tmp = -1.0 / B;
	elseif ((x <= 3.9e-194) || ~((x <= 1.48e-36)))
		tmp = t_0;
	else
		tmp = (1.0 + x) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / (-B)), $MachinePrecision]}, If[LessEqual[x, -1.9e-54], t$95$0, If[LessEqual[x, 4.5e-271], N[(-1.0 / B), $MachinePrecision], If[Or[LessEqual[x, 3.9e-194], N[Not[LessEqual[x, 1.48e-36]], $MachinePrecision]], t$95$0, N[(N[(1.0 + x), $MachinePrecision] / B), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x}{-B}\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq 3.9 \cdot 10^{-194} \lor \neg \left(x \leq 1.48 \cdot 10^{-36}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.9000000000000001e-54 or 4.4999999999999998e-271 < x < 3.8999999999999999e-194 or 1.48e-36 < x

    1. Initial program 80.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.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 x around inf 45.9%

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    6. Simplified45.9%

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

    if -1.9000000000000001e-54 < x < 4.4999999999999998e-271

    1. Initial program 66.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 36.4%

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

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

        \[\leadsto \color{blue}{-\frac{1 + x}{B}} \]
      2. distribute-neg-frac223.9%

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified23.9%

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

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

    if 3.8999999999999999e-194 < x < 1.48e-36

    1. Initial program 75.7%

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

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

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

        \[\leadsto \color{blue}{-\frac{1 + x}{B}} \]
      2. distribute-neg-frac213.4%

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified13.4%

      \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt10.0%

        \[\leadsto \frac{1 + x}{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}} \]
      2. sqrt-unprod11.6%

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

        \[\leadsto \frac{1 + x}{\sqrt{\color{blue}{B \cdot B}}} \]
      4. sqrt-unprod7.2%

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

        \[\leadsto \frac{1 + x}{\color{blue}{B}} \]
      6. *-un-lft-identity18.1%

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

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

        \[\leadsto \color{blue}{\frac{1 + x}{B}} \]
    10. Simplified18.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-54}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-271}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{elif}\;x \leq 3.9 \cdot 10^{-194} \lor \neg \left(x \leq 1.48 \cdot 10^{-36}\right):\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 36.8% accurate, 16.2× speedup?

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

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

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

\mathbf{elif}\;F \leq 2.7 \cdot 10^{+222}:\\
\;\;\;\;\frac{1 + x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.19999999999999997e-18 or 2.70000000000000013e222 < F

    1. Initial program 51.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 87.8%

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

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

        \[\leadsto \color{blue}{-\frac{1 + x}{B}} \]
      2. distribute-neg-frac247.3%

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

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

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

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

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

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

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

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

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

    if -1.19999999999999997e-18 < F < 1.04999999999999996e189

    1. Initial program 93.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 65.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 30.3%

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

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-frac-neg30.3%

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

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

    if 1.04999999999999996e189 < F < 2.70000000000000013e222

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

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

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

        \[\leadsto \color{blue}{-\frac{1 + x}{B}} \]
      2. distribute-neg-frac21.4%

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified1.4%

      \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt0.6%

        \[\leadsto \frac{1 + x}{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}} \]
      2. sqrt-unprod14.8%

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

        \[\leadsto \frac{1 + x}{\sqrt{\color{blue}{B \cdot B}}} \]
      4. sqrt-unprod25.9%

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

        \[\leadsto \frac{1 + x}{\color{blue}{B}} \]
      6. *-un-lft-identity63.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.2 \cdot 10^{-18}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{+189}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 2.7 \cdot 10^{+222}:\\ \;\;\;\;\frac{1 + x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 24: 44.1% accurate, 21.6× speedup?

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

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

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

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


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

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

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

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

        \[\leadsto \color{blue}{-\frac{1 + x}{B}} \]
      2. distribute-neg-frac248.1%

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified48.1%

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

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

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

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

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

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

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

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

    if -9.00000000000000026e-19 < F < 8.50000000000000006e-52

    1. Initial program 99.5%

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

      \[\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 30.6%

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

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-frac-neg30.6%

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

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

    if 8.50000000000000006e-52 < F

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

      \[\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 48.7%

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

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

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

Alternative 25: 44.1% accurate, 21.6× speedup?

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

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

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

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


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

    1. Initial program 57.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 B around 0 32.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 B around 0 22.4%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{B} + \frac{x}{B}\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-in48.1%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-1}{B}} - \frac{x}{B} \]
      6. metadata-eval48.1%

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

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

    if -1.19999999999999997e-15 < F < 8.19999999999999977e-52

    1. Initial program 99.5%

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

      \[\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 30.6%

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

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-frac-neg30.6%

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

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

    if 8.19999999999999977e-52 < F

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

      \[\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 48.7%

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

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

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

Alternative 26: 30.6% accurate, 23.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-54} \lor \neg \left(x \leq 4.6 \cdot 10^{-271}\right):\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (or (<= x -4e-54) (not (<= x 4.6e-271))) (/ x (- B)) (/ -1.0 B)))
double code(double F, double B, double x) {
	double tmp;
	if ((x <= -4e-54) || !(x <= 4.6e-271)) {
		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-54)) .or. (.not. (x <= 4.6d-271))) 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-54) || !(x <= 4.6e-271)) {
		tmp = x / -B;
	} else {
		tmp = -1.0 / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if (x <= -4e-54) or not (x <= 4.6e-271):
		tmp = x / -B
	else:
		tmp = -1.0 / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if ((x <= -4e-54) || !(x <= 4.6e-271))
		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-54) || ~((x <= 4.6e-271)))
		tmp = x / -B;
	else
		tmp = -1.0 / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[Or[LessEqual[x, -4e-54], N[Not[LessEqual[x, 4.6e-271]], $MachinePrecision]], N[(x / (-B)), $MachinePrecision], N[(-1.0 / B), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.0000000000000001e-54 or 4.60000000000000017e-271 < x

    1. Initial program 79.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 46.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 x around inf 36.0%

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

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

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

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

    if -4.0000000000000001e-54 < x < 4.60000000000000017e-271

    1. Initial program 66.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 36.4%

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

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

        \[\leadsto \color{blue}{-\frac{1 + x}{B}} \]
      2. distribute-neg-frac223.9%

        \[\leadsto \color{blue}{\frac{1 + x}{-B}} \]
    6. Simplified23.9%

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

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

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

Alternative 27: 9.8% accurate, 108.0× speedup?

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

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

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

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

      \[\leadsto \color{blue}{-\frac{1 + x}{B}} \]
    2. distribute-neg-frac229.3%

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

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

    \[\leadsto \color{blue}{\frac{-1}{B}} \]
  8. Final simplification10.9%

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

Reproduce

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