VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.0% → 99.6%
Time: 16.0s
Alternatives: 23
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 23 alternatives:

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

Initial Program: 77.0% 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, 0.6× speedup?

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

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

\mathbf{elif}\;F \leq 2.2 \cdot 10^{+37}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\frac{\sin B}{F}} - \frac{x}{\tan B}\\

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


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

    1. Initial program 48.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. Simplified64.0%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in99.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg99.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/99.8%

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

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

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

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

    if -2e20 < F < 2.2000000000000001e37

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.2000000000000001e37 < F

    1. Initial program 46.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1 \cdot 10^{+16}:\\ \;\;\;\;\frac{-1}{\sin B} - x \cdot \frac{\cos B}{\sin B}\\ \mathbf{elif}\;F \leq 85000000:\\ \;\;\;\;F \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x \cdot \cos B}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1e+16)
   (- (/ -1.0 (sin B)) (* x (/ (cos B) (sin B))))
   (if (<= F 85000000.0)
     (- (* F (/ (sqrt (/ 1.0 (fma F F 2.0))) (sin B))) (/ x (tan B)))
     (/ (- 1.0 (* x (cos B))) (sin B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1e+16) {
		tmp = (-1.0 / sin(B)) - (x * (cos(B) / sin(B)));
	} else if (F <= 85000000.0) {
		tmp = (F * (sqrt((1.0 / fma(F, F, 2.0))) / sin(B))) - (x / tan(B));
	} else {
		tmp = (1.0 - (x * cos(B))) / sin(B);
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -1e+16)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x * Float64(cos(B) / sin(B))));
	elseif (F <= 85000000.0)
		tmp = Float64(Float64(F * Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) / sin(B))) - Float64(x / tan(B)));
	else
		tmp = Float64(Float64(1.0 - Float64(x * cos(B))) / sin(B));
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -1e+16], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x * N[(N[Cos[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 85000000.0], N[(N[(F * N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq 85000000:\\
\;\;\;\;F \cdot \frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}}{\sin B} - \frac{x}{\tan B}\\

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


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

    1. Initial program 49.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in99.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg99.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/99.8%

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

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

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

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

    if -1e16 < F < 8.5e7

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

    if 8.5e7 < F

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 49.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in99.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg99.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/99.8%

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

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

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

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

    if -9e15 < F < 1.15e8

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{\frac{\tan B}{x}} + \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)} \]
    8. Simplified99.5%

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

    if 1.15e8 < F

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.16 \cdot 10^{+14}:\\
\;\;\;\;\frac{-1}{\sin B} - x \cdot \frac{\cos B}{\sin B}\\

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

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


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

    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. Simplified64.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in99.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg99.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/99.8%

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

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

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

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

    if -1.16e14 < F < 8.5e7

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

    if 8.5e7 < F

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 49.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in99.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg99.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/99.8%

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

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

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

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

    if -9e15 < F < 1.15e8

    1. Initial program 99.4%

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

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

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

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

    if 1.15e8 < F

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.0% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq 1.45:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B} - \frac{x}{\tan B}\\

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


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

    1. Initial program 51.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. Simplified66.3%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in99.7%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg99.7%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/99.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot 1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      5. metadata-eval99.7%

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

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

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

    if -1.5 < F < 1.44999999999999996

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

    if 1.44999999999999996 < F

    1. Initial program 53.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. Simplified68.9%

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

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

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

        \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + {F}^{2}}}}}{\sin B} - \frac{x}{\tan B} \]
      3. +-commutative68.9%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{{F}^{2} + 2}}}}{\sin B} - \frac{x}{\tan B} \]
      4. unpow268.9%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    8. Step-by-step derivation
      1. div-sub98.7%

        \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    9. Simplified98.7%

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

Alternative 7: 92.7% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq -4.9 \cdot 10^{-144}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 5.5 \cdot 10^{-125}:\\
\;\;\;\;F \cdot \left(\sqrt{0.5} \cdot \frac{1}{B}\right) - \frac{x}{\tan B}\\

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

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


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

    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. Simplified64.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in99.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg99.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/99.8%

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

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

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

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

    if -2.7e13 < F < -4.9000000000000001e-144 or 5.4999999999999997e-125 < F < 3.5e7

    1. Initial program 99.4%

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

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

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

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

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

    if -4.9000000000000001e-144 < F < 5.4999999999999997e-125

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.5e7 < F

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 92.7% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -5.6 \cdot 10^{-144}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 1.35 \cdot 10^{-127}:\\
\;\;\;\;F \cdot \left(\sqrt{0.5} \cdot \frac{1}{B}\right) - t\_1\\

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

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


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

    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. Simplified64.9%

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

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

    if -2.7e13 < F < -5.59999999999999995e-144 or 1.35e-127 < F < 3.3e7

    1. Initial program 99.4%

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

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

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

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

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

    if -5.59999999999999995e-144 < F < 1.35e-127

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.3e7 < F

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 91.7% accurate, 1.5× speedup?

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

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

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

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


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

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

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

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

    if -0.0550000000000000003 < F < 0.309999999999999998

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.309999999999999998 < F

    1. Initial program 53.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. Simplified68.9%

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

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

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

        \[\leadsto F \cdot \frac{\color{blue}{\sqrt{\frac{1}{2 + {F}^{2}}}}}{\sin B} - \frac{x}{\tan B} \]
      3. +-commutative68.9%

        \[\leadsto F \cdot \frac{\sqrt{\frac{1}{\color{blue}{{F}^{2} + 2}}}}{\sin B} - \frac{x}{\tan B} \]
      4. unpow268.9%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    8. Step-by-step derivation
      1. div-sub98.7%

        \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    9. Simplified98.7%

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

Alternative 10: 83.9% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 62.5%

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

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

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

    if -3.59999999999999993e-87 < F < 3.10000000000000015e-53

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\cos B}{\sin B} \cdot \left(-x\right)} \]
    10. Step-by-step derivation
      1. *-commutative76.6%

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

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

        \[\leadsto \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{\cos B}{\sin B} \]
      4. sqr-neg16.3%

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{\cos B}{\sin B} \]
      5. sqrt-unprod1.2%

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

        \[\leadsto \color{blue}{x} \cdot \frac{\cos B}{\sin B} \]
      7. clear-num2.1%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      8. tan-quot2.1%

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

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

        \[\leadsto \color{blue}{\frac{-x}{-\tan B}} \]
      11. neg-sub02.1%

        \[\leadsto \frac{\color{blue}{0 - x}}{-\tan B} \]
      12. div-sub2.1%

        \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{-\tan B}} \]
      13. add-sqr-sqrt1.2%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\tan B} \]
      14. sqrt-unprod16.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x \cdot x}}}{-\tan B} \]
      15. sqr-neg16.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-\tan B} \]
      16. sqrt-unprod22.8%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-\tan B} \]
      17. add-sqr-sqrt76.7%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{-x}}{-\tan B} \]
      18. frac-2neg76.7%

        \[\leadsto \frac{0}{-\tan B} - \color{blue}{\frac{x}{\tan B}} \]
    11. Applied egg-rr76.7%

      \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{\tan B}} \]
    12. Step-by-step derivation
      1. div076.7%

        \[\leadsto \color{blue}{0} - \frac{x}{\tan B} \]
      2. neg-sub076.7%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      3. distribute-neg-frac76.7%

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    13. Simplified76.7%

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

    if 3.10000000000000015e-53 < F

    1. Initial program 59.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    8. Step-by-step derivation
      1. div-sub92.2%

        \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    9. Simplified92.2%

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

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

Alternative 11: 83.9% accurate, 1.5× speedup?

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

\mathbf{elif}\;F \leq 3.7 \cdot 10^{-53}:\\
\;\;\;\;\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 < -3.59999999999999993e-87

    1. Initial program 62.5%

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

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

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

    if -3.59999999999999993e-87 < F < 3.69999999999999982e-53

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\cos B}{\sin B} \cdot \left(-x\right)} \]
    10. Step-by-step derivation
      1. *-commutative76.6%

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

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

        \[\leadsto \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{\cos B}{\sin B} \]
      4. sqr-neg16.3%

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{\cos B}{\sin B} \]
      5. sqrt-unprod1.2%

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

        \[\leadsto \color{blue}{x} \cdot \frac{\cos B}{\sin B} \]
      7. clear-num2.1%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      8. tan-quot2.1%

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

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

        \[\leadsto \color{blue}{\frac{-x}{-\tan B}} \]
      11. neg-sub02.1%

        \[\leadsto \frac{\color{blue}{0 - x}}{-\tan B} \]
      12. div-sub2.1%

        \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{-\tan B}} \]
      13. add-sqr-sqrt1.2%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\tan B} \]
      14. sqrt-unprod16.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x \cdot x}}}{-\tan B} \]
      15. sqr-neg16.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-\tan B} \]
      16. sqrt-unprod22.8%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-\tan B} \]
      17. add-sqr-sqrt76.7%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{-x}}{-\tan B} \]
      18. frac-2neg76.7%

        \[\leadsto \frac{0}{-\tan B} - \color{blue}{\frac{x}{\tan B}} \]
    11. Applied egg-rr76.7%

      \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{\tan B}} \]
    12. Step-by-step derivation
      1. div076.7%

        \[\leadsto \color{blue}{0} - \frac{x}{\tan B} \]
      2. neg-sub076.7%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      3. distribute-neg-frac76.7%

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    13. Simplified76.7%

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

    if 3.69999999999999982e-53 < F

    1. Initial program 59.1%

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

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

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

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

Alternative 12: 77.1% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 62.5%

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

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

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

    if -3.59999999999999993e-87 < F < 3.69999999999999982e-53

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\cos B}{\sin B} \cdot \left(-x\right)} \]
    10. Step-by-step derivation
      1. *-commutative76.6%

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

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

        \[\leadsto \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{\cos B}{\sin B} \]
      4. sqr-neg16.3%

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{\cos B}{\sin B} \]
      5. sqrt-unprod1.2%

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

        \[\leadsto \color{blue}{x} \cdot \frac{\cos B}{\sin B} \]
      7. clear-num2.1%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      8. tan-quot2.1%

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

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

        \[\leadsto \color{blue}{\frac{-x}{-\tan B}} \]
      11. neg-sub02.1%

        \[\leadsto \frac{\color{blue}{0 - x}}{-\tan B} \]
      12. div-sub2.1%

        \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{-\tan B}} \]
      13. add-sqr-sqrt1.2%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\tan B} \]
      14. sqrt-unprod16.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x \cdot x}}}{-\tan B} \]
      15. sqr-neg16.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-\tan B} \]
      16. sqrt-unprod22.8%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-\tan B} \]
      17. add-sqr-sqrt76.7%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{-x}}{-\tan B} \]
      18. frac-2neg76.7%

        \[\leadsto \frac{0}{-\tan B} - \color{blue}{\frac{x}{\tan B}} \]
    11. Applied egg-rr76.7%

      \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{\tan B}} \]
    12. Step-by-step derivation
      1. div076.7%

        \[\leadsto \color{blue}{0} - \frac{x}{\tan B} \]
      2. neg-sub076.7%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      3. distribute-neg-frac76.7%

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    13. Simplified76.7%

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

    if 3.69999999999999982e-53 < F

    1. Initial program 59.1%

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

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

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

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

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

Alternative 13: 71.1% accurate, 2.7× speedup?

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

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

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

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


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

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

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

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

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

    if -3.1e-4 < F < 3.69999999999999982e-53

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\cos B}{\sin B} \cdot \left(-x\right)} \]
    10. Step-by-step derivation
      1. *-commutative64.7%

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
      2. add-sqr-sqrt18.1%

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

        \[\leadsto \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{\cos B}{\sin B} \]
      4. sqr-neg13.3%

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{\cos B}{\sin B} \]
      5. sqrt-unprod1.2%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{\cos B}{\sin B} \]
      6. add-sqr-sqrt2.4%

        \[\leadsto \color{blue}{x} \cdot \frac{\cos B}{\sin B} \]
      7. clear-num2.4%

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

        \[\leadsto x \cdot \frac{1}{\color{blue}{\tan B}} \]
      9. div-inv2.4%

        \[\leadsto \color{blue}{\frac{x}{\tan B}} \]
      10. frac-2neg2.4%

        \[\leadsto \color{blue}{\frac{-x}{-\tan B}} \]
      11. neg-sub02.4%

        \[\leadsto \frac{\color{blue}{0 - x}}{-\tan B} \]
      12. div-sub2.4%

        \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{-\tan B}} \]
      13. add-sqr-sqrt1.2%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\tan B} \]
      14. sqrt-unprod13.4%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x \cdot x}}}{-\tan B} \]
      15. sqr-neg13.4%

        \[\leadsto \frac{0}{-\tan B} - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-\tan B} \]
      16. sqrt-unprod18.1%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-\tan B} \]
      17. add-sqr-sqrt64.9%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{-x}}{-\tan B} \]
      18. frac-2neg64.9%

        \[\leadsto \frac{0}{-\tan B} - \color{blue}{\frac{x}{\tan B}} \]
    11. Applied egg-rr64.9%

      \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{\tan B}} \]
    12. Step-by-step derivation
      1. div064.9%

        \[\leadsto \color{blue}{0} - \frac{x}{\tan B} \]
      2. neg-sub064.9%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      3. distribute-neg-frac64.9%

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    13. Simplified64.9%

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

    if 3.69999999999999982e-53 < F

    1. Initial program 59.1%

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

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

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

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

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

Alternative 14: 70.5% accurate, 2.8× speedup?

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

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

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

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


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

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

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

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

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

    if -3.20000000000000026e-4 < F < 1.14999999999999997e-119

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\cos B}{\sin B} \cdot \left(-x\right)} \]
    10. Step-by-step derivation
      1. *-commutative68.2%

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

        \[\leadsto \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{\cos B}{\sin B} \]
      3. sqrt-unprod13.5%

        \[\leadsto \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{\cos B}{\sin B} \]
      4. sqr-neg13.5%

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{\cos B}{\sin B} \]
      5. sqrt-unprod1.1%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{\cos B}{\sin B} \]
      6. add-sqr-sqrt2.3%

        \[\leadsto \color{blue}{x} \cdot \frac{\cos B}{\sin B} \]
      7. clear-num2.3%

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

        \[\leadsto x \cdot \frac{1}{\color{blue}{\tan B}} \]
      9. div-inv2.3%

        \[\leadsto \color{blue}{\frac{x}{\tan B}} \]
      10. frac-2neg2.3%

        \[\leadsto \color{blue}{\frac{-x}{-\tan B}} \]
      11. neg-sub02.3%

        \[\leadsto \frac{\color{blue}{0 - x}}{-\tan B} \]
      12. div-sub2.3%

        \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{-\tan B}} \]
      13. add-sqr-sqrt1.1%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\tan B} \]
      14. sqrt-unprod13.5%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x \cdot x}}}{-\tan B} \]
      15. sqr-neg13.5%

        \[\leadsto \frac{0}{-\tan B} - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-\tan B} \]
      16. sqrt-unprod18.7%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-\tan B} \]
      17. add-sqr-sqrt68.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{-x}}{-\tan B} \]
      18. frac-2neg68.3%

        \[\leadsto \frac{0}{-\tan B} - \color{blue}{\frac{x}{\tan B}} \]
    11. Applied egg-rr68.3%

      \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{\tan B}} \]
    12. Step-by-step derivation
      1. div068.3%

        \[\leadsto \color{blue}{0} - \frac{x}{\tan B} \]
      2. neg-sub068.3%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      3. distribute-neg-frac68.3%

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    13. Simplified68.3%

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

    if 1.14999999999999997e-119 < F

    1. Initial program 61.9%

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

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

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

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

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

Alternative 15: 64.1% accurate, 2.8× speedup?

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

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

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

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


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

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

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

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

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

    if -0.032000000000000001 < F < 2.04999999999999993e111

    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. Simplified99.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(x \cdot \frac{\cos B}{\sin B}\right)} \]
      2. *-commutative58.4%

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

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

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

      \[\leadsto \color{blue}{\frac{\cos B}{\sin B} \cdot \left(-x\right)} \]
    10. Step-by-step derivation
      1. *-commutative58.4%

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
      2. add-sqr-sqrt14.9%

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

        \[\leadsto \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{\cos B}{\sin B} \]
      4. sqr-neg11.8%

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{\cos B}{\sin B} \]
      5. sqrt-unprod1.3%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{\cos B}{\sin B} \]
      6. add-sqr-sqrt2.3%

        \[\leadsto \color{blue}{x} \cdot \frac{\cos B}{\sin B} \]
      7. clear-num2.3%

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

        \[\leadsto x \cdot \frac{1}{\color{blue}{\tan B}} \]
      9. div-inv2.3%

        \[\leadsto \color{blue}{\frac{x}{\tan B}} \]
      10. frac-2neg2.3%

        \[\leadsto \color{blue}{\frac{-x}{-\tan B}} \]
      11. neg-sub02.3%

        \[\leadsto \frac{\color{blue}{0 - x}}{-\tan B} \]
      12. div-sub2.3%

        \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{-\tan B}} \]
      13. add-sqr-sqrt1.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\tan B} \]
      14. sqrt-unprod11.9%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x \cdot x}}}{-\tan B} \]
      15. sqr-neg11.9%

        \[\leadsto \frac{0}{-\tan B} - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-\tan B} \]
      16. sqrt-unprod15.0%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-\tan B} \]
      17. add-sqr-sqrt58.5%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{-x}}{-\tan B} \]
      18. frac-2neg58.5%

        \[\leadsto \frac{0}{-\tan B} - \color{blue}{\frac{x}{\tan B}} \]
    11. Applied egg-rr58.5%

      \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{\tan B}} \]
    12. Step-by-step derivation
      1. div058.5%

        \[\leadsto \color{blue}{0} - \frac{x}{\tan B} \]
      2. neg-sub058.5%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      3. distribute-neg-frac58.5%

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    13. Simplified58.5%

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

    if 2.04999999999999993e111 < F

    1. Initial program 28.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. Simplified50.6%

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

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

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

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

Alternative 16: 63.2% accurate, 2.8× speedup?

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

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

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

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


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

    1. Initial program 62.5%

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

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

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

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

    if -3.59999999999999993e-87 < F < 2.9000000000000002e112

    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. Simplified99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\cos B}{\sin B} \cdot \left(-x\right)} \]
    10. Step-by-step derivation
      1. *-commutative65.2%

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
      2. add-sqr-sqrt17.5%

        \[\leadsto \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{\cos B}{\sin B} \]
      3. sqrt-unprod13.5%

        \[\leadsto \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{\cos B}{\sin B} \]
      4. sqr-neg13.5%

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{\cos B}{\sin B} \]
      5. sqrt-unprod1.3%

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

        \[\leadsto \color{blue}{x} \cdot \frac{\cos B}{\sin B} \]
      7. clear-num2.1%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{\sin B}{\cos B}}} \]
      8. tan-quot2.1%

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

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

        \[\leadsto \color{blue}{\frac{-x}{-\tan B}} \]
      11. neg-sub02.1%

        \[\leadsto \frac{\color{blue}{0 - x}}{-\tan B} \]
      12. div-sub2.1%

        \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{-\tan B}} \]
      13. add-sqr-sqrt1.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\tan B} \]
      14. sqrt-unprod13.6%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x \cdot x}}}{-\tan B} \]
      15. sqr-neg13.6%

        \[\leadsto \frac{0}{-\tan B} - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-\tan B} \]
      16. sqrt-unprod17.5%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-\tan B} \]
      17. add-sqr-sqrt65.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{-x}}{-\tan B} \]
      18. frac-2neg65.3%

        \[\leadsto \frac{0}{-\tan B} - \color{blue}{\frac{x}{\tan B}} \]
    11. Applied egg-rr65.3%

      \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{\tan B}} \]
    12. Step-by-step derivation
      1. div065.3%

        \[\leadsto \color{blue}{0} - \frac{x}{\tan B} \]
      2. neg-sub065.3%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      3. distribute-neg-frac65.3%

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    13. Simplified65.3%

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

    if 2.9000000000000002e112 < F

    1. Initial program 28.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. Simplified50.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.6 \cdot 10^{-87}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2.9 \cdot 10^{+112}:\\ \;\;\;\;\frac{x}{-\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 57.9% accurate, 2.8× speedup?

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

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

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

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


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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in98.6%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg98.6%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/98.6%

        \[\leadsto \color{blue}{\frac{-1 \cdot 1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      5. metadata-eval98.6%

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

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

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

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

    if -0.00479999999999999958 < F < 2.04999999999999993e111

    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. Simplified99.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(x \cdot \frac{\cos B}{\sin B}\right)} \]
      2. *-commutative58.4%

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

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

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

      \[\leadsto \color{blue}{\frac{\cos B}{\sin B} \cdot \left(-x\right)} \]
    10. Step-by-step derivation
      1. *-commutative58.4%

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
      2. add-sqr-sqrt14.9%

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

        \[\leadsto \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{\cos B}{\sin B} \]
      4. sqr-neg11.8%

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{\cos B}{\sin B} \]
      5. sqrt-unprod1.3%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{\cos B}{\sin B} \]
      6. add-sqr-sqrt2.3%

        \[\leadsto \color{blue}{x} \cdot \frac{\cos B}{\sin B} \]
      7. clear-num2.3%

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

        \[\leadsto x \cdot \frac{1}{\color{blue}{\tan B}} \]
      9. div-inv2.3%

        \[\leadsto \color{blue}{\frac{x}{\tan B}} \]
      10. frac-2neg2.3%

        \[\leadsto \color{blue}{\frac{-x}{-\tan B}} \]
      11. neg-sub02.3%

        \[\leadsto \frac{\color{blue}{0 - x}}{-\tan B} \]
      12. div-sub2.3%

        \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{-\tan B}} \]
      13. add-sqr-sqrt1.3%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{-\tan B} \]
      14. sqrt-unprod11.9%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{x \cdot x}}}{-\tan B} \]
      15. sqr-neg11.9%

        \[\leadsto \frac{0}{-\tan B} - \frac{\sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)}}}{-\tan B} \]
      16. sqrt-unprod15.0%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{-\tan B} \]
      17. add-sqr-sqrt58.5%

        \[\leadsto \frac{0}{-\tan B} - \frac{\color{blue}{-x}}{-\tan B} \]
      18. frac-2neg58.5%

        \[\leadsto \frac{0}{-\tan B} - \color{blue}{\frac{x}{\tan B}} \]
    11. Applied egg-rr58.5%

      \[\leadsto \color{blue}{\frac{0}{-\tan B} - \frac{x}{\tan B}} \]
    12. Step-by-step derivation
      1. div058.5%

        \[\leadsto \color{blue}{0} - \frac{x}{\tan B} \]
      2. neg-sub058.5%

        \[\leadsto \color{blue}{-\frac{x}{\tan B}} \]
      3. distribute-neg-frac58.5%

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    13. Simplified58.5%

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

    if 2.04999999999999993e111 < F

    1. Initial program 28.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. Simplified50.6%

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

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

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

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

Alternative 18: 42.7% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.6 \cdot 10^{-87}:\\
\;\;\;\;\frac{-1}{\sin B}\\

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

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


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

    1. Initial program 62.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in82.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg82.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/82.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot 1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      5. metadata-eval82.8%

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

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified82.9%

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

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

    if -3.59999999999999993e-87 < F < 4.2e-119

    1. Initial program 99.5%

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

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

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

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

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

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

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

    if 4.2e-119 < F

    1. Initial program 61.9%

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

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

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

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

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

Alternative 19: 43.0% accurate, 21.6× speedup?

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

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

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

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


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

    1. Initial program 62.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in82.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg82.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/82.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot 1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      5. metadata-eval82.8%

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

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified82.9%

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

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

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

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

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

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

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

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

    if -3.59999999999999993e-87 < F < 4.2e-119

    1. Initial program 99.5%

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

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

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

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

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

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

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

    if 4.2e-119 < F

    1. Initial program 61.9%

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

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

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

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

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

Alternative 20: 36.7% accurate, 23.1× speedup?

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

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

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

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


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

    1. Initial program 62.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in82.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} + -1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
      2. mul-1-neg82.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
      4. associate-*r/82.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot 1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      5. metadata-eval82.8%

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

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{\cos B}{\sin B}} \]
    6. Simplified82.9%

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

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

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

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

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

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

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

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

    if -3.59999999999999993e-87 < F < 1.00000000000000007e-17

    1. Initial program 99.5%

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

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

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

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

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

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

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

    if 1.00000000000000007e-17 < F

    1. Initial program 54.7%

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

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

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

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

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

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

Alternative 21: 29.5% accurate, 23.1× speedup?

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

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

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

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


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

    1. Initial program 62.5%

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

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

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

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

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

    if -3.59999999999999993e-87 < F < 1.00000000000000007e-17

    1. Initial program 99.5%

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

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

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

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

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

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

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

    if 1.00000000000000007e-17 < F

    1. Initial program 54.7%

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

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

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

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

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

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

Alternative 22: 17.5% accurate, 40.4× speedup?

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

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

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


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

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

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

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

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

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

    if 2.9999999999999997e-247 < F

    1. Initial program 68.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. Simplified79.1%

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

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

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

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

Alternative 23: 10.6% 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 72.4%

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

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

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

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

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

Reproduce

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