VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.4% → 99.7%
Time: 19.4s
Alternatives: 24
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 24 alternatives:

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

Initial Program: 77.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 54.0%

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

    if -1.5e20 < F < 3e8

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

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

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

        \[\leadsto F \cdot {\left(\frac{\sin B}{{\color{blue}{\left(\mathsf{fma}\left(2, x, \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} \]
    6. Step-by-step derivation
      1. unpow-199.7%

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

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

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

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

    if 3e8 < F

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
  3. Recombined 3 regimes into one program.
  4. 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 -9 \cdot 10^{+74}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 300000000:\\ \;\;\;\;F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -9e+74)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 300000000.0)
       (- (* F (/ (pow (fma x 2.0 (fma F F 2.0)) -0.5) (sin B))) t_0)
       (- (/ 1.0 (sin B)) (/ (* x (cos B)) (sin B)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -9e+74) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 300000000.0) {
		tmp = (F * (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) / sin(B))) - t_0;
	} else {
		tmp = (1.0 / sin(B)) - ((x * cos(B)) / sin(B));
	}
	return tmp;
}
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -9e+74)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 300000000.0)
		tmp = Float64(Float64(F * Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) / sin(B))) - t_0);
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(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, -9e+74], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 300000000.0], N[(N[(F * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 47.2%

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

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

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

    if -8.9999999999999999e74 < F < 3e8

    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

    if 3e8 < F

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 0.8× speedup?

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

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

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

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


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

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

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

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

    if -2e17 < F < 1e8

    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 \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg99.5%

        \[\leadsto \color{blue}{\left(-\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)} \]
      2. associate-/l*99.5%

        \[\leadsto \left(-\color{blue}{x \cdot \frac{\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)} \]
    5. Simplified99.5%

      \[\leadsto \color{blue}{\left(-x \cdot \frac{\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 1e8 < F

    1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{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 -2 \cdot 10^{+17}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 100000000:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - x \cdot \frac{\cos B}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{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 -2.45 \cdot 10^{+17}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 105000000:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{1}{\frac{\sin B}{F}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -2.45e+17)
   (- (/ -1.0 (sin B)) (/ x (tan B)))
   (if (<= F 105000000.0)
     (+
      (* x (/ -1.0 (tan B)))
      (* (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5) (/ 1.0 (/ (sin B) F))))
     (- (/ 1.0 (sin B)) (/ (* x (cos B)) (sin B))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -2.45e+17) {
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	} else if (F <= 105000000.0) {
		tmp = (x * (-1.0 / tan(B))) + (pow(((2.0 + (F * F)) + (x * 2.0)), -0.5) * (1.0 / (sin(B) / F)));
	} else {
		tmp = (1.0 / sin(B)) - ((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 <= (-2.45d+17)) then
        tmp = ((-1.0d0) / sin(b)) - (x / tan(b))
    else if (f <= 105000000.0d0) then
        tmp = (x * ((-1.0d0) / tan(b))) + ((((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0)) * (1.0d0 / (sin(b) / f)))
    else
        tmp = (1.0d0 / sin(b)) - ((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 <= -2.45e+17) {
		tmp = (-1.0 / Math.sin(B)) - (x / Math.tan(B));
	} else if (F <= 105000000.0) {
		tmp = (x * (-1.0 / Math.tan(B))) + (Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5) * (1.0 / (Math.sin(B) / F)));
	} else {
		tmp = (1.0 / Math.sin(B)) - ((x * Math.cos(B)) / Math.sin(B));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -2.45e+17:
		tmp = (-1.0 / math.sin(B)) - (x / math.tan(B))
	elif F <= 105000000.0:
		tmp = (x * (-1.0 / math.tan(B))) + (math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5) * (1.0 / (math.sin(B) / F)))
	else:
		tmp = (1.0 / math.sin(B)) - ((x * math.cos(B)) / math.sin(B))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -2.45e+17)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B)));
	elseif (F <= 105000000.0)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64((Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5) * Float64(1.0 / Float64(sin(B) / F))));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(Float64(x * cos(B)) / sin(B)));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -2.45e+17)
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	elseif (F <= 105000000.0)
		tmp = (x * (-1.0 / tan(B))) + ((((2.0 + (F * F)) + (x * 2.0)) ^ -0.5) * (1.0 / (sin(B) / F)));
	else
		tmp = (1.0 / sin(B)) - ((x * cos(B)) / sin(B));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -2.45e+17], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 105000000.0], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(1.0 / N[(N[Sin[B], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 54.7%

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

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

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

    if -2.45e17 < F < 1.05e8

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

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

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

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

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

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

    if 1.05e8 < F

    1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{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 -2.45 \cdot 10^{+17}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 105000000:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{1}{\frac{\sin B}{F}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{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 -6.2 \cdot 10^{+15}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 125000000:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} + x \cdot \frac{-1}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -6.2e+15)
   (- (/ -1.0 (sin B)) (/ x (tan B)))
   (if (<= F 125000000.0)
     (+
      (* (/ F (sin B)) (pow (+ (+ 2.0 (* F F)) (* x 2.0)) -0.5))
      (* x (/ -1.0 (tan B))))
     (- (/ 1.0 (sin B)) (/ (* x (cos B)) (sin B))))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -6.2e+15) {
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	} else if (F <= 125000000.0) {
		tmp = ((F / sin(B)) * pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) + (x * (-1.0 / tan(B)));
	} else {
		tmp = (1.0 / sin(B)) - ((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 <= (-6.2d+15)) then
        tmp = ((-1.0d0) / sin(b)) - (x / tan(b))
    else if (f <= 125000000.0d0) then
        tmp = ((f / sin(b)) * (((2.0d0 + (f * f)) + (x * 2.0d0)) ** (-0.5d0))) + (x * ((-1.0d0) / tan(b)))
    else
        tmp = (1.0d0 / sin(b)) - ((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 <= -6.2e+15) {
		tmp = (-1.0 / Math.sin(B)) - (x / Math.tan(B));
	} else if (F <= 125000000.0) {
		tmp = ((F / Math.sin(B)) * Math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) + (x * (-1.0 / Math.tan(B)));
	} else {
		tmp = (1.0 / Math.sin(B)) - ((x * Math.cos(B)) / Math.sin(B));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -6.2e+15:
		tmp = (-1.0 / math.sin(B)) - (x / math.tan(B))
	elif F <= 125000000.0:
		tmp = ((F / math.sin(B)) * math.pow(((2.0 + (F * F)) + (x * 2.0)), -0.5)) + (x * (-1.0 / math.tan(B)))
	else:
		tmp = (1.0 / math.sin(B)) - ((x * math.cos(B)) / math.sin(B))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -6.2e+15)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B)));
	elseif (F <= 125000000.0)
		tmp = Float64(Float64(Float64(F / sin(B)) * (Float64(Float64(2.0 + Float64(F * F)) + Float64(x * 2.0)) ^ -0.5)) + Float64(x * Float64(-1.0 / tan(B))));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(Float64(x * cos(B)) / sin(B)));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -6.2e+15)
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	elseif (F <= 125000000.0)
		tmp = ((F / sin(B)) * (((2.0 + (F * F)) + (x * 2.0)) ^ -0.5)) + (x * (-1.0 / tan(B)));
	else
		tmp = (1.0 / sin(B)) - ((x * cos(B)) / sin(B));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -6.2e+15], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 125000000.0], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] + N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

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

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

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

    if -6.2e15 < F < 1.25e8

    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 1.25e8 < F

    1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq 108000000:\\
\;\;\;\;\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}{\sin B} - \frac{x \cdot \cos B}{\sin B}\\


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

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

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

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

    if -2e17 < F < 1.08e8

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

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

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

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

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

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

    if 1.08e8 < F

    1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{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 -2 \cdot 10^{+17}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 108000000:\\ \;\;\;\;\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}{\sin B} - \frac{x \cdot \cos B}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 99.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -310000:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 1.45:\\ \;\;\;\;\frac{F}{\sin B \cdot \sqrt{2 + x \cdot 2}} - t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -310000.0)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 1.45)
       (- (/ F (* (sin B) (sqrt (+ 2.0 (* x 2.0))))) t_0)
       (- (/ 1.0 (sin B)) (/ (* x (cos B)) (sin B)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -310000.0) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 1.45) {
		tmp = (F / (sin(B) * sqrt((2.0 + (x * 2.0))))) - t_0;
	} else {
		tmp = (1.0 / sin(B)) - ((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 <= (-310000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_0
    else if (f <= 1.45d0) then
        tmp = (f / (sin(b) * sqrt((2.0d0 + (x * 2.0d0))))) - t_0
    else
        tmp = (1.0d0 / sin(b)) - ((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 <= -310000.0) {
		tmp = (-1.0 / Math.sin(B)) - t_0;
	} else if (F <= 1.45) {
		tmp = (F / (Math.sin(B) * Math.sqrt((2.0 + (x * 2.0))))) - t_0;
	} else {
		tmp = (1.0 / Math.sin(B)) - ((x * Math.cos(B)) / Math.sin(B));
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -310000.0:
		tmp = (-1.0 / math.sin(B)) - t_0
	elif F <= 1.45:
		tmp = (F / (math.sin(B) * math.sqrt((2.0 + (x * 2.0))))) - t_0
	else:
		tmp = (1.0 / math.sin(B)) - ((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 <= -310000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 1.45)
		tmp = Float64(Float64(F / Float64(sin(B) * sqrt(Float64(2.0 + Float64(x * 2.0))))) - t_0);
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(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 <= -310000.0)
		tmp = (-1.0 / sin(B)) - t_0;
	elseif (F <= 1.45)
		tmp = (F / (sin(B) * sqrt((2.0 + (x * 2.0))))) - t_0;
	else
		tmp = (1.0 / sin(B)) - ((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, -310000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 1.45], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

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


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

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

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

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

    if -3.1e5 < 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.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. 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. un-div-inv99.6%

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

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

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

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

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

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

    if 1.44999999999999996 < F

    1. Initial program 65.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. Simplified77.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 91.4% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

    if -6.2e15 < F < 1.85e6

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

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

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

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

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

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

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

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

    if 1.85e6 < F

    1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 91.4% accurate, 1.4× speedup?

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

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

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

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


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

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

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

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

    if -6.2e15 < F < 1.85e6

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

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

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

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

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

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

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

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

    if 1.85e6 < F

    1. Initial program 64.9%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified77.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 \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification94.3%

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

Alternative 10: 85.0% accurate, 1.4× speedup?

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

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

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

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

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

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


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

    1. Initial program 58.2%

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

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

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

    if -1.20000000000000002e-16 < F < -3.3499999999999999e-77

    1. Initial program 99.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. Simplified99.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. associate-*r/99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
    7. Step-by-step derivation
      1. associate-*l/77.9%

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

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

        \[\leadsto \color{blue}{\frac{F}{1} \cdot \frac{\sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} \]
      4. /-rgt-identity77.5%

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{{F}^{2} + 2}}}}{\sin B} \]
      6. unpow277.5%

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

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

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

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

    if -3.3499999999999999e-77 < F < 1.5500000000000001e-118

    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. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5500000000000001e-118 < F < 1.85e6

    1. Initial program 99.5%

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

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

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

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

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

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

    if 1.85e6 < F

    1. Initial program 64.9%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified77.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 \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification91.7%

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

Alternative 11: 70.5% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -3.1 \cdot 10^{-19}:\\
\;\;\;\;\frac{-1}{B} - t\_0\\

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

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

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

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


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

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

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

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

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

    if -3.0000000000000001e138 < F < -3.0999999999999999e-19

    1. Initial program 90.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. 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 96.7%

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

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

    if -3.0999999999999999e-19 < F < -5.1999999999999999e-76

    1. Initial program 99.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. Simplified99.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. associate-*r/99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
    7. Step-by-step derivation
      1. associate-*l/77.9%

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

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

        \[\leadsto \color{blue}{\frac{F}{1} \cdot \frac{\sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} \]
      4. /-rgt-identity77.5%

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{{F}^{2} + 2}}}}{\sin B} \]
      6. unpow277.5%

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

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

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

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

    if -5.1999999999999999e-76 < F < 9.60000000000000034e-119

    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. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.60000000000000034e-119 < F < 1.85e6

    1. Initial program 99.5%

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

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

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

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

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

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

    if 1.85e6 < F

    1. Initial program 64.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      2. distribute-neg-frac42.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3 \cdot 10^{+138}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -3.1 \cdot 10^{-19}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -5.2 \cdot 10^{-76}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B}\\ \mathbf{elif}\;F \leq 9.6 \cdot 10^{-119}:\\ \;\;\;\;x \cdot \frac{\cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 1850000:\\ \;\;\;\;{\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 91.5% accurate, 1.4× speedup?

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

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

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

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


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

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

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

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

    if -3.1e5 < F < 0.0269999999999999997

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

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

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

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

      \[\leadsto \color{blue}{\left(0 - \frac{x}{\tan B}\right)} + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    6. Step-by-step derivation
      1. neg-sub087.3%

        \[\leadsto \color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      2. distribute-neg-frac87.3%

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

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

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

    if 0.0269999999999999997 < F

    1. Initial program 65.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. Simplified77.6%

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

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

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

Alternative 13: 77.7% accurate, 1.5× speedup?

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

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

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

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

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

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


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

    1. Initial program 58.2%

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

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

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

    if -1.49999999999999997e-16 < F < -2.3500000000000001e-76

    1. Initial program 99.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. Simplified99.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. associate-*r/99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
    7. Step-by-step derivation
      1. associate-*l/77.9%

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

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

        \[\leadsto \color{blue}{\frac{F}{1} \cdot \frac{\sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} \]
      4. /-rgt-identity77.5%

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{{F}^{2} + 2}}}}{\sin B} \]
      6. unpow277.5%

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

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

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

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

    if -2.3500000000000001e-76 < F < 4.9999999999999999e-122

    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. Step-by-step derivation
      1. associate-*r/99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999999e-122 < F < 1.85e6

    1. Initial program 99.5%

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

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

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

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

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

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

    if 1.85e6 < F

    1. Initial program 64.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      2. distribute-neg-frac42.8%

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

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

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

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

Alternative 14: 61.5% accurate, 2.4× speedup?

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

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

\mathbf{elif}\;F \leq 3 \cdot 10^{-178}:\\
\;\;\;\;\frac{-1}{B} - t\_0\\

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

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


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

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

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

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

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

    if -4.0999999999999998e138 < F < 2.9999999999999999e-178

    1. Initial program 96.8%

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

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

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

    if 2.9999999999999999e-178 < F < 2.5e6

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

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

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

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

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

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

    if 2.5e6 < F

    1. Initial program 64.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-\frac{x}{\tan B}\right)} + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      2. distribute-neg-frac42.8%

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

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

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

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

Alternative 15: 54.6% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -4.1 \cdot 10^{+138}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 210000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 2.1 \cdot 10^{+105}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{elif}\;F \leq 7.5 \cdot 10^{+254}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot \sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (/ -1.0 B) (/ x (tan B)))))
   (if (<= F -4.1e+138)
     (- (/ -1.0 (sin B)) (/ x B))
     (if (<= F 210000.0)
       t_0
       (if (<= F 2.1e+105)
         (/ 1.0 (sin B))
         (if (<= F 7.5e+254) t_0 (* F (/ 1.0 (* F (sin B))))))))))
double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / tan(B));
	double tmp;
	if (F <= -4.1e+138) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= 210000.0) {
		tmp = t_0;
	} else if (F <= 2.1e+105) {
		tmp = 1.0 / sin(B);
	} else if (F <= 7.5e+254) {
		tmp = t_0;
	} else {
		tmp = F * (1.0 / (F * 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 <= (-4.1d+138)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= 210000.0d0) then
        tmp = t_0
    else if (f <= 2.1d+105) then
        tmp = 1.0d0 / sin(b)
    else if (f <= 7.5d+254) then
        tmp = t_0
    else
        tmp = f * (1.0d0 / (f * 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 <= -4.1e+138) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= 210000.0) {
		tmp = t_0;
	} else if (F <= 2.1e+105) {
		tmp = 1.0 / Math.sin(B);
	} else if (F <= 7.5e+254) {
		tmp = t_0;
	} else {
		tmp = F * (1.0 / (F * Math.sin(B)));
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (-1.0 / B) - (x / math.tan(B))
	tmp = 0
	if F <= -4.1e+138:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= 210000.0:
		tmp = t_0
	elif F <= 2.1e+105:
		tmp = 1.0 / math.sin(B)
	elif F <= 7.5e+254:
		tmp = t_0
	else:
		tmp = F * (1.0 / (F * 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 <= -4.1e+138)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= 210000.0)
		tmp = t_0;
	elseif (F <= 2.1e+105)
		tmp = Float64(1.0 / sin(B));
	elseif (F <= 7.5e+254)
		tmp = t_0;
	else
		tmp = Float64(F * Float64(1.0 / Float64(F * 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 <= -4.1e+138)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= 210000.0)
		tmp = t_0;
	elseif (F <= 2.1e+105)
		tmp = 1.0 / sin(B);
	elseif (F <= 7.5e+254)
		tmp = t_0;
	else
		tmp = F * (1.0 / (F * 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, -4.1e+138], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 210000.0], t$95$0, If[LessEqual[F, 2.1e+105], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.5e+254], t$95$0, N[(F * N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;F \leq 7.5 \cdot 10^{+254}:\\
\;\;\;\;t\_0\\

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


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

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

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

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

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

    if -4.0999999999999998e138 < F < 2.1e5 or 2.1000000000000001e105 < F < 7.50000000000000043e254

    1. Initial program 90.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. Simplified95.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 54.8%

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

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

    if 2.1e5 < F < 2.1000000000000001e105

    1. Initial program 95.7%

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

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

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

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

    if 7.50000000000000043e254 < F

    1. Initial program 2.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. Simplified27.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. Step-by-step derivation
      1. associate-*r/27.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
    7. Step-by-step derivation
      1. associate-*l/2.3%

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

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

        \[\leadsto \color{blue}{\frac{F}{1} \cdot \frac{\sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} \]
      4. /-rgt-identity2.3%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} \]
      7. fma-undefine2.3%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} \]
    8. Simplified2.3%

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

      \[\leadsto F \cdot \color{blue}{\frac{1}{F \cdot \sin B}} \]
    10. Step-by-step derivation
      1. *-commutative72.7%

        \[\leadsto F \cdot \frac{1}{\color{blue}{\sin B \cdot F}} \]
    11. Simplified72.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -4.1 \cdot 10^{+138}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 210000:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2.1 \cdot 10^{+105}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{elif}\;F \leq 7.5 \cdot 10^{+254}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot \sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 44.7% accurate, 2.6× speedup?

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

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

\mathbf{elif}\;F \leq -9.2 \cdot 10^{-15}:\\
\;\;\;\;\frac{-1}{\sin B}\\

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

\mathbf{elif}\;F \leq 1.4 \cdot 10^{+168}:\\
\;\;\;\;\frac{1}{\sin B}\\

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


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

    1. Initial program 27.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. Simplified53.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 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.19999999999999985e244 < F < -9.19999999999999961e-15

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
    7. Step-by-step derivation
      1. associate-*l/38.1%

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

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

        \[\leadsto \color{blue}{\frac{F}{1} \cdot \frac{\sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} \]
      4. /-rgt-identity38.0%

        \[\leadsto \color{blue}{F} \cdot \frac{\sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B} \]
      5. +-commutative38.0%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{{F}^{2} + 2}}}}{\sin B} \]
      6. unpow238.0%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} \]
      7. fma-undefine38.0%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} \]
    8. Simplified38.0%

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

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

    if -9.19999999999999961e-15 < F < 0.55000000000000004

    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 -inf 41.5%

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

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

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

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

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

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

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

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

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

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

    if 0.55000000000000004 < F < 1.39999999999999995e168

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

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

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

    if 1.39999999999999995e168 < F

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -8.2 \cdot 10^{+244}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -9.2 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 0.55:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{elif}\;F \leq 1.4 \cdot 10^{+168}:\\ \;\;\;\;\frac{1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 59.6% accurate, 2.7× speedup?

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

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

\mathbf{elif}\;F \leq -1.7 \cdot 10^{-194}:\\
\;\;\;\;\frac{-1}{B} - t\_0\\

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

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


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

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

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

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

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

    if -1.13999999999999997e139 < F < -1.70000000000000005e-194

    1. Initial program 94.7%

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

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

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

    if -1.70000000000000005e-194 < F < -1.74999999999999991e-290

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.74999999999999991e-290 < F

    1. Initial program 80.9%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.14 \cdot 10^{+139}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.7 \cdot 10^{-194}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.75 \cdot 10^{-290}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 56.0% accurate, 2.7× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -8.60000000000000029e-10 or 2.4999999999999999e-81 < x

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

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

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

    if -8.60000000000000029e-10 < x < -1.94999999999999999e-175

    1. Initial program 65.3%

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

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

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

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

    if -1.94999999999999999e-175 < x < 2.4999999999999999e-81

    1. Initial program 73.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified74.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. Step-by-step derivation
      1. associate-*r/74.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
    7. Step-by-step derivation
      1. associate-*l/61.4%

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

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

        \[\leadsto \color{blue}{\frac{F}{1} \cdot \frac{\sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} \]
      4. /-rgt-identity61.3%

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

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

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} \]
      7. fma-undefine61.3%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} \]
    8. Simplified61.3%

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

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

Alternative 19: 43.7% accurate, 2.9× speedup?

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

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

\mathbf{elif}\;F \leq -9.2 \cdot 10^{-15}:\\
\;\;\;\;\frac{-1}{\sin B}\\

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

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


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

    1. Initial program 27.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. Simplified53.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 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.1999999999999998e245 < F < -9.19999999999999961e-15

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
    7. Step-by-step derivation
      1. associate-*l/38.1%

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

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

        \[\leadsto \color{blue}{\frac{F}{1} \cdot \frac{\sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B}} \]
      4. /-rgt-identity38.0%

        \[\leadsto \color{blue}{F} \cdot \frac{\sqrt{\frac{1}{2 + {F}^{2}}}}{\sin B} \]
      5. +-commutative38.0%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{{F}^{2} + 2}}}}{\sin B} \]
      6. unpow238.0%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}}}{\sin B} \]
      7. fma-undefine38.0%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}}}{\sin B} \]
    8. Simplified38.0%

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

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

    if -9.19999999999999961e-15 < F < 8.5999999999999995e-107

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

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

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

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

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

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

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

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

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

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

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

    if 8.5999999999999995e-107 < F

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -6.2 \cdot 10^{+245}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -9.2 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 8.6 \cdot 10^{-107}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 42.6% accurate, 21.6× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.40000000000000005e-76 < F < 8.5999999999999995e-107

    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 -inf 44.5%

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

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

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

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

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

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

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

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

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

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

    if 8.5999999999999995e-107 < F

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

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

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

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

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

Alternative 21: 30.2% accurate, 23.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-146} \lor \neg \left(x \leq 1.22 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{x}{-B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.4999999999999999e-146 or 1.21999999999999991e-21 < x

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

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

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

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

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

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

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

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

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

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

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

    if -6.4999999999999999e-146 < x < 1.21999999999999991e-21

    1. Initial program 70.9%

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

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

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

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

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

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

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

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

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

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

Alternative 22: 36.0% accurate, 32.3× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.22e-76 < F

    1. Initial program 84.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. Simplified90.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 43.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 23: 17.2% accurate, 40.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq 3.2 \cdot 10^{-167}:\\
\;\;\;\;\frac{-1}{B}\\

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


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

    1. Initial program 79.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. Simplified85.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 69.2%

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

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

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

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

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

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

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

    if 3.2000000000000002e-167 < F

    1. Initial program 75.1%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{B} - \frac{1}{B \cdot {F}^{2}}} \]
    6. Step-by-step derivation
      1. associate-/r*17.6%

        \[\leadsto \frac{1}{B} - \color{blue}{\frac{\frac{1}{B}}{{F}^{2}}} \]
    7. Simplified17.6%

      \[\leadsto \color{blue}{\frac{1}{B} - \frac{\frac{1}{B}}{{F}^{2}}} \]
    8. Taylor expanded in F around inf 16.7%

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

Alternative 24: 10.5% 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.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. Simplified85.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 58.8%

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

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

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

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

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

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

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

Reproduce

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