VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.3% → 99.6%
Time: 20.7s
Alternatives: 26
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 26 alternatives:

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

Initial Program: 76.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;F \leq 1050:\\
\;\;\;\;F \cdot {\left(\frac{\sin B}{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}\right)}^{-1} - t_0\\

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


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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000005e32 < F < 1050

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

    if 1050 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

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

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

Alternative 2: 99.7% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;F \leq 5.3 \cdot 10^{+20}:\\
\;\;\;\;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 - x \cdot \cos B}{\sin B}\\


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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000005e32 < F < 5.3e20

    1. Initial program 99.5%

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

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

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

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

Alternative 3: 99.6% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 60.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. Simplified72.1%

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

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

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

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

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

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

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

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

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

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

    if -5e10 < F < 1050

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

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

    if 1050 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

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

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

Alternative 4: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4e27 < F < 1050

    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 1050 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

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

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

Alternative 5: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 60.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. Simplified72.1%

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

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

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

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

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

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

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

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

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

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

    if -1e16 < F < 1050

    1. Initial program 99.5%

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

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

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

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

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

Alternative 6: 99.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 62.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. Simplified73.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. Step-by-step derivation
      1. clear-num73.4%

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

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

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

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

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

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

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

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

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

    if -1.3999999999999999 < F < 1.44999999999999996

    1. Initial program 99.5%

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

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

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

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

    if 1.44999999999999996 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

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

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

Alternative 7: 91.9% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 60.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. Simplified72.1%

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

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

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

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

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

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

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

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

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

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

    if -205000 < F < 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. 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)} \]
    5. Taylor expanded in B around 0 85.3%

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

    if 52 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

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

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

Alternative 8: 91.6% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq 0.6:\\
\;\;\;\;F \cdot \left(\frac{1}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}}\right) - t_0\\

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


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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999988e-11 < F < 0.599999999999999978

    1. Initial program 99.5%

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

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

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

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

    if 0.599999999999999978 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

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

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

Alternative 9: 91.6% accurate, 1.4× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999988e-11 < F < 0.27000000000000002

    1. Initial program 99.5%

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

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

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

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

    if 0.27000000000000002 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

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

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

Alternative 10: 85.5% accurate, 1.5× speedup?

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

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

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

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

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


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

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

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

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

    if -3.39999999999999973e-58 < F < 1.8e-73

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

    if 1.8e-73 < F < 5.19999999999999973e-30

    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 F around 0 99.4%

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

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

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

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

    if 5.19999999999999973e-30 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified96.2%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    8. Step-by-step derivation
      1. div-sub96.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.4 \cdot 10^{-58}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.8 \cdot 10^{-73}:\\ \;\;\;\;\frac{-x}{\frac{\sin B}{\cos B}}\\ \mathbf{elif}\;F \leq 5.2 \cdot 10^{-30}:\\ \;\;\;\;\frac{F}{\frac{\sin B}{\sqrt{0.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x \cdot \cos B}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 72.1% accurate, 1.5× speedup?

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

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

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

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

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

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


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

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

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

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

    if -2.3000000000000001e-18 < F < 5.49999999999999994e-72

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

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

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

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

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

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

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

    if 5.49999999999999994e-72 < F < 5.59999999999999977e-30

    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 F around 0 99.4%

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

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

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

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

    if 5.59999999999999977e-30 < F < 1.60000000000000003e96

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified90.0%

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

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

    if 1.60000000000000003e96 < F

    1. Initial program 40.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. Simplified65.9%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 85.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.3 \cdot 10^{-18}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 5.5 \cdot 10^{-72}:\\ \;\;\;\;x \cdot \frac{-\cos B}{\sin B}\\ \mathbf{elif}\;F \leq 5.6 \cdot 10^{-30}:\\ \;\;\;\;\frac{F}{\frac{\sin B}{\sqrt{0.5}}}\\ \mathbf{elif}\;F \leq 1.6 \cdot 10^{+96}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 72.1% accurate, 1.5× speedup?

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

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

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

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

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

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


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

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

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

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

    if -2.3000000000000001e-18 < F < 1.07999999999999998e-72

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

    if 1.07999999999999998e-72 < F < 5.19999999999999973e-30

    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 F around 0 99.4%

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

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

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

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

    if 5.19999999999999973e-30 < F < 1.60000000000000003e96

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified90.0%

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

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

    if 1.60000000000000003e96 < F

    1. Initial program 40.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. Simplified65.9%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 85.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.3 \cdot 10^{-18}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.08 \cdot 10^{-72}:\\ \;\;\;\;\frac{-x}{\frac{\sin B}{\cos B}}\\ \mathbf{elif}\;F \leq 5.2 \cdot 10^{-30}:\\ \;\;\;\;\frac{F}{\frac{\sin B}{\sqrt{0.5}}}\\ \mathbf{elif}\;F \leq 1.6 \cdot 10^{+96}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 78.5% accurate, 1.5× speedup?

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

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

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

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

\mathbf{elif}\;F \leq 1.65 \cdot 10^{+96}:\\
\;\;\;\;\frac{1}{B} - t_0\\

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


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

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000001e-58 < F < 1.39999999999999994e-74

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

    if 1.39999999999999994e-74 < F < 4.89999999999999971e-30

    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 F around 0 99.4%

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

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

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

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

    if 4.89999999999999971e-30 < F < 1.64999999999999992e96

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified90.0%

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

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

    if 1.64999999999999992e96 < F

    1. Initial program 40.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. Simplified65.9%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 85.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.2 \cdot 10^{-58}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.4 \cdot 10^{-74}:\\ \;\;\;\;\frac{-x}{\frac{\sin B}{\cos B}}\\ \mathbf{elif}\;F \leq 4.9 \cdot 10^{-30}:\\ \;\;\;\;\frac{F}{\frac{\sin B}{\sqrt{0.5}}}\\ \mathbf{elif}\;F \leq 1.65 \cdot 10^{+96}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 64.6% accurate, 2.3× speedup?

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

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

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

\mathbf{elif}\;F \leq 780:\\
\;\;\;\;{\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \left(\frac{x}{B} + -0.3333333333333333 \cdot \left(B \cdot x\right)\right)\\

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


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

    1. Initial program 52.4%

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

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

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

    if -1.99999999999999992e88 < F < -8.5999999999999997e-280

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

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

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

    if -8.5999999999999997e-280 < F < 780

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

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\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 58.4%

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

    if 780 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 81.9%

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

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

Alternative 15: 64.4% accurate, 2.4× speedup?

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

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

\mathbf{elif}\;F \leq -9 \cdot 10^{-280}:\\
\;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\

\mathbf{elif}\;F \leq 0.125:\\
\;\;\;\;\left(\frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} + \left(B \cdot x\right) \cdot 0.3333333333333333\right) - \frac{x}{B}\\

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


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

    1. Initial program 52.4%

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

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

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

    if -3.7999999999999997e88 < F < -8.9999999999999991e-280

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

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

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

    if -8.9999999999999991e-280 < F < 0.125

    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 F around 0 98.9%

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

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

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

    if 0.125 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 81.9%

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

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

Alternative 16: 64.2% accurate, 2.5× speedup?

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

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

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

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

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


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

    1. Initial program 52.4%

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

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

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

    if -2.20000000000000009e88 < F < 1e-276

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

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

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

    if 1e-276 < F < 0.20000000000000001

    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 F around 0 98.6%

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

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

    if 0.20000000000000001 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 81.9%

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

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

Alternative 17: 61.9% accurate, 2.5× speedup?

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

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

\mathbf{elif}\;F \leq 1.2 \cdot 10^{-276}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq 10^{-192}:\\
\;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\

\mathbf{elif}\;F \leq 1.7 \cdot 10^{+96}:\\
\;\;\;\;t_0\\

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


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

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

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

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

    if -2.3000000000000001e-18 < F < 1.19999999999999991e-276 or 1.0000000000000001e-192 < F < 1.7e96

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

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

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

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

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

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

    if 1.19999999999999991e-276 < F < 1.0000000000000001e-192

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

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\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 9.6%

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

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

    if 1.7e96 < F

    1. Initial program 40.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. Simplified65.9%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 85.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.3 \cdot 10^{-18}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.2 \cdot 10^{-276}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 10^{-192}:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{elif}\;F \leq 1.7 \cdot 10^{+96}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 61.7% accurate, 2.5× speedup?

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

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

\mathbf{elif}\;F \leq -3 \cdot 10^{-279}:\\
\;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\

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

\mathbf{elif}\;F \leq 1.7 \cdot 10^{+96}:\\
\;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\

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


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

    1. Initial program 52.4%

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

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

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

    if -3.7999999999999997e88 < F < -3e-279

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

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

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

    if -3e-279 < F < 5.9999999999999998e-193

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

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\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 12.2%

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

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

    if 5.9999999999999998e-193 < F < 1.7e96

    1. Initial program 95.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. Simplified99.5%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified60.4%

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

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

    if 1.7e96 < F

    1. Initial program 40.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. Simplified65.9%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified99.5%

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

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

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

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 85.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.8 \cdot 10^{+88}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -3 \cdot 10^{-279}:\\ \;\;\;\;\frac{-1}{B} - x \cdot \frac{1}{\tan B}\\ \mathbf{elif}\;F \leq 6 \cdot 10^{-193}:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{elif}\;F \leq 1.7 \cdot 10^{+96}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 56.3% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{1}{B} - \frac{x}{\tan B}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{-132}:\\
\;\;\;\;t_0\\

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

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.34999999999999995e-132 or 2.5000000000000001e-4 < x

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified74.3%

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

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

    if -1.34999999999999995e-132 < x < 4.8000000000000002e-149

    1. Initial program 71.6%

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

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\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 30.1%

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

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

    if 4.8000000000000002e-149 < x < 2.5000000000000001e-4

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified12.5%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{-132}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{-149}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{elif}\;x \leq 0.00025:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 52.4% accurate, 2.8× speedup?

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

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

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

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


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

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

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

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

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

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

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

    if -1.4e-57 < F < 7.40000000000000047e-75

    1. Initial program 99.5%

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified24.3%

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

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

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

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

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

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

    if 7.40000000000000047e-75 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified91.0%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    8. Step-by-step derivation
      1. div-sub91.2%

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

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    10. Taylor expanded in B around 0 73.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.4 \cdot 10^{-57}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 7.4 \cdot 10^{-75}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 44.8% accurate, 2.9× speedup?

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

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

\mathbf{elif}\;F \leq 11500:\\
\;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\

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


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

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

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

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

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

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

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

    if -2.79999999999999979e-109 < F < 11500

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

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\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 21.4%

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

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

    if 11500 < F

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

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\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 64.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.8 \cdot 10^{-109}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 11500:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 44.1% accurate, 17.0× speedup?

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

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

\mathbf{elif}\;F \leq 1.4 \cdot 10^{-15}:\\
\;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\

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


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

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

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

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

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

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

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

    if -2.79999999999999979e-109 < F < 1.40000000000000007e-15

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

      \[\leadsto \left(-\color{blue}{\left(-0.3333333333333333 \cdot \left(B \cdot x\right) + \frac{x}{B}\right)}\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 20.1%

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

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

    if 1.40000000000000007e-15 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified98.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.8 \cdot 10^{-109}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.4 \cdot 10^{-15}:\\ \;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 44.3% accurate, 21.6× speedup?

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

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

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

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


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

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

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

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

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

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

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

    if -3.89999999999999992e-58 < F < 1.10000000000000009e-62

    1. Initial program 99.5%

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified24.9%

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

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

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

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

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

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

    if 1.10000000000000009e-62 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified91.9%

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

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

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

Alternative 24: 37.5% accurate, 32.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq 3.1 \cdot 10^{-63}:\\
\;\;\;\;\frac{-x}{B}\\

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


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

    1. Initial program 85.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. Simplified89.6%

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified34.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    10. Simplified32.6%

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

    if 3.09999999999999984e-63 < F

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

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

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

        \[\leadsto F \cdot \color{blue}{\frac{\frac{1}{F}}{\sin B}} - \frac{x}{\tan B} \]
    6. Simplified91.9%

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

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

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

Alternative 25: 30.5% accurate, 81.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 26: 9.7% accurate, 108.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{B}} \]
  9. Final simplification8.7%

    \[\leadsto \frac{1}{B} \]
  10. Add Preprocessing

Reproduce

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