VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.7% → 99.7%
Time: 15.7s
Alternatives: 23
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 23 alternatives:

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

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

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

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


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

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

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

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

    if -5.0000000000000001e26 < F < 2.3e8

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

    if 2.3e8 < F

    1. Initial program 50.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. Simplified66.0%

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

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

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

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

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


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

    1. Initial program 47.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. Simplified70.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.9%

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

    if -4.0000000000000001e30 < F < 5e6

    1. Initial program 99.4%

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

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

    if 5e6 < F

    1. Initial program 50.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. Simplified66.0%

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

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

Alternative 3: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 51.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. Simplified72.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} \]

    if -5.9e7 < F < 5e6

    1. Initial program 99.4%

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

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

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

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

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

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

    if 5e6 < F

    1. Initial program 50.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. Simplified66.0%

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

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

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

Alternative 4: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 51.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. Simplified72.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} \]

    if -7.4e7 < F < 4e7

    1. Initial program 99.4%

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

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

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

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

    if 4e7 < F

    1. Initial program 50.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. Simplified66.0%

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

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

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

Alternative 5: 99.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 51.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. Simplified72.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} \]

    if -3400 < F < 1.3999999999999999

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

    if 1.3999999999999999 < F

    1. Initial program 52.3%

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

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

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

Alternative 6: 89.2% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -2.4 \cdot 10^{-171}:\\
\;\;\;\;t\_0\\

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

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

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


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

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

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

    if -3.9999999999999999e-16 < F < -2.39999999999999987e-171 or 3.5000000000000002e-207 < F < 24000

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

    if -2.39999999999999987e-171 < F < 3.5000000000000002e-207

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

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

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

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

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

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

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

    if 24000 < F

    1. Initial program 52.3%

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

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

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

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

Alternative 7: 92.5% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 51.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. Simplified72.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} \]

    if -6200 < F < 2.6e6

    1. Initial program 99.4%

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

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

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

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

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

    if 2.6e6 < F

    1. Initial program 50.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. Simplified66.0%

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

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

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

Alternative 8: 84.8% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 57.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. Simplified76.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 93.0%

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

    if -5.49999999999999983e-46 < F < -3.6000000000000002e-150

    1. Initial program 99.4%

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

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

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

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

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

    if -3.6000000000000002e-150 < F < 5.1999999999999997e-71

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

    if 5.1999999999999997e-71 < F

    1. Initial program 56.6%

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

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

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

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

Alternative 9: 77.8% accurate, 1.5× speedup?

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

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

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

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

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


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

    1. Initial program 57.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. Simplified76.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 93.0%

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

    if -2.2499999999999999e-45 < F < -3.6000000000000002e-149

    1. Initial program 99.4%

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

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

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

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

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

    if -3.6000000000000002e-149 < F < 1.2e-78

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

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

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

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

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

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

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

    if 1.2e-78 < F

    1. Initial program 57.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. Simplified70.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 91.1%

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

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

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

Alternative 10: 71.8% accurate, 1.5× speedup?

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

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

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

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


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

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

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

    if -3400 < F < 4.7000000000000002e-79

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

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

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

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

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

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

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

    if 4.7000000000000002e-79 < F

    1. Initial program 57.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. Simplified70.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 91.1%

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

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

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

Alternative 11: 71.8% accurate, 1.5× speedup?

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

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

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

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


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

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

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

    if -3400 < F < 1.2e-78

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

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

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

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

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

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

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

    if 1.2e-78 < F

    1. Initial program 57.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. Simplified70.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 91.1%

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

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

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

Alternative 12: 62.3% accurate, 2.4× speedup?

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

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

\mathbf{elif}\;F \leq -3.65 \cdot 10^{-155}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 1.5 \cdot 10^{-291}:\\
\;\;\;\;t\_1 + \frac{F}{B} \cdot \frac{1}{F}\\

\mathbf{elif}\;F \leq 3.2 \cdot 10^{-133}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 57.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. metadata-eval57.5%

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

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

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

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

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

    if -2.6499999999999999e-45 < F < -3.65000000000000017e-155 or 1.5e-291 < F < 3.20000000000000013e-133

    1. Initial program 99.4%

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

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

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

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

    if -3.65000000000000017e-155 < F < 1.5e-291

    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. Step-by-step derivation
      1. metadata-eval99.6%

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

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

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

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

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

    if 3.20000000000000013e-133 < F

    1. Initial program 62.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.65 \cdot 10^{-45}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -3.65 \cdot 10^{-155}:\\ \;\;\;\;\frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.5 \cdot 10^{-291}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{F}\\ \mathbf{elif}\;F \leq 3.2 \cdot 10^{-133}:\\ \;\;\;\;\frac{F}{B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 62.5% accurate, 2.5× speedup?

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

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

\mathbf{elif}\;F \leq -2.2 \cdot 10^{-155}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 4.5 \cdot 10^{-286}:\\
\;\;\;\;t\_1 + \frac{F}{B} \cdot \frac{1}{F}\\

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

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


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

    1. Initial program 57.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. metadata-eval57.5%

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

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

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

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

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

    if -2.2499999999999999e-45 < F < -2.1999999999999999e-155 or 4.50000000000000005e-286 < F < 5.5000000000000002e-134

    1. Initial program 99.4%

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

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

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

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

    if -2.1999999999999999e-155 < F < 4.50000000000000005e-286

    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. Step-by-step derivation
      1. metadata-eval99.6%

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

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

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

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

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

    if 5.5000000000000002e-134 < F

    1. Initial program 62.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.25 \cdot 10^{-45}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -2.2 \cdot 10^{-155}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 4.5 \cdot 10^{-286}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{F}\\ \mathbf{elif}\;F \leq 5.5 \cdot 10^{-134}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 55.4% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.75 \cdot 10^{-45}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq 6.5 \cdot 10^{-133}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 9.8 \cdot 10^{+117} \lor \neg \left(F \leq 1.56 \cdot 10^{+237}\right):\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.75e-45)
   (+ (* x (/ -1.0 (tan B))) (/ -1.0 B))
   (if (<= F 6.5e-133)
     (/ (- (* F (sqrt 0.5)) x) B)
     (if (or (<= F 9.8e+117) (not (<= F 1.56e+237)))
       (- (/ -1.0 B) (/ x (tan B)))
       (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.75e-45) {
		tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
	} else if (F <= 6.5e-133) {
		tmp = ((F * sqrt(0.5)) - x) / B;
	} else if ((F <= 9.8e+117) || !(F <= 1.56e+237)) {
		tmp = (-1.0 / B) - (x / tan(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.75d-45)) then
        tmp = (x * ((-1.0d0) / tan(b))) + ((-1.0d0) / b)
    else if (f <= 6.5d-133) then
        tmp = ((f * sqrt(0.5d0)) - x) / b
    else if ((f <= 9.8d+117) .or. (.not. (f <= 1.56d+237))) then
        tmp = ((-1.0d0) / b) - (x / tan(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.75e-45) {
		tmp = (x * (-1.0 / Math.tan(B))) + (-1.0 / B);
	} else if (F <= 6.5e-133) {
		tmp = ((F * Math.sqrt(0.5)) - x) / B;
	} else if ((F <= 9.8e+117) || !(F <= 1.56e+237)) {
		tmp = (-1.0 / B) - (x / Math.tan(B));
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.75e-45:
		tmp = (x * (-1.0 / math.tan(B))) + (-1.0 / B)
	elif F <= 6.5e-133:
		tmp = ((F * math.sqrt(0.5)) - x) / B
	elif (F <= 9.8e+117) or not (F <= 1.56e+237):
		tmp = (-1.0 / B) - (x / math.tan(B))
	else:
		tmp = (1.0 - x) / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.75e-45)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B));
	elseif (F <= 6.5e-133)
		tmp = Float64(Float64(Float64(F * sqrt(0.5)) - x) / B);
	elseif ((F <= 9.8e+117) || !(F <= 1.56e+237))
		tmp = Float64(Float64(-1.0 / B) - Float64(x / tan(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.75e-45)
		tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
	elseif (F <= 6.5e-133)
		tmp = ((F * sqrt(0.5)) - x) / B;
	elseif ((F <= 9.8e+117) || ~((F <= 1.56e+237)))
		tmp = (-1.0 / B) - (x / tan(B));
	else
		tmp = (1.0 - x) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.75e-45], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.5e-133], N[(N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[Or[LessEqual[F, 9.8e+117], N[Not[LessEqual[F, 1.56e+237]], $MachinePrecision]], N[(N[(-1.0 / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;F \leq 9.8 \cdot 10^{+117} \lor \neg \left(F \leq 1.56 \cdot 10^{+237}\right):\\
\;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\

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


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

    1. Initial program 57.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. metadata-eval57.5%

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

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

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

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

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

    if -1.75e-45 < F < 6.5000000000000002e-133

    1. Initial program 99.4%

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

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

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

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

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

    if 6.5000000000000002e-133 < F < 9.8000000000000002e117 or 1.56e237 < F

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

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

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

    if 9.8000000000000002e117 < F < 1.56e237

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.75 \cdot 10^{-45}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq 6.5 \cdot 10^{-133}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 9.8 \cdot 10^{+117} \lor \neg \left(F \leq 1.56 \cdot 10^{+237}\right):\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 55.5% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -5.8 \cdot 10^{-45}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-133}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 2.45 \cdot 10^{+119} \lor \neg \left(F \leq 3.1 \cdot 10^{+237}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (/ -1.0 B) (/ x (tan B)))))
   (if (<= F -5.8e-45)
     t_0
     (if (<= F 5e-133)
       (/ (- (* F (sqrt 0.5)) x) B)
       (if (or (<= F 2.45e+119) (not (<= F 3.1e+237))) t_0 (/ (- 1.0 x) B))))))
double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / tan(B));
	double tmp;
	if (F <= -5.8e-45) {
		tmp = t_0;
	} else if (F <= 5e-133) {
		tmp = ((F * sqrt(0.5)) - x) / B;
	} else if ((F <= 2.45e+119) || !(F <= 3.1e+237)) {
		tmp = t_0;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((-1.0d0) / b) - (x / tan(b))
    if (f <= (-5.8d-45)) then
        tmp = t_0
    else if (f <= 5d-133) then
        tmp = ((f * sqrt(0.5d0)) - x) / b
    else if ((f <= 2.45d+119) .or. (.not. (f <= 3.1d+237))) then
        tmp = t_0
    else
        tmp = (1.0d0 - x) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = (-1.0 / B) - (x / Math.tan(B));
	double tmp;
	if (F <= -5.8e-45) {
		tmp = t_0;
	} else if (F <= 5e-133) {
		tmp = ((F * Math.sqrt(0.5)) - x) / B;
	} else if ((F <= 2.45e+119) || !(F <= 3.1e+237)) {
		tmp = t_0;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (-1.0 / B) - (x / math.tan(B))
	tmp = 0
	if F <= -5.8e-45:
		tmp = t_0
	elif F <= 5e-133:
		tmp = ((F * math.sqrt(0.5)) - x) / B
	elif (F <= 2.45e+119) or not (F <= 3.1e+237):
		tmp = t_0
	else:
		tmp = (1.0 - x) / B
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(-1.0 / B) - Float64(x / tan(B)))
	tmp = 0.0
	if (F <= -5.8e-45)
		tmp = t_0;
	elseif (F <= 5e-133)
		tmp = Float64(Float64(Float64(F * sqrt(0.5)) - x) / B);
	elseif ((F <= 2.45e+119) || !(F <= 3.1e+237))
		tmp = t_0;
	else
		tmp = Float64(Float64(1.0 - x) / 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 <= -5.8e-45)
		tmp = t_0;
	elseif (F <= 5e-133)
		tmp = ((F * sqrt(0.5)) - x) / B;
	elseif ((F <= 2.45e+119) || ~((F <= 3.1e+237)))
		tmp = t_0;
	else
		tmp = (1.0 - x) / 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, -5.8e-45], t$95$0, If[LessEqual[F, 5e-133], N[(N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[Or[LessEqual[F, 2.45e+119], N[Not[LessEqual[F, 3.1e+237]], $MachinePrecision]], t$95$0, N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;F \leq 2.45 \cdot 10^{+119} \lor \neg \left(F \leq 3.1 \cdot 10^{+237}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -5.8e-45 or 4.9999999999999999e-133 < F < 2.44999999999999998e119 or 3.09999999999999991e237 < F

    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. Simplified80.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 76.7%

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

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

    if -5.8e-45 < F < 4.9999999999999999e-133

    1. Initial program 99.4%

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

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

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

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

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

    if 2.44999999999999998e119 < F < 3.09999999999999991e237

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.8 \cdot 10^{-45}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 5 \cdot 10^{-133}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 2.45 \cdot 10^{+119} \lor \neg \left(F \leq 3.1 \cdot 10^{+237}\right):\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 56.8% accurate, 2.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.00085:\\
\;\;\;\;\frac{F \cdot \sqrt{\frac{1}{2 + \left(F \cdot F + x \cdot 2\right)}} - x}{B}\\

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


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

    1. Initial program 70.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. Simplified83.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 B around 0 57.0%

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

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + \color{blue}{F \cdot F}\right)}} - x}{B} \]
    6. Applied egg-rr57.0%

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

    if 8.49999999999999953e-4 < B

    1. Initial program 83.0%

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

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

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

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

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

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

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

Alternative 17: 62.3% accurate, 2.7× speedup?

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

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

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

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


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

    1. Initial program 57.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. metadata-eval57.5%

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

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

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

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

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

    if -1.2999999999999999e-44 < F < 6.80000000000000012e-133

    1. Initial program 99.4%

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

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

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

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

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

    if 6.80000000000000012e-133 < F

    1. Initial program 62.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.3 \cdot 10^{-44}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq 6.8 \cdot 10^{-133}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 54.7% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq 3.6 \cdot 10^{+119} \lor \neg \left(F \leq 3.3 \cdot 10^{+237}\right):\\
\;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 3.60000000000000001e119 or 3.3000000000000001e237 < F

    1. Initial program 78.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. Simplified88.0%

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

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

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

    if 3.60000000000000001e119 < F < 3.3000000000000001e237

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 3.6 \cdot 10^{+119} \lor \neg \left(F \leq 3.3 \cdot 10^{+237}\right):\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 44.5% accurate, 2.9× speedup?

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

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

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

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

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


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

    1. Initial program 42.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. Simplified66.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.6%

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

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

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

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

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

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

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

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

    if -4.6e72 < F < -8.99999999999999973e-22

    1. Initial program 94.9%

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

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

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

    if -8.99999999999999973e-22 < F < 7.90000000000000033e-87

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

    if 7.90000000000000033e-87 < F

    1. Initial program 58.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. Simplified71.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 89.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -4.6 \cdot 10^{+72}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq -9 \cdot 10^{-22}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 7.9 \cdot 10^{-87}:\\ \;\;\;\;\frac{x}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 44.0% accurate, 21.6× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

    if -1.02e-94 < F < 1.9500000000000001e-86

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

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

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

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

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

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

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

    if 1.9500000000000001e-86 < F

    1. Initial program 58.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. Simplified71.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 89.0%

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

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

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

Alternative 21: 37.2% accurate, 23.1× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

    if -1.12e-94 < F < 2.0500000000000001e105

    1. Initial program 96.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.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 35.6%

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

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

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

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

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

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

    if 2.0500000000000001e105 < F

    1. Initial program 44.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. Simplified57.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 F \cdot \frac{\color{blue}{\frac{1}{F}}}{\sin B} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 54.5%

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

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

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

Alternative 22: 29.9% accurate, 35.9× speedup?

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

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

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


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

    1. Initial program 81.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. Simplified90.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 38.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    8. Simplified31.8%

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

    if 1.94999999999999989e105 < F

    1. Initial program 44.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. Simplified57.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 F \cdot \frac{\color{blue}{\frac{1}{F}}}{\sin B} - \frac{x}{\tan B} \]
    5. Taylor expanded in B around 0 54.5%

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

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

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

Alternative 23: 9.8% accurate, 108.0× speedup?

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

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

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

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

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

Reproduce

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