VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.4% → 99.4%
Time: 16.5s
Alternatives: 22
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 22 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.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -8.2 \cdot 10^{+64}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 600000000:\\ \;\;\;\;\frac{\frac{F}{\sin B}}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} - 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 -8.2e+64)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 600000000.0)
       (- (/ (/ F (sin B)) (sqrt (fma F F 2.0))) t_0)
       (- (/ 1.0 (sin B)) t_0)))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -8.2e+64) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 600000000.0) {
		tmp = ((F / sin(B)) / sqrt(fma(F, F, 2.0))) - 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 <= -8.2e+64)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 600000000.0)
		tmp = Float64(Float64(Float64(F / sin(B)) / sqrt(fma(F, F, 2.0))) - 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, -8.2e+64], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 600000000.0], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(F * F + 2.0), $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 -8.2 \cdot 10^{+64}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\

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

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


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

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

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

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

    if -8.19999999999999956e64 < F < 6e8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{F}{\sin B}}{\color{blue}{\sqrt{2 + {F}^{2}}}} - \frac{x}{\tan B} \]
    12. Step-by-step derivation
      1. +-commutative99.6%

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

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

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

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

    if 6e8 < F

    1. Initial program 64.0%

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

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

Alternative 2: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -2000000000000:\\ \;\;\;\;\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 -2000000000000.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 <= -2000000000000.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 <= (-2000000000000.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 <= -2000000000000.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 <= -2000000000000.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 <= -2000000000000.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 <= -2000000000000.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, -2000000000000.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 -2000000000000:\\
\;\;\;\;\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 < -2e12

    1. Initial program 54.0%

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

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

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

    if -2e12 < 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 64.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2000000000000:\\ \;\;\;\;\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 3: 99.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.2%

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

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

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

    if -1.44999999999999996 < F < 1.44999999999999996

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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} \]
    8. Taylor expanded in F around 0 98.5%

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

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

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

    if 1.44999999999999996 < F

    1. Initial program 64.9%

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

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

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

Alternative 4: 99.1% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq 1.42:\\
\;\;\;\;\frac{\frac{F}{\sin B}}{\sqrt{2}} - t\_0\\

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


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

    1. Initial program 57.2%

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

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

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

    if -1.44999999999999996 < F < 1.4199999999999999

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{F}{\sin B}}{\color{blue}{\sqrt{2 + {F}^{2}}}} - \frac{x}{\tan B} \]
    12. Step-by-step derivation
      1. +-commutative99.6%

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

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

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

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

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

    if 1.4199999999999999 < F

    1. Initial program 64.9%

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

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

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

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

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

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


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

    1. Initial program 57.2%

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

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

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

    if -1.44999999999999996 < F < 1.4199999999999999

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{F}{\sin B}}{\color{blue}{\sqrt{2 + {F}^{2}}}} - \frac{x}{\tan B} \]
    12. Step-by-step derivation
      1. +-commutative99.6%

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

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

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

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

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

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

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

    if 1.4199999999999999 < F

    1. Initial program 64.9%

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

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

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

Alternative 6: 92.7% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -7.2 \cdot 10^{-112}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;F \leq 4.9 \cdot 10^{-138}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + t\_0 \cdot \frac{F}{B}\\

\mathbf{elif}\;F \leq 3200000:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 55.9%

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

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

    if -9e9 < F < -7.2000000000000002e-112 or 4.90000000000000016e-138 < F < 3.2e6

    1. Initial program 99.4%

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

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

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

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

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

    if -7.2000000000000002e-112 < F < 4.90000000000000016e-138

    1. Initial program 99.4%

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

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

    if 3.2e6 < F

    1. Initial program 64.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -9000000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -7.2 \cdot 10^{-112}:\\ \;\;\;\;\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 4.9 \cdot 10^{-138}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B}\\ \mathbf{elif}\;F \leq 3200000:\\ \;\;\;\;\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: 89.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ t_1 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -9000000000:\\ \;\;\;\;\frac{-1}{\sin B} - t\_1\\ \mathbf{elif}\;F \leq -1 \cdot 10^{-147}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 1.6 \cdot 10^{-216}:\\ \;\;\;\;-x \cdot \frac{\cos B}{\sin B}\\ \mathbf{elif}\;F \leq 3200000:\\ \;\;\;\;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 -9000000000.0)
     (- (/ -1.0 (sin B)) t_1)
     (if (<= F -1e-147)
       t_0
       (if (<= F 1.6e-216)
         (- (* x (/ (cos B) (sin B))))
         (if (<= F 3200000.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 <= -9000000000.0) {
		tmp = (-1.0 / sin(B)) - t_1;
	} else if (F <= -1e-147) {
		tmp = t_0;
	} else if (F <= 1.6e-216) {
		tmp = -(x * (cos(B) / sin(B)));
	} else if (F <= 3200000.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 <= (-9000000000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_1
    else if (f <= (-1d-147)) then
        tmp = t_0
    else if (f <= 1.6d-216) then
        tmp = -(x * (cos(b) / sin(b)))
    else if (f <= 3200000.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 <= -9000000000.0) {
		tmp = (-1.0 / Math.sin(B)) - t_1;
	} else if (F <= -1e-147) {
		tmp = t_0;
	} else if (F <= 1.6e-216) {
		tmp = -(x * (Math.cos(B) / Math.sin(B)));
	} else if (F <= 3200000.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 <= -9000000000.0:
		tmp = (-1.0 / math.sin(B)) - t_1
	elif F <= -1e-147:
		tmp = t_0
	elif F <= 1.6e-216:
		tmp = -(x * (math.cos(B) / math.sin(B)))
	elif F <= 3200000.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 <= -9000000000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_1);
	elseif (F <= -1e-147)
		tmp = t_0;
	elseif (F <= 1.6e-216)
		tmp = Float64(-Float64(x * Float64(cos(B) / sin(B))));
	elseif (F <= 3200000.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 <= -9000000000.0)
		tmp = (-1.0 / sin(B)) - t_1;
	elseif (F <= -1e-147)
		tmp = t_0;
	elseif (F <= 1.6e-216)
		tmp = -(x * (cos(B) / sin(B)));
	elseif (F <= 3200000.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, -9000000000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, -1e-147], t$95$0, If[LessEqual[F, 1.6e-216], (-N[(x * N[(N[Cos[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 3200000.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 -9000000000:\\
\;\;\;\;\frac{-1}{\sin B} - t\_1\\

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

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

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

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


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

    1. Initial program 55.9%

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

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

    if -9e9 < F < -9.9999999999999997e-148 or 1.60000000000000013e-216 < F < 3.2e6

    1. Initial program 99.4%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0 83.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)}^{\left(-\frac{1}{2}\right)} \]
    4. Step-by-step derivation
      1. associate-*r/83.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)}^{\left(-\frac{1}{2}\right)} \]
      2. neg-mul-183.2%

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

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

    if -9.9999999999999997e-148 < F < 1.60000000000000013e-216

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.2e6 < F

    1. Initial program 64.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -9000000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1 \cdot 10^{-147}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.6 \cdot 10^{-216}:\\ \;\;\;\;-x \cdot \frac{\cos B}{\sin B}\\ \mathbf{elif}\;F \leq 3200000:\\ \;\;\;\;\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 8: 85.1% accurate, 1.4× speedup?

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

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

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

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

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

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


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

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

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

    if -1.85000000000000007e-10 < F < -7.5000000000000004e-116

    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 B around 0 60.4%

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

      \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}} - x}{B} \]
    6. Step-by-step derivation
      1. *-commutative60.4%

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

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

    if -7.5000000000000004e-116 < F < 1.6500000000000001e-137

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.6500000000000001e-137 < F < 85

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

    1. Initial program 64.5%

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

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

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

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

Alternative 9: 78.7% accurate, 1.5× speedup?

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

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

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

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

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

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


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

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

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

    if -8.0000000000000005e-9 < F < -1.55000000000000003e-115

    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 B around 0 60.4%

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

      \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}} - x}{B} \]
    6. Step-by-step derivation
      1. *-commutative60.4%

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

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

    if -1.55000000000000003e-115 < F < 4.90000000000000031e-139

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.90000000000000031e-139 < F < 960

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

    1. Initial program 64.5%

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

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

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

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

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

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

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

Alternative 10: 71.9% accurate, 1.5× speedup?

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

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

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

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

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

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


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

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

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

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

    if -6.5000000000000003e-9 < F < -7.5000000000000002e-112

    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 B around 0 60.4%

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

      \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}} - x}{B} \]
    6. Step-by-step derivation
      1. *-commutative60.4%

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

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

    if -7.5000000000000002e-112 < F < 3.4000000000000001e-138

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.4000000000000001e-138 < F < 1100

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

    1. Initial program 64.5%

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

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

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

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

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

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

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

Alternative 11: 72.0% accurate, 1.5× speedup?

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

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

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

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

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

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


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

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

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

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

    if -8.0000000000000005e-9 < F < -4.8000000000000001e-112

    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 B around 0 60.4%

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

      \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}} - x}{B} \]
    6. Step-by-step derivation
      1. *-commutative60.4%

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

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

    if -4.8000000000000001e-112 < F < 5.7999999999999998e-139

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} + \left(-\frac{x}{\tan B}\right)} \]
    9. Step-by-step derivation
      1. sub-neg99.7%

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

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

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

      \[\leadsto \frac{\frac{F}{\sin B}}{\color{blue}{\sqrt{2 + {F}^{2}}}} - \frac{x}{\tan B} \]
    12. Step-by-step derivation
      1. +-commutative99.7%

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
    16. Simplified77.2%

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

    if 5.7999999999999998e-139 < F < 1500

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

    1. Initial program 64.5%

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

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

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

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

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

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

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

Alternative 12: 64.9% accurate, 2.6× speedup?

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

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

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

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


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

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

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

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

    if -6.3000000000000002e-9 < F < 430

    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 B around 0 54.5%

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

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

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

    if 430 < F

    1. Initial program 64.5%

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

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

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

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

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

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

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

Alternative 13: 64.8% accurate, 2.6× speedup?

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

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

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

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


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

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

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

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

    if -7.49999999999999933e-9 < F < 0.0560000000000000012

    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 B around 0 54.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B} + \frac{F}{B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}} \]
    6. Step-by-step derivation
      1. mul-1-neg54.0%

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot \frac{F}{B}} - \frac{x}{B} \]
      5. *-commutative54.0%

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

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

    if 0.0560000000000000012 < F

    1. Initial program 64.9%

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

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

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

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

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

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

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

Alternative 14: 64.8% accurate, 2.6× speedup?

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

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

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

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


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

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

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

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

    if -2.8499999999999999e-9 < F < 0.19

    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 B around 0 54.0%

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

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

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

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

    if 0.19 < F

    1. Initial program 64.9%

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

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

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

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

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

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

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

Alternative 15: 62.5% accurate, 2.8× speedup?

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

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

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


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

    1. Initial program 82.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. Simplified91.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 57.6%

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

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

    if 6.00000000000000007e-43 < F

    1. Initial program 67.0%

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

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

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

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

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

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

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

Alternative 16: 62.3% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq 4.1 \cdot 10^{-44}:\\ \;\;\;\;\frac{-1}{B} - t\_0\\ \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 4.1e-44) (- (/ -1.0 B) t_0) (- (* 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 <= 4.1e-44) {
		tmp = (-1.0 / B) - t_0;
	} 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 <= 4.1d-44) then
        tmp = ((-1.0d0) / b) - t_0
    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 <= 4.1e-44) {
		tmp = (-1.0 / B) - t_0;
	} 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 <= 4.1e-44:
		tmp = (-1.0 / B) - t_0
	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 <= 4.1e-44)
		tmp = Float64(Float64(-1.0 / B) - t_0);
	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 <= 4.1e-44)
		tmp = (-1.0 / B) - t_0;
	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, 4.1e-44], N[(N[(-1.0 / B), $MachinePrecision] - t$95$0), $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 4.1 \cdot 10^{-44}:\\
\;\;\;\;\frac{-1}{B} - t\_0\\

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


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

    1. Initial program 82.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. Simplified91.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 57.6%

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

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

    if 4.09999999999999992e-44 < F

    1. Initial program 67.0%

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

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

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

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

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

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

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

Alternative 17: 55.4% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq 2.5 \cdot 10^{-59}:\\ \;\;\;\;\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 2.5e-59) (- (/ -1.0 B) (/ x (tan B))) (/ (- 1.0 x) B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= 2.5e-59) {
		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 <= 2.5d-59) 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 <= 2.5e-59) {
		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 <= 2.5e-59:
		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 <= 2.5e-59)
		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 <= 2.5e-59)
		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, 2.5e-59], 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 2.5 \cdot 10^{-59}:\\
\;\;\;\;\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 < 2.5000000000000001e-59

    1. Initial program 81.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. Simplified91.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 58.4%

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

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

    if 2.5000000000000001e-59 < F

    1. Initial program 68.5%

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

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

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

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

Alternative 18: 44.5% accurate, 21.6× speedup?

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

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

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

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


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

    1. Initial program 66.8%

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

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

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

    if -2.2e-111 < F < 7.8000000000000007e-62

    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 B around 0 50.8%

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

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

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

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

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

    if 7.8000000000000007e-62 < F

    1. Initial program 68.5%

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

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

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

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

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

Alternative 19: 31.8% accurate, 23.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.1 \cdot 10^{-124} \lor \neg \left(x \leq 4.5 \cdot 10^{-138}\right):\\
\;\;\;\;\frac{x}{-B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.1000000000000001e-124 or 4.50000000000000008e-138 < x

    1. Initial program 78.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. Simplified89.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 B around 0 47.5%

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

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

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

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

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

    if -5.1000000000000001e-124 < x < 4.50000000000000008e-138

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1 - \frac{1}{{F}^{2}}}{B}} \]
    9. Taylor expanded in F around inf 19.7%

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

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

Alternative 20: 37.3% accurate, 23.1× speedup?

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

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

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

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


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

    1. Initial program 66.8%

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

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

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

    if -2.2e-111 < F < 6.00000000000000017e230

    1. Initial program 89.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. Simplified92.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 B around 0 48.9%

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

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

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

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

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

    if 6.00000000000000017e230 < F

    1. Initial program 35.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. Simplified37.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 B around 0 12.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{1 - \frac{1}{{F}^{2}}}{B}} \]
    9. Taylor expanded in F around inf 45.9%

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

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

Alternative 21: 17.9% accurate, 40.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq 6.5 \cdot 10^{-167}:\\
\;\;\;\;\frac{-1}{B}\\

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


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

    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. Simplified89.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 B around 0 49.4%

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

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

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

    if 6.49999999999999973e-167 < F

    1. Initial program 74.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1 - \frac{1}{{F}^{2}}}{B}} \]
    9. Taylor expanded in F around inf 23.3%

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

Alternative 22: 10.9% accurate, 108.0× speedup?

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

\\
\frac{-1}{B}
\end{array}
Derivation
  1. Initial program 77.1%

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

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

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

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

Reproduce

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