VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.1% → 99.6%
Time: 21.3s
Alternatives: 21
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 21 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.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 41.8%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. +-commutative99.6%

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv99.8%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr99.8%

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

    if -1.5e62 < F < 5.8e7

    1. Initial program 98.8%

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

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

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

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

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def69.6%

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

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

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

    if 5.8e7 < F

    1. Initial program 50.0%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt19.2%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}} \]
      3. frac-times64.9%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{-1 \cdot -1}{\sin B \cdot \sin B}}} \]
      4. metadata-eval64.9%

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}} \]
      8. add-sqr-sqrt99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}} \]
      9. *-un-lft-identity99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(--1\right)} \cdot \frac{1}{\sin B} \]
      11. cancel-sign-sub-inv99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{\frac{-1}{\sin B}} \]
      13. neg-sub099.6%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B} \]
      14. associate--l-99.6%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} + \frac{-1}{\sin B}\right)} \]
      15. un-div-inv99.8%

        \[\leadsto 0 - \left(\color{blue}{\frac{x}{\tan B}} + \frac{-1}{\sin B}\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{0 - \left(\frac{x}{\tan B} + \frac{-1}{\sin B}\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto 0 - \color{blue}{\left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
      2. associate--r+99.8%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      3. neg-sub099.8%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      4. distribute-neg-frac99.8%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      5. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    7. Simplified99.8%

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

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

Alternative 2: 99.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -0.92:\\
\;\;\;\;t_0 + \frac{F}{\frac{\sin B \cdot \left(-1 - x\right)}{F} - F \cdot \sin B}\\

\mathbf{elif}\;F \leq 2.4:\\
\;\;\;\;t_0 + \frac{F}{\sin B \cdot \sqrt{2 + x \cdot 2}}\\

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


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

    1. Initial program 54.9%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} \]
      2. associate-/l*64.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\frac{-0.5 \cdot \color{blue}{\left(\left(2 + 2 \cdot x\right) \cdot \sin B\right)}}{F} - F \cdot \sin B} \]
      6. associate-*r*97.7%

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

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

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

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

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

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

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

    if -0.92000000000000004 < F < 2.39999999999999991

    1. Initial program 98.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/98.7%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} \]
      2. associate-/l*98.7%

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

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

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

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

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

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

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

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

    if 2.39999999999999991 < F

    1. Initial program 50.8%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt18.9%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}} \]
      3. frac-times64.0%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{-1 \cdot -1}{\sin B \cdot \sin B}}} \]
      4. metadata-eval64.0%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}} \]
      5. metadata-eval64.0%

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}} \]
      8. add-sqr-sqrt99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}} \]
      9. *-un-lft-identity99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(--1\right)} \cdot \frac{1}{\sin B} \]
      11. cancel-sign-sub-inv99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{\frac{-1}{\sin B}} \]
      13. neg-sub099.6%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B} \]
      14. associate--l-99.6%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} + \frac{-1}{\sin B}\right)} \]
      15. un-div-inv99.8%

        \[\leadsto 0 - \left(\color{blue}{\frac{x}{\tan B}} + \frac{-1}{\sin B}\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{0 - \left(\frac{x}{\tan B} + \frac{-1}{\sin B}\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto 0 - \color{blue}{\left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
      2. associate--r+99.8%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      3. neg-sub099.8%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      4. distribute-neg-frac99.8%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      5. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    7. Simplified99.8%

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

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

Alternative 3: 99.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 54.3%

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

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

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

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

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr98.6%

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

    if -1.6000000000000001 < F < 1.69999999999999996

    1. Initial program 98.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/98.7%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} \]
      2. associate-/l*98.7%

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

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

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

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

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

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

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

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

    if 1.69999999999999996 < F

    1. Initial program 50.8%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt18.9%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}} \]
      3. frac-times64.0%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{-1 \cdot -1}{\sin B \cdot \sin B}}} \]
      4. metadata-eval64.0%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}} \]
      5. metadata-eval64.0%

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}} \]
      8. add-sqr-sqrt99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}} \]
      9. *-un-lft-identity99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(--1\right)} \cdot \frac{1}{\sin B} \]
      11. cancel-sign-sub-inv99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{\frac{-1}{\sin B}} \]
      13. neg-sub099.6%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B} \]
      14. associate--l-99.6%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} + \frac{-1}{\sin B}\right)} \]
      15. un-div-inv99.8%

        \[\leadsto 0 - \left(\color{blue}{\frac{x}{\tan B}} + \frac{-1}{\sin B}\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{0 - \left(\frac{x}{\tan B} + \frac{-1}{\sin B}\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto 0 - \color{blue}{\left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
      2. associate--r+99.8%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      3. neg-sub099.8%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      4. distribute-neg-frac99.8%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      5. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    7. Simplified99.8%

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

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

Alternative 4: 92.7% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -9.4 \cdot 10^{-35}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;F \leq 8.8 \cdot 10^{-79}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;F \leq 1.28 \cdot 10^{-24}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;F \leq 26500000:\\
\;\;\;\;t_3\\

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


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

    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. Add Preprocessing
    3. Taylor expanded in F around -inf 97.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. +-commutative97.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)} \]
      2. unsub-neg97.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv97.4%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr97.4%

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

    if -6.6e-4 < F < -9.4e-35 or 8.7999999999999995e-79 < F < 1.28e-24

    1. Initial program 99.5%

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

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

    if -9.4e-35 < F < 8.7999999999999995e-79 or 1.28e-24 < F < 2.65e7

    1. Initial program 98.5%

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

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

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

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

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

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    6. Step-by-step derivation
      1. expm1-def68.2%

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

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

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

    if 2.65e7 < F

    1. Initial program 50.0%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt19.2%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}} \]
      3. frac-times64.9%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{-1 \cdot -1}{\sin B \cdot \sin B}}} \]
      4. metadata-eval64.9%

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}} \]
      8. add-sqr-sqrt99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}} \]
      9. *-un-lft-identity99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(--1\right)} \cdot \frac{1}{\sin B} \]
      11. cancel-sign-sub-inv99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{\frac{-1}{\sin B}} \]
      13. neg-sub099.6%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B} \]
      14. associate--l-99.6%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} + \frac{-1}{\sin B}\right)} \]
      15. un-div-inv99.8%

        \[\leadsto 0 - \left(\color{blue}{\frac{x}{\tan B}} + \frac{-1}{\sin B}\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{0 - \left(\frac{x}{\tan B} + \frac{-1}{\sin B}\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto 0 - \color{blue}{\left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
      2. associate--r+99.8%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      3. neg-sub099.8%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      4. distribute-neg-frac99.8%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      5. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    7. Simplified99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.00066:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -9.4 \cdot 10^{-35}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 8.8 \cdot 10^{-79}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.28 \cdot 10^{-24}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 26500000:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 92.7% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -5.2 \cdot 10^{-36}:\\
\;\;\;\;\frac{F}{\sin B} \cdot t_0 - \frac{x}{B}\\

\mathbf{elif}\;F \leq 4.6 \cdot 10^{-74}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;F \leq 2.3 \cdot 10^{-24}:\\
\;\;\;\;t_0 \cdot \left(F \cdot t_1\right) - \frac{x}{B}\\

\mathbf{elif}\;F \leq 26500000:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;t_1 - t_2\\


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

    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. Add Preprocessing
    3. Taylor expanded in F around -inf 97.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. +-commutative97.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)} \]
      2. unsub-neg97.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv97.4%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr97.4%

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

    if -6.6e-4 < F < -5.2000000000000001e-36

    1. Initial program 99.4%

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

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

    if -5.2000000000000001e-36 < F < 4.59999999999999961e-74 or 2.3000000000000001e-24 < F < 2.65e7

    1. Initial program 98.6%

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

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

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

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

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

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    6. Step-by-step derivation
      1. expm1-def68.5%

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

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

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

    if 4.59999999999999961e-74 < F < 2.3000000000000001e-24

    1. Initial program 99.6%

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

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

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

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

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

    if 2.65e7 < F

    1. Initial program 50.0%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt19.2%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}} \]
      3. frac-times64.9%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{-1 \cdot -1}{\sin B \cdot \sin B}}} \]
      4. metadata-eval64.9%

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}} \]
      8. add-sqr-sqrt99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}} \]
      9. *-un-lft-identity99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(--1\right)} \cdot \frac{1}{\sin B} \]
      11. cancel-sign-sub-inv99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{\frac{-1}{\sin B}} \]
      13. neg-sub099.6%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B} \]
      14. associate--l-99.6%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} + \frac{-1}{\sin B}\right)} \]
      15. un-div-inv99.8%

        \[\leadsto 0 - \left(\color{blue}{\frac{x}{\tan B}} + \frac{-1}{\sin B}\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{0 - \left(\frac{x}{\tan B} + \frac{-1}{\sin B}\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto 0 - \color{blue}{\left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
      2. associate--r+99.8%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      3. neg-sub099.8%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      4. distribute-neg-frac99.8%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      5. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    7. Simplified99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.00066:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -5.2 \cdot 10^{-36}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 4.6 \cdot 10^{-74}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2.3 \cdot 10^{-24}:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \left(F \cdot \frac{1}{\sin B}\right) - \frac{x}{B}\\ \mathbf{elif}\;F \leq 26500000:\\ \;\;\;\;{\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 92.5% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -7 \cdot 10^{-33}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;F \leq 1.7 \cdot 10^{-78}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq 7.7 \cdot 10^{-25}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;F \leq 1.2:\\
\;\;\;\;t_0\\

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


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

    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. Add Preprocessing
    3. Taylor expanded in F around -inf 97.3%

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. +-commutative97.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(-x \cdot \frac{1}{\tan B}\right)} \]
      2. unsub-neg97.3%

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv97.4%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr97.4%

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

    if -6.6e-4 < F < -6.9999999999999997e-33 or 1.70000000000000006e-78 < F < 7.7000000000000002e-25

    1. Initial program 99.5%

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

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

    if -6.9999999999999997e-33 < F < 1.70000000000000006e-78 or 7.7000000000000002e-25 < F < 1.19999999999999996

    1. Initial program 98.5%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} \]
      2. associate-/l*98.6%

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

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

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

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

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

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

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

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

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

    if 1.19999999999999996 < F

    1. Initial program 50.8%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt18.9%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}} \]
      3. frac-times64.0%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{-1 \cdot -1}{\sin B \cdot \sin B}}} \]
      4. metadata-eval64.0%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}} \]
      5. metadata-eval64.0%

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}} \]
      8. add-sqr-sqrt99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}} \]
      9. *-un-lft-identity99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(--1\right)} \cdot \frac{1}{\sin B} \]
      11. cancel-sign-sub-inv99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{\frac{-1}{\sin B}} \]
      13. neg-sub099.6%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B} \]
      14. associate--l-99.6%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} + \frac{-1}{\sin B}\right)} \]
      15. un-div-inv99.8%

        \[\leadsto 0 - \left(\color{blue}{\frac{x}{\tan B}} + \frac{-1}{\sin B}\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{0 - \left(\frac{x}{\tan B} + \frac{-1}{\sin B}\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto 0 - \color{blue}{\left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
      2. associate--r+99.8%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      3. neg-sub099.8%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      4. distribute-neg-frac99.8%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      5. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    7. Simplified99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -0.00066:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq -7 \cdot 10^{-33}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.7 \cdot 10^{-78}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B \cdot \sqrt{2 + x \cdot 2}}\\ \mathbf{elif}\;F \leq 7.7 \cdot 10^{-25}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + x \cdot 2\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.2:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B \cdot \sqrt{2 + x \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 91.9% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 58.6%

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

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

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

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

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr92.6%

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

    if -9.00000000000000026e-19 < F < 0.19

    1. Initial program 98.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l/98.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} \]
      2. associate-/l*98.7%

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

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

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

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

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

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

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

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

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

    if 0.19 < F

    1. Initial program 50.8%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt18.9%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}} \]
      3. frac-times64.0%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{-1 \cdot -1}{\sin B \cdot \sin B}}} \]
      4. metadata-eval64.0%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\frac{\color{blue}{1}}{\sin B \cdot \sin B}} \]
      5. metadata-eval64.0%

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}} \]
      8. add-sqr-sqrt99.6%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}} \]
      9. *-un-lft-identity99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(--1\right)} \cdot \frac{1}{\sin B} \]
      11. cancel-sign-sub-inv99.6%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{\frac{-1}{\sin B}} \]
      13. neg-sub099.6%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B} \]
      14. associate--l-99.6%

        \[\leadsto \color{blue}{0 - \left(x \cdot \frac{1}{\tan B} + \frac{-1}{\sin B}\right)} \]
      15. un-div-inv99.8%

        \[\leadsto 0 - \left(\color{blue}{\frac{x}{\tan B}} + \frac{-1}{\sin B}\right) \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{0 - \left(\frac{x}{\tan B} + \frac{-1}{\sin B}\right)} \]
    6. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto 0 - \color{blue}{\left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
      2. associate--r+99.8%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      3. neg-sub099.8%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      4. distribute-neg-frac99.8%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      5. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    7. Simplified99.8%

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

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

Alternative 8: 85.1% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 60.3%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. +-commutative89.1%

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv89.2%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr89.2%

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

    if -1.82000000000000009e-34 < F < 3.40000000000000021e-84

    1. Initial program 98.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. expm1-log1p-u52.9%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)\right)} \]
      2. expm1-udef32.1%

        \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)} - 1\right)} \]
      3. associate-/l*32.1%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}}\right)} - 1\right) \]
      4. tan-quot32.1%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\frac{x}{\color{blue}{\tan B}}\right)} - 1\right) \]
    6. Applied egg-rr32.1%

      \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)} \]
    7. Step-by-step derivation
      1. expm1-def53.0%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)} \]
      2. expm1-log1p81.2%

        \[\leadsto -1 \cdot \color{blue}{\frac{x}{\tan B}} \]
    8. Simplified81.2%

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

    if 3.40000000000000021e-84 < F

    1. Initial program 60.3%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt17.8%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{-1}{\sin B} \cdot \frac{-1}{\sin B}}} \]
      3. frac-times57.0%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \sqrt{\color{blue}{\frac{-1 \cdot -1}{\sin B \cdot \sin B}}} \]
      4. metadata-eval57.0%

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\sqrt{\frac{1}{\sin B}} \cdot \sqrt{\frac{1}{\sin B}}} \]
      8. add-sqr-sqrt87.3%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1}{\sin B}} \]
      9. *-un-lft-identity87.3%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{1 \cdot \frac{1}{\sin B}} \]
      10. metadata-eval87.3%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\left(--1\right)} \cdot \frac{1}{\sin B} \]
      11. cancel-sign-sub-inv87.3%

        \[\leadsto \color{blue}{\left(-x \cdot \frac{1}{\tan B}\right) - -1 \cdot \frac{1}{\sin B}} \]
      12. div-inv87.3%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) - \color{blue}{\frac{-1}{\sin B}} \]
      13. neg-sub087.3%

        \[\leadsto \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)} - \frac{-1}{\sin B} \]
      14. associate--l-87.3%

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

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

      \[\leadsto \color{blue}{0 - \left(\frac{x}{\tan B} + \frac{-1}{\sin B}\right)} \]
    6. Step-by-step derivation
      1. +-commutative87.5%

        \[\leadsto 0 - \color{blue}{\left(\frac{-1}{\sin B} + \frac{x}{\tan B}\right)} \]
      2. associate--r+87.5%

        \[\leadsto \color{blue}{\left(0 - \frac{-1}{\sin B}\right) - \frac{x}{\tan B}} \]
      3. neg-sub087.5%

        \[\leadsto \color{blue}{\left(-\frac{-1}{\sin B}\right)} - \frac{x}{\tan B} \]
      4. distribute-neg-frac87.5%

        \[\leadsto \color{blue}{\frac{--1}{\sin B}} - \frac{x}{\tan B} \]
      5. metadata-eval87.5%

        \[\leadsto \frac{\color{blue}{1}}{\sin B} - \frac{x}{\tan B} \]
    7. Simplified87.5%

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

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

Alternative 9: 78.5% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq 4.3 \cdot 10^{+18}:\\
\;\;\;\;\frac{-x}{\tan B}\\

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

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


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

    1. Initial program 60.3%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. +-commutative89.1%

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

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      3. un-div-inv89.2%

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
    5. Applied egg-rr89.2%

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

    if -7.79999999999999982e-34 < F < 4.3e18

    1. Initial program 98.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. Add Preprocessing
    3. Taylor expanded in F around -inf 40.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. expm1-log1p-u47.3%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)\right)} \]
      2. expm1-udef29.9%

        \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)} - 1\right)} \]
      3. associate-/l*29.9%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}}\right)} - 1\right) \]
      4. tan-quot29.9%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\frac{x}{\color{blue}{\tan B}}\right)} - 1\right) \]
    6. Applied egg-rr29.9%

      \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)} \]
    7. Step-by-step derivation
      1. expm1-def47.4%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)} \]
      2. expm1-log1p73.9%

        \[\leadsto -1 \cdot \color{blue}{\frac{x}{\tan B}} \]
    8. Simplified73.9%

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

    if 4.3e18 < F < 2.60000000000000003e237

    1. Initial program 48.7%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} \]
      2. associate-/l*63.1%

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

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

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

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

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

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

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

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

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

    if 2.60000000000000003e237 < F

    1. Initial program 47.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -7.8 \cdot 10^{-34}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 4.3 \cdot 10^{+18}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{elif}\;F \leq 2.6 \cdot 10^{+237}:\\ \;\;\;\;\frac{F}{\frac{\sin B}{\frac{1}{F}}} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 72.0% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{-1}{\tan B}\\ t_1 := \frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{if}\;F \leq -1.85 \cdot 10^{+195}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;F \leq -1.05 \cdot 10^{+108}:\\ \;\;\;\;t_0 + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -0.16:\\ \;\;\;\;t_1\\ \mathbf{elif}\;F \leq 4.3 \cdot 10^{+18}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{elif}\;F \leq 2.5 \cdot 10^{+235}:\\ \;\;\;\;\frac{F}{\frac{\sin B}{\frac{1}{F}}} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;t_0 + \frac{1}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (* x (/ -1.0 (tan B)))) (t_1 (- (/ -1.0 (sin B)) (/ x B))))
   (if (<= F -1.85e+195)
     t_1
     (if (<= F -1.05e+108)
       (+ t_0 (/ -1.0 B))
       (if (<= F -0.16)
         t_1
         (if (<= F 4.3e+18)
           (/ (- x) (tan B))
           (if (<= F 2.5e+235)
             (- (/ F (/ (sin B) (/ 1.0 F))) (/ x B))
             (+ t_0 (/ 1.0 B)))))))))
double code(double F, double B, double x) {
	double t_0 = x * (-1.0 / tan(B));
	double t_1 = (-1.0 / sin(B)) - (x / B);
	double tmp;
	if (F <= -1.85e+195) {
		tmp = t_1;
	} else if (F <= -1.05e+108) {
		tmp = t_0 + (-1.0 / B);
	} else if (F <= -0.16) {
		tmp = t_1;
	} else if (F <= 4.3e+18) {
		tmp = -x / tan(B);
	} else if (F <= 2.5e+235) {
		tmp = (F / (sin(B) / (1.0 / F))) - (x / B);
	} else {
		tmp = t_0 + (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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = x * ((-1.0d0) / tan(b))
    t_1 = ((-1.0d0) / sin(b)) - (x / b)
    if (f <= (-1.85d+195)) then
        tmp = t_1
    else if (f <= (-1.05d+108)) then
        tmp = t_0 + ((-1.0d0) / b)
    else if (f <= (-0.16d0)) then
        tmp = t_1
    else if (f <= 4.3d+18) then
        tmp = -x / tan(b)
    else if (f <= 2.5d+235) then
        tmp = (f / (sin(b) / (1.0d0 / f))) - (x / b)
    else
        tmp = t_0 + (1.0d0 / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = x * (-1.0 / Math.tan(B));
	double t_1 = (-1.0 / Math.sin(B)) - (x / B);
	double tmp;
	if (F <= -1.85e+195) {
		tmp = t_1;
	} else if (F <= -1.05e+108) {
		tmp = t_0 + (-1.0 / B);
	} else if (F <= -0.16) {
		tmp = t_1;
	} else if (F <= 4.3e+18) {
		tmp = -x / Math.tan(B);
	} else if (F <= 2.5e+235) {
		tmp = (F / (Math.sin(B) / (1.0 / F))) - (x / B);
	} else {
		tmp = t_0 + (1.0 / B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = x * (-1.0 / math.tan(B))
	t_1 = (-1.0 / math.sin(B)) - (x / B)
	tmp = 0
	if F <= -1.85e+195:
		tmp = t_1
	elif F <= -1.05e+108:
		tmp = t_0 + (-1.0 / B)
	elif F <= -0.16:
		tmp = t_1
	elif F <= 4.3e+18:
		tmp = -x / math.tan(B)
	elif F <= 2.5e+235:
		tmp = (F / (math.sin(B) / (1.0 / F))) - (x / B)
	else:
		tmp = t_0 + (1.0 / B)
	return tmp
function code(F, B, x)
	t_0 = Float64(x * Float64(-1.0 / tan(B)))
	t_1 = Float64(Float64(-1.0 / sin(B)) - Float64(x / B))
	tmp = 0.0
	if (F <= -1.85e+195)
		tmp = t_1;
	elseif (F <= -1.05e+108)
		tmp = Float64(t_0 + Float64(-1.0 / B));
	elseif (F <= -0.16)
		tmp = t_1;
	elseif (F <= 4.3e+18)
		tmp = Float64(Float64(-x) / tan(B));
	elseif (F <= 2.5e+235)
		tmp = Float64(Float64(F / Float64(sin(B) / Float64(1.0 / F))) - Float64(x / B));
	else
		tmp = Float64(t_0 + Float64(1.0 / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = x * (-1.0 / tan(B));
	t_1 = (-1.0 / sin(B)) - (x / B);
	tmp = 0.0;
	if (F <= -1.85e+195)
		tmp = t_1;
	elseif (F <= -1.05e+108)
		tmp = t_0 + (-1.0 / B);
	elseif (F <= -0.16)
		tmp = t_1;
	elseif (F <= 4.3e+18)
		tmp = -x / tan(B);
	elseif (F <= 2.5e+235)
		tmp = (F / (sin(B) / (1.0 / F))) - (x / B);
	else
		tmp = t_0 + (1.0 / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.85e+195], t$95$1, If[LessEqual[F, -1.05e+108], N[(t$95$0 + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -0.16], t$95$1, If[LessEqual[F, 4.3e+18], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.5e+235], N[(N[(F / N[(N[Sin[B], $MachinePrecision] / N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;F \leq -0.16:\\
\;\;\;\;t_1\\

\mathbf{elif}\;F \leq 4.3 \cdot 10^{+18}:\\
\;\;\;\;\frac{-x}{\tan B}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if F < -1.85e195 or -1.05000000000000005e108 < F < -0.160000000000000003

    1. Initial program 47.9%

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

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

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

    if -1.85e195 < F < -1.05000000000000005e108

    1. Initial program 70.0%

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

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

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

    if -0.160000000000000003 < F < 4.3e18

    1. Initial program 98.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. Add Preprocessing
    3. Taylor expanded in F around -inf 39.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. expm1-log1p-u44.9%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)\right)} \]
      2. expm1-udef28.6%

        \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)} - 1\right)} \]
      3. associate-/l*28.6%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}}\right)} - 1\right) \]
      4. tan-quot28.6%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\frac{x}{\color{blue}{\tan B}}\right)} - 1\right) \]
    6. Applied egg-rr28.6%

      \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)} \]
    7. Step-by-step derivation
      1. expm1-def45.0%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)} \]
      2. expm1-log1p70.4%

        \[\leadsto -1 \cdot \color{blue}{\frac{x}{\tan B}} \]
    8. Simplified70.4%

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

    if 4.3e18 < F < 2.50000000000000013e235

    1. Initial program 48.7%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}}{\sin B}} \]
      2. associate-/l*63.1%

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

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

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

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

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

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

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

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

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

    if 2.50000000000000013e235 < F

    1. Initial program 47.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.85 \cdot 10^{+195}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.05 \cdot 10^{+108}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -0.16:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 4.3 \cdot 10^{+18}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{elif}\;F \leq 2.5 \cdot 10^{+235}:\\ \;\;\;\;\frac{F}{\frac{\sin B}{\frac{1}{F}}} - \frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 71.8% accurate, 2.8× speedup?

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

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

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

\mathbf{elif}\;F \leq -1.1:\\
\;\;\;\;t_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -5.49999999999999994e195 or -2.4500000000000001e107 < F < -1.1000000000000001

    1. Initial program 47.9%

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

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

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

    if -5.49999999999999994e195 < F < -2.4500000000000001e107

    1. Initial program 70.0%

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

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

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

    if -1.1000000000000001 < F < 1e-84

    1. Initial program 98.6%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. expm1-log1p-u49.6%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)\right)} \]
      2. expm1-udef30.5%

        \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)} - 1\right)} \]
      3. associate-/l*30.5%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}}\right)} - 1\right) \]
      4. tan-quot30.5%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\frac{x}{\color{blue}{\tan B}}\right)} - 1\right) \]
    6. Applied egg-rr30.5%

      \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)} \]
    7. Step-by-step derivation
      1. expm1-def49.7%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)} \]
      2. expm1-log1p76.5%

        \[\leadsto -1 \cdot \color{blue}{\frac{x}{\tan B}} \]
    8. Simplified76.5%

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

    if 1e-84 < F

    1. Initial program 60.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.5 \cdot 10^{+195}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -2.45 \cdot 10^{+107}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -1.1:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 10^{-84}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 65.6% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{if}\;F \leq -9.5 \cdot 10^{+194}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;F \leq -1.55 \cdot 10^{+110}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -1.05:\\ \;\;\;\;t_0\\ \mathbf{elif}\;F \leq 4.5 \cdot 10^{+18} \lor \neg \left(F \leq 9.4 \cdot 10^{+229}\right):\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \left(\frac{x}{B} + -0.3333333333333333 \cdot \left(B \cdot x\right)\right)\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (/ -1.0 (sin B)) (/ x B))))
   (if (<= F -9.5e+194)
     t_0
     (if (<= F -1.55e+110)
       (+ (* x (/ -1.0 (tan B))) (/ -1.0 B))
       (if (<= F -1.05)
         t_0
         (if (or (<= F 4.5e+18) (not (<= F 9.4e+229)))
           (/ (- x) (tan B))
           (- (/ 1.0 B) (+ (/ x B) (* -0.3333333333333333 (* B x))))))))))
double code(double F, double B, double x) {
	double t_0 = (-1.0 / sin(B)) - (x / B);
	double tmp;
	if (F <= -9.5e+194) {
		tmp = t_0;
	} else if (F <= -1.55e+110) {
		tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
	} else if (F <= -1.05) {
		tmp = t_0;
	} else if ((F <= 4.5e+18) || !(F <= 9.4e+229)) {
		tmp = -x / tan(B);
	} else {
		tmp = (1.0 / B) - ((x / B) + (-0.3333333333333333 * (B * x)));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((-1.0d0) / sin(b)) - (x / b)
    if (f <= (-9.5d+194)) then
        tmp = t_0
    else if (f <= (-1.55d+110)) then
        tmp = (x * ((-1.0d0) / tan(b))) + ((-1.0d0) / b)
    else if (f <= (-1.05d0)) then
        tmp = t_0
    else if ((f <= 4.5d+18) .or. (.not. (f <= 9.4d+229))) then
        tmp = -x / tan(b)
    else
        tmp = (1.0d0 / b) - ((x / b) + ((-0.3333333333333333d0) * (b * x)))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = (-1.0 / Math.sin(B)) - (x / B);
	double tmp;
	if (F <= -9.5e+194) {
		tmp = t_0;
	} else if (F <= -1.55e+110) {
		tmp = (x * (-1.0 / Math.tan(B))) + (-1.0 / B);
	} else if (F <= -1.05) {
		tmp = t_0;
	} else if ((F <= 4.5e+18) || !(F <= 9.4e+229)) {
		tmp = -x / Math.tan(B);
	} else {
		tmp = (1.0 / B) - ((x / B) + (-0.3333333333333333 * (B * x)));
	}
	return tmp;
}
def code(F, B, x):
	t_0 = (-1.0 / math.sin(B)) - (x / B)
	tmp = 0
	if F <= -9.5e+194:
		tmp = t_0
	elif F <= -1.55e+110:
		tmp = (x * (-1.0 / math.tan(B))) + (-1.0 / B)
	elif F <= -1.05:
		tmp = t_0
	elif (F <= 4.5e+18) or not (F <= 9.4e+229):
		tmp = -x / math.tan(B)
	else:
		tmp = (1.0 / B) - ((x / B) + (-0.3333333333333333 * (B * x)))
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(-1.0 / sin(B)) - Float64(x / B))
	tmp = 0.0
	if (F <= -9.5e+194)
		tmp = t_0;
	elseif (F <= -1.55e+110)
		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B));
	elseif (F <= -1.05)
		tmp = t_0;
	elseif ((F <= 4.5e+18) || !(F <= 9.4e+229))
		tmp = Float64(Float64(-x) / tan(B));
	else
		tmp = Float64(Float64(1.0 / B) - Float64(Float64(x / B) + Float64(-0.3333333333333333 * Float64(B * x))));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = (-1.0 / sin(B)) - (x / B);
	tmp = 0.0;
	if (F <= -9.5e+194)
		tmp = t_0;
	elseif (F <= -1.55e+110)
		tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
	elseif (F <= -1.05)
		tmp = t_0;
	elseif ((F <= 4.5e+18) || ~((F <= 9.4e+229)))
		tmp = -x / tan(B);
	else
		tmp = (1.0 / B) - ((x / B) + (-0.3333333333333333 * (B * x)));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -9.5e+194], t$95$0, If[LessEqual[F, -1.55e+110], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.05], t$95$0, If[Or[LessEqual[F, 4.5e+18], N[Not[LessEqual[F, 9.4e+229]], $MachinePrecision]], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] - N[(N[(x / B), $MachinePrecision] + N[(-0.3333333333333333 * N[(B * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;F \leq -1.05:\\
\;\;\;\;t_0\\

\mathbf{elif}\;F \leq 4.5 \cdot 10^{+18} \lor \neg \left(F \leq 9.4 \cdot 10^{+229}\right):\\
\;\;\;\;\frac{-x}{\tan B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \left(\frac{x}{B} + -0.3333333333333333 \cdot \left(B \cdot x\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -9.5e194 or -1.55000000000000009e110 < F < -1.05000000000000004

    1. Initial program 47.9%

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

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

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

    if -9.5e194 < F < -1.55000000000000009e110

    1. Initial program 70.0%

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

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

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

    if -1.05000000000000004 < F < 4.5e18 or 9.4e229 < F

    1. Initial program 90.9%

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)\right)} \]
      2. expm1-udef28.6%

        \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)} - 1\right)} \]
      3. associate-/l*28.6%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}}\right)} - 1\right) \]
      4. tan-quot28.6%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\frac{x}{\color{blue}{\tan B}}\right)} - 1\right) \]
    6. Applied egg-rr28.6%

      \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)} \]
    7. Step-by-step derivation
      1. expm1-def42.6%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)} \]
      2. expm1-log1p70.4%

        \[\leadsto -1 \cdot \color{blue}{\frac{x}{\tan B}} \]
    8. Simplified70.4%

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

    if 4.5e18 < F < 9.4e229

    1. Initial program 49.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -9.5 \cdot 10^{+194}:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq -1.55 \cdot 10^{+110}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\ \mathbf{elif}\;F \leq -1.05:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 4.5 \cdot 10^{+18} \lor \neg \left(F \leq 9.4 \cdot 10^{+229}\right):\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \left(\frac{x}{B} + -0.3333333333333333 \cdot \left(B \cdot x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 57.8% accurate, 2.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.8 \cdot 10^{+62}:\\
\;\;\;\;B \cdot \left(x \cdot 0.3333333333333333 - 0.16666666666666666\right) + \frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq 4.3 \cdot 10^{+18} \lor \neg \left(F \leq 7.2 \cdot 10^{+233}\right):\\
\;\;\;\;\frac{-x}{\tan B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \left(\frac{x}{B} + -0.3333333333333333 \cdot \left(B \cdot x\right)\right)\\


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

    1. Initial program 41.8%

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

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

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

    if -2.80000000000000014e62 < F < 4.3e18 or 7.1999999999999996e233 < F

    1. Initial program 91.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. Add Preprocessing
    3. Taylor expanded in F around -inf 48.1%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    5. Step-by-step derivation
      1. expm1-log1p-u38.9%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)\right)} \]
      2. expm1-udef26.3%

        \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)} - 1\right)} \]
      3. associate-/l*26.3%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}}\right)} - 1\right) \]
      4. tan-quot26.3%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\frac{x}{\color{blue}{\tan B}}\right)} - 1\right) \]
    6. Applied egg-rr26.3%

      \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)} \]
    7. Step-by-step derivation
      1. expm1-def39.0%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)} \]
      2. expm1-log1p67.9%

        \[\leadsto -1 \cdot \color{blue}{\frac{x}{\tan B}} \]
    8. Simplified67.9%

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

    if 4.3e18 < F < 7.1999999999999996e233

    1. Initial program 49.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.8 \cdot 10^{+62}:\\ \;\;\;\;B \cdot \left(x \cdot 0.3333333333333333 - 0.16666666666666666\right) + \frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 4.3 \cdot 10^{+18} \lor \neg \left(F \leq 7.2 \cdot 10^{+233}\right):\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \left(\frac{x}{B} + -0.3333333333333333 \cdot \left(B \cdot x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 65.7% accurate, 2.9× speedup?

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

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

\mathbf{elif}\;F \leq 4.3 \cdot 10^{+18} \lor \neg \left(F \leq 3.7 \cdot 10^{+234}\right):\\
\;\;\;\;\frac{-x}{\tan B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \left(\frac{x}{B} + -0.3333333333333333 \cdot \left(B \cdot x\right)\right)\\


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

    1. Initial program 54.9%

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

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

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

    if -1.1499999999999999 < F < 4.3e18 or 3.69999999999999966e234 < F

    1. Initial program 90.9%

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)\right)} \]
      2. expm1-udef28.6%

        \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x \cdot \cos B}{\sin B}\right)} - 1\right)} \]
      3. associate-/l*28.6%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}}\right)} - 1\right) \]
      4. tan-quot28.6%

        \[\leadsto -1 \cdot \left(e^{\mathsf{log1p}\left(\frac{x}{\color{blue}{\tan B}}\right)} - 1\right) \]
    6. Applied egg-rr28.6%

      \[\leadsto -1 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)} \]
    7. Step-by-step derivation
      1. expm1-def42.6%

        \[\leadsto -1 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)} \]
      2. expm1-log1p70.4%

        \[\leadsto -1 \cdot \color{blue}{\frac{x}{\tan B}} \]
    8. Simplified70.4%

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

    if 4.3e18 < F < 3.69999999999999966e234

    1. Initial program 49.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.15:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 4.3 \cdot 10^{+18} \lor \neg \left(F \leq 3.7 \cdot 10^{+234}\right):\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B} - \left(\frac{x}{B} + -0.3333333333333333 \cdot \left(B \cdot x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 46.1% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.0043:\\
\;\;\;\;B \cdot \left(x \cdot 0.3333333333333333 - 0.16666666666666666\right) + \frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq 7.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{-x}{\sin B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \left(\frac{x}{B} + -0.3333333333333333 \cdot \left(B \cdot x\right)\right)\\


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

    1. Initial program 54.9%

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

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

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

    if -0.0043 < F < 7.49999999999999981e-20

    1. Initial program 98.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. Add Preprocessing
    3. Taylor expanded in F around -inf 40.3%

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

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

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

    if 7.49999999999999981e-20 < F

    1. Initial program 54.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. Add Preprocessing
    3. Taylor expanded in B around 0 46.6%

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

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

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

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

Alternative 16: 44.7% accurate, 18.9× speedup?

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

\\
\begin{array}{l}
t_0 := -0.3333333333333333 \cdot \left(B \cdot x\right)\\
\mathbf{if}\;F \leq -4 \cdot 10^{-45}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq 3.2 \cdot 10^{-84}:\\
\;\;\;\;\frac{-x}{B} - t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B} - \left(\frac{x}{B} + t_0\right)\\


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

    1. Initial program 62.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval43.3%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-143.3%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B} - \frac{1}{B}} \]
    8. Step-by-step derivation
      1. sub-neg43.3%

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

        \[\leadsto -1 \cdot \frac{x}{B} + \color{blue}{-1 \cdot \frac{1}{B}} \]
      3. distribute-lft-in43.3%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{B} + -1 \cdot \frac{x}{B}} \]
      6. neg-mul-143.3%

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

        \[\leadsto \color{blue}{\frac{-1}{B}} + -1 \cdot \frac{x}{B} \]
      8. metadata-eval43.3%

        \[\leadsto \frac{\color{blue}{-1}}{B} + -1 \cdot \frac{x}{B} \]
      9. mul-1-neg43.3%

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

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

        \[\leadsto \color{blue}{\frac{-1 - x}{B}} \]
    9. Simplified43.3%

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

    if -3.99999999999999994e-45 < F < 3.1999999999999999e-84

    1. Initial program 98.4%

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

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

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

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

    if 3.1999999999999999e-84 < F

    1. Initial program 60.3%

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

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

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

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

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

Alternative 17: 37.5% accurate, 26.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-x}{B} - -0.3333333333333333 \cdot \left(B \cdot x\right)\\


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

    1. Initial program 62.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval43.3%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-143.3%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B} - \frac{1}{B}} \]
    8. Step-by-step derivation
      1. sub-neg43.3%

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

        \[\leadsto -1 \cdot \frac{x}{B} + \color{blue}{-1 \cdot \frac{1}{B}} \]
      3. distribute-lft-in43.3%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{B} + -1 \cdot \frac{x}{B}} \]
      6. neg-mul-143.3%

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

        \[\leadsto \color{blue}{\frac{-1}{B}} + -1 \cdot \frac{x}{B} \]
      8. metadata-eval43.3%

        \[\leadsto \frac{\color{blue}{-1}}{B} + -1 \cdot \frac{x}{B} \]
      9. mul-1-neg43.3%

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

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

        \[\leadsto \color{blue}{\frac{-1 - x}{B}} \]
    9. Simplified43.3%

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

    if -3.80000000000000015e-47 < F

    1. Initial program 80.8%

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

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

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

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

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

Alternative 18: 37.4% accurate, 29.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \left(B \cdot 0.3333333333333333 + \frac{-1}{B}\right)\\


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

    1. Initial program 62.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval43.3%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-143.3%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B} - \frac{1}{B}} \]
    8. Step-by-step derivation
      1. sub-neg43.3%

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

        \[\leadsto -1 \cdot \frac{x}{B} + \color{blue}{-1 \cdot \frac{1}{B}} \]
      3. distribute-lft-in43.3%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{B} + -1 \cdot \frac{x}{B}} \]
      6. neg-mul-143.3%

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

        \[\leadsto \color{blue}{\frac{-1}{B}} + -1 \cdot \frac{x}{B} \]
      8. metadata-eval43.3%

        \[\leadsto \frac{\color{blue}{-1}}{B} + -1 \cdot \frac{x}{B} \]
      9. mul-1-neg43.3%

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

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

        \[\leadsto \color{blue}{\frac{-1 - x}{B}} \]
    9. Simplified43.3%

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

    if -1.45e-47 < F

    1. Initial program 80.8%

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

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

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

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

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

Alternative 19: 31.9% accurate, 39.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-82} \lor \neg \left(x \leq 4.3 \cdot 10^{-195}\right):\\
\;\;\;\;\frac{-x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.19999999999999999e-82 or 4.3000000000000004e-195 < x

    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. Add Preprocessing
    3. Taylor expanded in F around -inf 66.6%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in30.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval30.4%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-130.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    9. Simplified38.1%

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

    if -6.19999999999999999e-82 < x < 4.3000000000000004e-195

    1. Initial program 60.0%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in20.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval20.4%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-120.4%

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

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

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

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

Alternative 20: 37.4% accurate, 45.9× speedup?

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

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

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


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

    1. Initial program 62.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval43.3%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-143.3%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B} - \frac{1}{B}} \]
    8. Step-by-step derivation
      1. sub-neg43.3%

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

        \[\leadsto -1 \cdot \frac{x}{B} + \color{blue}{-1 \cdot \frac{1}{B}} \]
      3. distribute-lft-in43.3%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{B} + -1 \cdot \frac{x}{B}} \]
      6. neg-mul-143.3%

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

        \[\leadsto \color{blue}{\frac{-1}{B}} + -1 \cdot \frac{x}{B} \]
      8. metadata-eval43.3%

        \[\leadsto \frac{\color{blue}{-1}}{B} + -1 \cdot \frac{x}{B} \]
      9. mul-1-neg43.3%

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

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

        \[\leadsto \color{blue}{\frac{-1 - x}{B}} \]
    9. Simplified43.3%

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

    if -3.49999999999999997e-50 < F

    1. Initial program 80.8%

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in20.0%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval20.0%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-120.0%

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

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

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

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

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

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

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

Alternative 21: 10.5% accurate, 108.0× speedup?

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

\\
\frac{-1}{B}
\end{array}
Derivation
  1. Initial program 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. Add Preprocessing
  3. Taylor expanded in F around -inf 56.3%

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
    2. distribute-lft-in27.2%

      \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
    3. metadata-eval27.2%

      \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
    4. neg-mul-127.2%

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

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

    \[\leadsto \color{blue}{\frac{-1}{B}} \]
  8. Final simplification9.9%

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

Reproduce

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