VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.4% → 99.7%
Time: 17.1s
Alternatives: 20
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 20 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.7% accurate, 0.6× speedup?

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

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

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

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


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

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

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

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

    if -1.00000000000000003e83 < F < 5.99999999999999953e27

    1. Initial program 99.3%

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

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

    if 5.99999999999999953e27 < F

    1. Initial program 52.7%

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

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

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

Alternative 2: 97.8% accurate, 1.0× speedup?

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

\mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\
\;\;\;\;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 < -5e5

    1. Initial program 55.3%

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

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

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

    if -5e5 < F < 7.0000000000000006e-30

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

    if 7.0000000000000006e-30 < F

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

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

Alternative 3: 88.8% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -4.5 \cdot 10^{-214}:\\
\;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - \frac{x}{B}\\

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

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

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


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

    1. Initial program 56.0%

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

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

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

    if -0.010999999999999999 < F < -4.5000000000000001e-214

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

    if -4.5000000000000001e-214 < F < 1.10000000000000007e-170

    1. Initial program 99.3%

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

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

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

    if 1.10000000000000007e-170 < F < 7.0000000000000006e-30

    1. Initial program 99.3%

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

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

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

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

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

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

    if 7.0000000000000006e-30 < F

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.011:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -4.5 \cdot 10^{-214}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.1 \cdot 10^{-170}:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\ \;\;\;\;F \cdot \frac{\sqrt{\frac{1}{2 + x \cdot 2}}}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 88.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := F \cdot \frac{\sqrt{0.5}}{\sin B} - \frac{x}{B}\\ t_1 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -0.00105:\\ \;\;\;\;\frac{-1}{\sin B} - t\_1\\ \mathbf{elif}\;F \leq -2.3 \cdot 10^{-213}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 7.4 \cdot 10^{-172}:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - t\_1\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (* F (/ (sqrt 0.5) (sin B))) (/ x B))) (t_1 (/ x (tan B))))
   (if (<= F -0.00105)
     (- (/ -1.0 (sin B)) t_1)
     (if (<= F -2.3e-213)
       t_0
       (if (<= F 7.4e-172)
         (/ (* x (cos B)) (- (sin B)))
         (if (<= F 7e-30) t_0 (- (/ 1.0 (sin B)) t_1)))))))
double code(double F, double B, double x) {
	double t_0 = (F * (sqrt(0.5) / sin(B))) - (x / B);
	double t_1 = x / tan(B);
	double tmp;
	if (F <= -0.00105) {
		tmp = (-1.0 / sin(B)) - t_1;
	} else if (F <= -2.3e-213) {
		tmp = t_0;
	} else if (F <= 7.4e-172) {
		tmp = (x * cos(B)) / -sin(B);
	} else if (F <= 7e-30) {
		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 * (sqrt(0.5d0) / sin(b))) - (x / b)
    t_1 = x / tan(b)
    if (f <= (-0.00105d0)) then
        tmp = ((-1.0d0) / sin(b)) - t_1
    else if (f <= (-2.3d-213)) then
        tmp = t_0
    else if (f <= 7.4d-172) then
        tmp = (x * cos(b)) / -sin(b)
    else if (f <= 7d-30) 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.sqrt(0.5) / Math.sin(B))) - (x / B);
	double t_1 = x / Math.tan(B);
	double tmp;
	if (F <= -0.00105) {
		tmp = (-1.0 / Math.sin(B)) - t_1;
	} else if (F <= -2.3e-213) {
		tmp = t_0;
	} else if (F <= 7.4e-172) {
		tmp = (x * Math.cos(B)) / -Math.sin(B);
	} else if (F <= 7e-30) {
		tmp = t_0;
	} else {
		tmp = (1.0 / Math.sin(B)) - t_1;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (F * (math.sqrt(0.5) / math.sin(B))) - (x / B)
	t_1 = x / math.tan(B)
	tmp = 0
	if F <= -0.00105:
		tmp = (-1.0 / math.sin(B)) - t_1
	elif F <= -2.3e-213:
		tmp = t_0
	elif F <= 7.4e-172:
		tmp = (x * math.cos(B)) / -math.sin(B)
	elif F <= 7e-30:
		tmp = t_0
	else:
		tmp = (1.0 / math.sin(B)) - t_1
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(F * Float64(sqrt(0.5) / sin(B))) - Float64(x / B))
	t_1 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -0.00105)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_1);
	elseif (F <= -2.3e-213)
		tmp = t_0;
	elseif (F <= 7.4e-172)
		tmp = Float64(Float64(x * cos(B)) / Float64(-sin(B)));
	elseif (F <= 7e-30)
		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 * (sqrt(0.5) / sin(B))) - (x / B);
	t_1 = x / tan(B);
	tmp = 0.0;
	if (F <= -0.00105)
		tmp = (-1.0 / sin(B)) - t_1;
	elseif (F <= -2.3e-213)
		tmp = t_0;
	elseif (F <= 7.4e-172)
		tmp = (x * cos(B)) / -sin(B);
	elseif (F <= 7e-30)
		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[(F * N[(N[Sqrt[0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.00105], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, -2.3e-213], t$95$0, If[LessEqual[F, 7.4e-172], N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 7e-30], t$95$0, N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -2.3 \cdot 10^{-213}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 56.0%

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

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

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

    if -0.00104999999999999994 < F < -2.30000000000000003e-213 or 7.40000000000000001e-172 < F < 7.0000000000000006e-30

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

    if -2.30000000000000003e-213 < F < 7.40000000000000001e-172

    1. Initial program 99.3%

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

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

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

    if 7.0000000000000006e-30 < F

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.00105:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -2.3 \cdot 10^{-213}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 7.4 \cdot 10^{-172}:\\ \;\;\;\;\frac{x \cdot \cos B}{-\sin B}\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 83.7% accurate, 1.5× speedup?

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

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

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

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

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


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

    1. Initial program 56.0%

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

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

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

    if -9.49999999999999951e-11 < F < -2.99999999999999986e-213

    1. Initial program 99.2%

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

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

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

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

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

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

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

    if -2.99999999999999986e-213 < F < 1.8199999999999999e-53

    1. Initial program 99.3%

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

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

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

    if 1.8199999999999999e-53 < F

    1. Initial program 61.5%

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

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

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

Alternative 6: 76.8% accurate, 1.5× speedup?

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

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

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

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

\mathbf{elif}\;F \leq 5.4 \cdot 10^{+253}:\\
\;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\

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


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

    1. Initial program 56.0%

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

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

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

    if -1.06e-7 < F < -2.99999999999999986e-213

    1. Initial program 99.2%

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

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

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

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

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

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

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

    if -2.99999999999999986e-213 < F < 2.65e-53

    1. Initial program 99.3%

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

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

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

    if 2.65e-53 < F < 5.40000000000000005e253

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

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

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

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

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

    if 5.40000000000000005e253 < F

    1. Initial program 50.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. Simplified64.9%

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

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

Alternative 7: 69.7% accurate, 1.5× speedup?

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

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

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

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

\mathbf{elif}\;F \leq 5.5 \cdot 10^{+254}:\\
\;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\

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


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

    1. Initial program 56.0%

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

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

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

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

    if -1.35000000000000001e-8 < F < -2.8999999999999999e-213

    1. Initial program 99.2%

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

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

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

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

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

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

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

    if -2.8999999999999999e-213 < F < 2.65e-53

    1. Initial program 99.3%

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

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

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

    if 2.65e-53 < F < 5.50000000000000004e254

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

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

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

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

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

    if 5.50000000000000004e254 < F

    1. Initial program 50.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. Simplified64.9%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around inf 99.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 \color{blue}{\frac{1}{B}} - \frac{x}{\tan B} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification72.8%

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

Alternative 8: 69.6% accurate, 1.5× speedup?

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

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

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

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

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

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


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

    1. Initial program 56.0%

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

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

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

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

    if -3.60000000000000009e-5 < F < -2.7e-218

    1. Initial program 99.2%

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

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

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

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

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

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

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

    if -2.7e-218 < F < 2.65e-53

    1. Initial program 99.3%

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

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

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

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

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

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

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

    if 2.65e-53 < F < 5.9999999999999996e253

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

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

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

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

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

    if 5.9999999999999996e253 < F

    1. Initial program 50.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. Simplified64.9%

      \[\leadsto \color{blue}{F \cdot \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B} - \frac{x}{\tan B}} \]
    3. Add Preprocessing
    4. Taylor expanded in F around inf 99.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 \color{blue}{\frac{1}{B}} - \frac{x}{\tan B} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification72.7%

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

Alternative 9: 63.8% accurate, 2.4× speedup?

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

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

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

\mathbf{elif}\;F \leq 3 \cdot 10^{-247}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;F \leq 5 \cdot 10^{+254}:\\
\;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\

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


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

    1. Initial program 56.0%

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

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

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

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

    if -0.00139999999999999999 < F < -1.9e-216

    1. Initial program 99.2%

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

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

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

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

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

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

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

    if -1.9e-216 < F < 2.9999999999999997e-247 or 4.99999999999999994e254 < F

    1. Initial program 84.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. Simplified88.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 60.9%

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

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

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

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

    if 2.9999999999999997e-247 < F < 7.0000000000000006e-30

    1. Initial program 99.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    10. Taylor expanded in B around 0 57.4%

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

    if 7.0000000000000006e-30 < F < 4.99999999999999994e254

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.0014:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -1.9 \cdot 10^{-216}:\\ \;\;\;\;F \cdot \left(\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{1}{B}\right) - \frac{x}{B}\\ \mathbf{elif}\;F \leq 3 \cdot 10^{-247}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 5 \cdot 10^{+254}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 63.9% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ t_1 := \frac{1}{B} - t\_0\\ \mathbf{if}\;F \leq -1.1 \cdot 10^{-5}:\\ \;\;\;\;\frac{-1}{B} - t\_0\\ \mathbf{elif}\;F \leq -2.8 \cdot 10^{-217}:\\ \;\;\;\;F \cdot \frac{\sqrt{\frac{1}{2 + x \cdot 2}}}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.08 \cdot 10^{-244}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 2.7 \cdot 10^{+254}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))) (t_1 (- (/ 1.0 B) t_0)))
   (if (<= F -1.1e-5)
     (- (/ -1.0 B) t_0)
     (if (<= F -2.8e-217)
       (- (* F (/ (sqrt (/ 1.0 (+ 2.0 (* x 2.0)))) B)) (/ x B))
       (if (<= F 1.08e-244)
         t_1
         (if (<= F 7e-30)
           (/ (- (* F (sqrt 0.5)) x) B)
           (if (<= F 2.7e+254)
             (- (* F (/ 1.0 (* F (sin B)))) (/ x B))
             t_1)))))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double t_1 = (1.0 / B) - t_0;
	double tmp;
	if (F <= -1.1e-5) {
		tmp = (-1.0 / B) - t_0;
	} else if (F <= -2.8e-217) {
		tmp = (F * (sqrt((1.0 / (2.0 + (x * 2.0)))) / B)) - (x / B);
	} else if (F <= 1.08e-244) {
		tmp = t_1;
	} else if (F <= 7e-30) {
		tmp = ((F * sqrt(0.5)) - x) / B;
	} else if (F <= 2.7e+254) {
		tmp = (F * (1.0 / (F * sin(B)))) - (x / B);
	} else {
		tmp = 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 = x / tan(b)
    t_1 = (1.0d0 / b) - t_0
    if (f <= (-1.1d-5)) then
        tmp = ((-1.0d0) / b) - t_0
    else if (f <= (-2.8d-217)) then
        tmp = (f * (sqrt((1.0d0 / (2.0d0 + (x * 2.0d0)))) / b)) - (x / b)
    else if (f <= 1.08d-244) then
        tmp = t_1
    else if (f <= 7d-30) then
        tmp = ((f * sqrt(0.5d0)) - x) / b
    else if (f <= 2.7d+254) then
        tmp = (f * (1.0d0 / (f * sin(b)))) - (x / b)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x / Math.tan(B);
	double t_1 = (1.0 / B) - t_0;
	double tmp;
	if (F <= -1.1e-5) {
		tmp = (-1.0 / B) - t_0;
	} else if (F <= -2.8e-217) {
		tmp = (F * (Math.sqrt((1.0 / (2.0 + (x * 2.0)))) / B)) - (x / B);
	} else if (F <= 1.08e-244) {
		tmp = t_1;
	} else if (F <= 7e-30) {
		tmp = ((F * Math.sqrt(0.5)) - x) / B;
	} else if (F <= 2.7e+254) {
		tmp = (F * (1.0 / (F * Math.sin(B)))) - (x / B);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	t_1 = (1.0 / B) - t_0
	tmp = 0
	if F <= -1.1e-5:
		tmp = (-1.0 / B) - t_0
	elif F <= -2.8e-217:
		tmp = (F * (math.sqrt((1.0 / (2.0 + (x * 2.0)))) / B)) - (x / B)
	elif F <= 1.08e-244:
		tmp = t_1
	elif F <= 7e-30:
		tmp = ((F * math.sqrt(0.5)) - x) / B
	elif F <= 2.7e+254:
		tmp = (F * (1.0 / (F * math.sin(B)))) - (x / B)
	else:
		tmp = t_1
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	t_1 = Float64(Float64(1.0 / B) - t_0)
	tmp = 0.0
	if (F <= -1.1e-5)
		tmp = Float64(Float64(-1.0 / B) - t_0);
	elseif (F <= -2.8e-217)
		tmp = Float64(Float64(F * Float64(sqrt(Float64(1.0 / Float64(2.0 + Float64(x * 2.0)))) / B)) - Float64(x / B));
	elseif (F <= 1.08e-244)
		tmp = t_1;
	elseif (F <= 7e-30)
		tmp = Float64(Float64(Float64(F * sqrt(0.5)) - x) / B);
	elseif (F <= 2.7e+254)
		tmp = Float64(Float64(F * Float64(1.0 / Float64(F * sin(B)))) - Float64(x / B));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	t_1 = (1.0 / B) - t_0;
	tmp = 0.0;
	if (F <= -1.1e-5)
		tmp = (-1.0 / B) - t_0;
	elseif (F <= -2.8e-217)
		tmp = (F * (sqrt((1.0 / (2.0 + (x * 2.0)))) / B)) - (x / B);
	elseif (F <= 1.08e-244)
		tmp = t_1;
	elseif (F <= 7e-30)
		tmp = ((F * sqrt(0.5)) - x) / B;
	elseif (F <= 2.7e+254)
		tmp = (F * (1.0 / (F * sin(B)))) - (x / B);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[F, -1.1e-5], N[(N[(-1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, -2.8e-217], N[(N[(F * N[(N[Sqrt[N[(1.0 / N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.08e-244], t$95$1, If[LessEqual[F, 7e-30], N[(N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.7e+254], N[(N[(F * N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;F \leq 1.08 \cdot 10^{-244}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;F \leq 2.7 \cdot 10^{+254}:\\
\;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\

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


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

    1. Initial program 56.0%

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

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

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

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

    if -1.1e-5 < F < -2.8e-217

    1. Initial program 99.2%

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

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

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

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

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

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

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

    if -2.8e-217 < F < 1.07999999999999996e-244 or 2.70000000000000022e254 < F

    1. Initial program 84.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. Simplified88.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 60.9%

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

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

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

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

    if 1.07999999999999996e-244 < F < 7.0000000000000006e-30

    1. Initial program 99.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    10. Taylor expanded in B around 0 57.4%

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

    if 7.0000000000000006e-30 < F < 2.70000000000000022e254

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.1 \cdot 10^{-5}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -2.8 \cdot 10^{-217}:\\ \;\;\;\;F \cdot \frac{\sqrt{\frac{1}{2 + x \cdot 2}}}{B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.08 \cdot 10^{-244}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 2.7 \cdot 10^{+254}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 63.8% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{F \cdot \sqrt{0.5} - x}{B}\\ t_1 := \frac{x}{\tan B}\\ t_2 := \frac{1}{B} - t\_1\\ \mathbf{if}\;F \leq -0.000105:\\ \;\;\;\;\frac{-1}{B} - t\_1\\ \mathbf{elif}\;F \leq -5 \cdot 10^{-217}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 2.75 \cdot 10^{-247}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 6.5 \cdot 10^{+252}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ (- (* F (sqrt 0.5)) x) B))
        (t_1 (/ x (tan B)))
        (t_2 (- (/ 1.0 B) t_1)))
   (if (<= F -0.000105)
     (- (/ -1.0 B) t_1)
     (if (<= F -5e-217)
       t_0
       (if (<= F 2.75e-247)
         t_2
         (if (<= F 7e-30)
           t_0
           (if (<= F 6.5e+252)
             (- (* F (/ 1.0 (* F (sin B)))) (/ x B))
             t_2)))))))
double code(double F, double B, double x) {
	double t_0 = ((F * sqrt(0.5)) - x) / B;
	double t_1 = x / tan(B);
	double t_2 = (1.0 / B) - t_1;
	double tmp;
	if (F <= -0.000105) {
		tmp = (-1.0 / B) - t_1;
	} else if (F <= -5e-217) {
		tmp = t_0;
	} else if (F <= 2.75e-247) {
		tmp = t_2;
	} else if (F <= 7e-30) {
		tmp = t_0;
	} else if (F <= 6.5e+252) {
		tmp = (F * (1.0 / (F * sin(B)))) - (x / B);
	} else {
		tmp = 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 = ((f * sqrt(0.5d0)) - x) / b
    t_1 = x / tan(b)
    t_2 = (1.0d0 / b) - t_1
    if (f <= (-0.000105d0)) then
        tmp = ((-1.0d0) / b) - t_1
    else if (f <= (-5d-217)) then
        tmp = t_0
    else if (f <= 2.75d-247) then
        tmp = t_2
    else if (f <= 7d-30) then
        tmp = t_0
    else if (f <= 6.5d+252) then
        tmp = (f * (1.0d0 / (f * sin(b)))) - (x / b)
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = ((F * Math.sqrt(0.5)) - x) / B;
	double t_1 = x / Math.tan(B);
	double t_2 = (1.0 / B) - t_1;
	double tmp;
	if (F <= -0.000105) {
		tmp = (-1.0 / B) - t_1;
	} else if (F <= -5e-217) {
		tmp = t_0;
	} else if (F <= 2.75e-247) {
		tmp = t_2;
	} else if (F <= 7e-30) {
		tmp = t_0;
	} else if (F <= 6.5e+252) {
		tmp = (F * (1.0 / (F * Math.sin(B)))) - (x / B);
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = ((F * math.sqrt(0.5)) - x) / B
	t_1 = x / math.tan(B)
	t_2 = (1.0 / B) - t_1
	tmp = 0
	if F <= -0.000105:
		tmp = (-1.0 / B) - t_1
	elif F <= -5e-217:
		tmp = t_0
	elif F <= 2.75e-247:
		tmp = t_2
	elif F <= 7e-30:
		tmp = t_0
	elif F <= 6.5e+252:
		tmp = (F * (1.0 / (F * math.sin(B)))) - (x / B)
	else:
		tmp = t_2
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(Float64(F * sqrt(0.5)) - x) / B)
	t_1 = Float64(x / tan(B))
	t_2 = Float64(Float64(1.0 / B) - t_1)
	tmp = 0.0
	if (F <= -0.000105)
		tmp = Float64(Float64(-1.0 / B) - t_1);
	elseif (F <= -5e-217)
		tmp = t_0;
	elseif (F <= 2.75e-247)
		tmp = t_2;
	elseif (F <= 7e-30)
		tmp = t_0;
	elseif (F <= 6.5e+252)
		tmp = Float64(Float64(F * Float64(1.0 / Float64(F * sin(B)))) - Float64(x / B));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = ((F * sqrt(0.5)) - x) / B;
	t_1 = x / tan(B);
	t_2 = (1.0 / B) - t_1;
	tmp = 0.0;
	if (F <= -0.000105)
		tmp = (-1.0 / B) - t_1;
	elseif (F <= -5e-217)
		tmp = t_0;
	elseif (F <= 2.75e-247)
		tmp = t_2;
	elseif (F <= 7e-30)
		tmp = t_0;
	elseif (F <= 6.5e+252)
		tmp = (F * (1.0 / (F * sin(B)))) - (x / B);
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / B), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[F, -0.000105], N[(N[(-1.0 / B), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, -5e-217], t$95$0, If[LessEqual[F, 2.75e-247], t$95$2, If[LessEqual[F, 7e-30], t$95$0, If[LessEqual[F, 6.5e+252], N[(N[(F * N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{F \cdot \sqrt{0.5} - x}{B}\\
t_1 := \frac{x}{\tan B}\\
t_2 := \frac{1}{B} - t\_1\\
\mathbf{if}\;F \leq -0.000105:\\
\;\;\;\;\frac{-1}{B} - t\_1\\

\mathbf{elif}\;F \leq -5 \cdot 10^{-217}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 2.75 \cdot 10^{-247}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 6.5 \cdot 10^{+252}:\\
\;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\

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


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

    1. Initial program 56.0%

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

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

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

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

    if -1.05e-4 < F < -5.0000000000000002e-217 or 2.74999999999999997e-247 < F < 7.0000000000000006e-30

    1. Initial program 99.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    10. Taylor expanded in B around 0 55.4%

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

    if -5.0000000000000002e-217 < F < 2.74999999999999997e-247 or 6.5e252 < F

    1. Initial program 84.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. Simplified88.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 60.9%

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

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

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

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

    if 7.0000000000000006e-30 < F < 6.5e252

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.000105:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -5 \cdot 10^{-217}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 2.75 \cdot 10^{-247}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 7 \cdot 10^{-30}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{elif}\;F \leq 6.5 \cdot 10^{+252}:\\ \;\;\;\;F \cdot \frac{1}{F \cdot \sin B} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 63.1% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1.35 \cdot 10^{-6}:\\ \;\;\;\;\frac{-1}{B} - t\_0\\ \mathbf{elif}\;F \leq -6 \cdot 10^{-217} \lor \neg \left(F \leq 1.35 \cdot 10^{-248}\right) \land F \leq 2.5 \cdot 10^{-56}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ x (tan B))))
   (if (<= F -1.35e-6)
     (- (/ -1.0 B) t_0)
     (if (or (<= F -6e-217) (and (not (<= F 1.35e-248)) (<= F 2.5e-56)))
       (/ (- (* F (sqrt 0.5)) x) B)
       (- (/ 1.0 B) t_0)))))
double code(double F, double B, double x) {
	double t_0 = x / tan(B);
	double tmp;
	if (F <= -1.35e-6) {
		tmp = (-1.0 / B) - t_0;
	} else if ((F <= -6e-217) || (!(F <= 1.35e-248) && (F <= 2.5e-56))) {
		tmp = ((F * sqrt(0.5)) - x) / B;
	} else {
		tmp = (1.0 / B) - t_0;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x / tan(b)
    if (f <= (-1.35d-6)) then
        tmp = ((-1.0d0) / b) - t_0
    else if ((f <= (-6d-217)) .or. (.not. (f <= 1.35d-248)) .and. (f <= 2.5d-56)) then
        tmp = ((f * sqrt(0.5d0)) - x) / b
    else
        tmp = (1.0d0 / b) - t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x / Math.tan(B);
	double tmp;
	if (F <= -1.35e-6) {
		tmp = (-1.0 / B) - t_0;
	} else if ((F <= -6e-217) || (!(F <= 1.35e-248) && (F <= 2.5e-56))) {
		tmp = ((F * Math.sqrt(0.5)) - x) / B;
	} else {
		tmp = (1.0 / B) - t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x / math.tan(B)
	tmp = 0
	if F <= -1.35e-6:
		tmp = (-1.0 / B) - t_0
	elif (F <= -6e-217) or (not (F <= 1.35e-248) and (F <= 2.5e-56)):
		tmp = ((F * math.sqrt(0.5)) - x) / B
	else:
		tmp = (1.0 / B) - t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(x / tan(B))
	tmp = 0.0
	if (F <= -1.35e-6)
		tmp = Float64(Float64(-1.0 / B) - t_0);
	elseif ((F <= -6e-217) || (!(F <= 1.35e-248) && (F <= 2.5e-56)))
		tmp = Float64(Float64(Float64(F * sqrt(0.5)) - x) / B);
	else
		tmp = Float64(Float64(1.0 / B) - t_0);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x / tan(B);
	tmp = 0.0;
	if (F <= -1.35e-6)
		tmp = (-1.0 / B) - t_0;
	elseif ((F <= -6e-217) || (~((F <= 1.35e-248)) && (F <= 2.5e-56)))
		tmp = ((F * sqrt(0.5)) - x) / B;
	else
		tmp = (1.0 / B) - t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.35e-6], N[(N[(-1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision], If[Or[LessEqual[F, -6e-217], And[N[Not[LessEqual[F, 1.35e-248]], $MachinePrecision], LessEqual[F, 2.5e-56]]], N[(N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq -6 \cdot 10^{-217} \lor \neg \left(F \leq 1.35 \cdot 10^{-248}\right) \land F \leq 2.5 \cdot 10^{-56}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\

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


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

    1. Initial program 56.0%

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

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

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

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

    if -1.34999999999999999e-6 < F < -6.00000000000000009e-217 or 1.35e-248 < F < 2.49999999999999999e-56

    1. Initial program 99.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{F \cdot \frac{\sqrt{0.5}}{\sin B}} - \frac{x}{\tan B} \]
    10. Taylor expanded in B around 0 57.2%

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

    if -6.00000000000000009e-217 < F < 1.35e-248 or 2.49999999999999999e-56 < F

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.35 \cdot 10^{-6}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -6 \cdot 10^{-217} \lor \neg \left(F \leq 1.35 \cdot 10^{-248}\right) \land F \leq 2.5 \cdot 10^{-56}:\\ \;\;\;\;\frac{F \cdot \sqrt{0.5} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 55.0% accurate, 2.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 2.5e11 or 1.7499999999999999e256 < F

    1. Initial program 83.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. Simplified90.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 57.4%

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

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

    if 2.5e11 < F < 1.7499999999999999e256

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

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

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

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

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

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

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

Alternative 14: 44.3% accurate, 2.9× speedup?

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

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

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

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


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

    1. Initial program 63.6%

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

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

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

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

    if -2.15e-48 < F < 2.5e11

    1. Initial program 99.3%

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

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

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

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

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

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

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

    if 2.5e11 < F

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

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

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

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

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

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

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

Alternative 15: 60.8% accurate, 2.9× speedup?

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

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

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


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

    1. Initial program 75.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. Simplified86.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 69.1%

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

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

    if -1.75000000000000008e-213 < F

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

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

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

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

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

Alternative 16: 44.1% accurate, 21.6× speedup?

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

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

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

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


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

    1. Initial program 63.6%

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

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

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

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

    if -2.65e-48 < F < 2.64999999999999998e-37

    1. Initial program 99.3%

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

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

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

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

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

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

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

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

    if 2.64999999999999998e-37 < F

    1. Initial program 59.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. Simplified75.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 37.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 46.2%

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

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

Alternative 17: 37.5% accurate, 23.1× speedup?

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

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

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

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


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

    1. Initial program 63.6%

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

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

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

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

    if -2.59999999999999987e-48 < F < 7.5e11

    1. Initial program 99.3%

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

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

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

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

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

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

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

    if 7.5e11 < F

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

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

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

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

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

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

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

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

Alternative 18: 29.7% accurate, 35.9× speedup?

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

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

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


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

    1. Initial program 85.4%

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

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

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

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

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

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

    if 3.6e11 < F

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

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

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

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

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

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

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

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

Alternative 19: 18.0% accurate, 40.4× speedup?

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

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

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


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

    1. Initial program 85.4%

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

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

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

    if 2.5e11 < F

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

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

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

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

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

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

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

Alternative 20: 11.0% 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 78.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. Simplified87.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 45.3%

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

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

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

Reproduce

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