VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.3% → 99.0%
Time: 14.6s
Alternatives: 23
Speedup: 1.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 23 alternatives:

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

Initial Program: 76.3% 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.0% accurate, 1.1× speedup?

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

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

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

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


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

    1. Initial program 56.3%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)\right)} \]
      2. distribute-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{\sin B}\right)\right) + \left(\mathsf{neg}\left(\frac{x \cdot \cos B}{\sin B}\right)\right)} \]
      3. sub-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{\sin B}\right)\right) - \frac{x \cdot \cos B}{\sin B}} \]
      4. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{\sin B}\right)\right) - \frac{x \cdot \cos B}{\sin B}} \]
      5. distribute-neg-fracN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(1\right)}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      6. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{-1}}{\sin B} - \frac{x \cdot \cos B}{\sin B} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      8. lower-sin.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      9. lower-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x \cdot \cos B}{\sin B}} \]
      10. lower-*.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x \cdot \cos B}}{\sin B} \]
      11. lower-cos.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{x \cdot \color{blue}{\cos B}}{\sin B} \]
      12. lower-sin.f6499.8

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

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

    if -1.02e8 < F < 7.00000000000000038e-11

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

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

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

    if 7.00000000000000038e-11 < F

    1. Initial program 56.2%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
      2. lower-sin.f6499.9

        \[\leadsto \frac{1}{\color{blue}{\sin B}} - \frac{x}{\tan B} \]
    7. Applied rewrites99.9%

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

Alternative 2: 75.5% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{\left(\frac{-1}{2}\right)}\\
t_1 := \mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\frac{F}{B \cdot \sqrt{t\_1}} - \frac{x}{\tan B}\\

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

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\sqrt{\frac{1}{t\_1}}}{B}, F, \frac{-x}{\tan B}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1.99999999999999998e-92

    1. Initial program 80.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. Add Preprocessing
    3. Applied rewrites84.2%

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

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

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

        \[\leadsto \frac{F}{\color{blue}{B \cdot \sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      2. lower-sqrt.f64N/A

        \[\leadsto \frac{F}{B \cdot \color{blue}{\sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      3. associate-+r+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 + 2 \cdot x\right) + {F}^{2}}}} - \frac{x}{\tan B} \]
      4. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 \cdot x + 2\right)} + {F}^{2}}} - \frac{x}{\tan B} \]
      5. associate-+l+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{2 \cdot x + \left(2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      6. *-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{x \cdot 2} + \left(2 + {F}^{2}\right)}} - \frac{x}{\tan B} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      8. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}} - \frac{x}{\tan B} \]
      9. unpow2N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}} - \frac{x}{\tan B} \]
      10. lower-fma.f6468.3

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

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

    if 1.99999999999999998e-92 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 20

    1. Initial program 95.2%

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

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

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{\frac{-1}{\sin B}}{\frac{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}{F}}, \color{blue}{-1 \cdot \frac{x}{B}}\right) \]
    6. Step-by-step derivation
      1. associate-*r/N/A

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{\frac{-1}{\sin B}}{\frac{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}{F}}, \color{blue}{\frac{-1 \cdot x}{B}}\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(-1, \frac{\frac{-1}{\sin B}}{\frac{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}{F}}, \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B}\right) \]
      4. lower-neg.f6477.8

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

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

    if 20 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1.9999999999999999e305

    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. Applied rewrites99.9%

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{B} \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
    5. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}{B}}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      2. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}{B}}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      4. lower-sqrt.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      5. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      7. associate-+l+N/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      10. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      13. lower-fma.f6499.8

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

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

    if 1.9999999999999999e305 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))))))

    1. Initial program 22.9%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6467.5

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites67.5%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6485.9

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

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

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

Alternative 3: 75.5% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{\left(\frac{-1}{2}\right)}\\
t_1 := \mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-92}:\\
\;\;\;\;\frac{F}{B \cdot \sqrt{t\_1}} - \frac{x}{\tan B}\\

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

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\sqrt{\frac{1}{t\_1}}}{B}, F, \frac{-x}{\tan B}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1.99999999999999998e-92

    1. Initial program 80.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. Add Preprocessing
    3. Applied rewrites84.2%

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

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

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

        \[\leadsto \frac{F}{\color{blue}{B \cdot \sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      2. lower-sqrt.f64N/A

        \[\leadsto \frac{F}{B \cdot \color{blue}{\sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      3. associate-+r+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 + 2 \cdot x\right) + {F}^{2}}}} - \frac{x}{\tan B} \]
      4. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 \cdot x + 2\right)} + {F}^{2}}} - \frac{x}{\tan B} \]
      5. associate-+l+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{2 \cdot x + \left(2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      6. *-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{x \cdot 2} + \left(2 + {F}^{2}\right)}} - \frac{x}{\tan B} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      8. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}} - \frac{x}{\tan B} \]
      9. unpow2N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}} - \frac{x}{\tan B} \]
      10. lower-fma.f6468.3

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

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

    if 1.99999999999999998e-92 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 20

    1. Initial program 95.2%

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

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

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

      \[\leadsto \frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \color{blue}{\frac{x}{B}} \]
    6. Step-by-step derivation
      1. lower-/.f6477.7

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

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

    if 20 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1.9999999999999999e305

    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. Applied rewrites99.9%

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{B} \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
    5. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1 \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}{B}}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      2. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      3. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}{B}}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      4. lower-sqrt.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      5. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      7. associate-+l+N/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      10. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\frac{\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}}{B}, F, \frac{\mathsf{neg}\left(x\right)}{\tan B}\right) \]
      13. lower-fma.f6499.8

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

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

    if 1.9999999999999999e305 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))))))

    1. Initial program 22.9%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6467.5

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites67.5%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6485.9

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

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

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

Alternative 4: 75.5% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{\left(\frac{-1}{2}\right)}\\
t_1 := \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{\tan B}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-92}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1.99999999999999998e-92 or 20 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1.9999999999999999e305

    1. Initial program 85.9%

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

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

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

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

        \[\leadsto \frac{F}{\color{blue}{B \cdot \sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      2. lower-sqrt.f64N/A

        \[\leadsto \frac{F}{B \cdot \color{blue}{\sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      3. associate-+r+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 + 2 \cdot x\right) + {F}^{2}}}} - \frac{x}{\tan B} \]
      4. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 \cdot x + 2\right)} + {F}^{2}}} - \frac{x}{\tan B} \]
      5. associate-+l+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{2 \cdot x + \left(2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      6. *-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{x \cdot 2} + \left(2 + {F}^{2}\right)}} - \frac{x}{\tan B} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      8. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}} - \frac{x}{\tan B} \]
      9. unpow2N/A

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

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

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

    if 1.99999999999999998e-92 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 20

    1. Initial program 95.2%

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

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

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

      \[\leadsto \frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \color{blue}{\frac{x}{B}} \]
    6. Step-by-step derivation
      1. lower-/.f6477.7

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

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

    if 1.9999999999999999e305 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))))))

    1. Initial program 22.9%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6467.5

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites67.5%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6485.9

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

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

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

Alternative 5: 74.8% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{\tan B}\\
t_1 := \frac{F}{\sin B}\\
t_2 := x \cdot \frac{-1}{\tan B} + t\_1 \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{\left(\frac{-1}{2}\right)}\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-84}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_2 \leq 20:\\
\;\;\;\;t\_1 \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 2.0000000000000001e-84 or 20 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1.9999999999999999e305

    1. Initial program 85.9%

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

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

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

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

        \[\leadsto \frac{F}{\color{blue}{B \cdot \sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      2. lower-sqrt.f64N/A

        \[\leadsto \frac{F}{B \cdot \color{blue}{\sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      3. associate-+r+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 + 2 \cdot x\right) + {F}^{2}}}} - \frac{x}{\tan B} \]
      4. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 \cdot x + 2\right)} + {F}^{2}}} - \frac{x}{\tan B} \]
      5. associate-+l+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{2 \cdot x + \left(2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      6. *-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{x \cdot 2} + \left(2 + {F}^{2}\right)}} - \frac{x}{\tan B} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      8. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}} - \frac{x}{\tan B} \]
      9. unpow2N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}} - \frac{x}{\tan B} \]
      10. lower-fma.f6477.3

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

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

    if 2.0000000000000001e-84 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 20

    1. Initial program 95.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. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + {F}^{2}}} \]
      3. lower-sin.f64N/A

        \[\leadsto \frac{F}{\color{blue}{\sin B}} \cdot \sqrt{\frac{1}{2 + {F}^{2}}} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{F}{\sin B} \cdot \color{blue}{\sqrt{\frac{1}{2 + {F}^{2}}}} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\color{blue}{\frac{1}{2 + {F}^{2}}}} \]
      6. +-commutativeN/A

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{\color{blue}{{F}^{2} + 2}}} \]
      7. unpow2N/A

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}} \]
      8. lower-fma.f6466.6

        \[\leadsto \frac{F}{\sin B} \cdot \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}} \]
    5. Applied rewrites66.6%

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

    if 1.9999999999999999e305 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))))))

    1. Initial program 22.9%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6467.5

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites67.5%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6485.9

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

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

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

Alternative 6: 99.0% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 56.3%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6499.7

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    6. Step-by-step derivation
      1. lift-tan.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\color{blue}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      2. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      3. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      6. lift-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} + \frac{-1}{\sin B} \]
      7. lift-sin.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \frac{-1}{\color{blue}{\sin B}} \]
      8. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      10. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} + \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      11. unsub-negN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      12. lower--.f6499.7

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{1}{\tan B}} \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - x \cdot \color{blue}{\frac{1}{\tan B}} \]
      15. un-div-invN/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
      16. remove-double-negN/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}}{\tan B} \]
      17. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\tan B}} \]
      19. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      20. remove-double-neg99.8

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

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

    if -1.02e8 < F < 7.00000000000000038e-11

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

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

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

    if 7.00000000000000038e-11 < F

    1. Initial program 56.2%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
      2. lower-sin.f6499.9

        \[\leadsto \frac{1}{\color{blue}{\sin B}} - \frac{x}{\tan B} \]
    7. Applied rewrites99.9%

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

Alternative 7: 98.7% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 57.6%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6498.9

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    6. Step-by-step derivation
      1. lift-tan.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\color{blue}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      2. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      3. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      6. lift-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} + \frac{-1}{\sin B} \]
      7. lift-sin.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \frac{-1}{\color{blue}{\sin B}} \]
      8. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      10. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} + \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      11. unsub-negN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      12. lower--.f6498.9

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{1}{\tan B}} \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - x \cdot \color{blue}{\frac{1}{\tan B}} \]
      15. un-div-invN/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
      16. remove-double-negN/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}}{\tan B} \]
      17. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\tan B}} \]
      19. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      20. remove-double-neg99.0

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    7. Applied rewrites99.0%

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

    if -1.8500000000000001 < F < 7.00000000000000038e-11

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

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

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

      \[\leadsto \frac{F}{\color{blue}{\sin B \cdot \sqrt{2 + 2 \cdot x}}} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{F}{\color{blue}{\sin B \cdot \sqrt{2 + 2 \cdot x}}} - \frac{x}{\tan B} \]
      2. lower-sin.f64N/A

        \[\leadsto \frac{F}{\color{blue}{\sin B} \cdot \sqrt{2 + 2 \cdot x}} - \frac{x}{\tan B} \]
      3. lower-sqrt.f64N/A

        \[\leadsto \frac{F}{\sin B \cdot \color{blue}{\sqrt{2 + 2 \cdot x}}} - \frac{x}{\tan B} \]
      4. +-commutativeN/A

        \[\leadsto \frac{F}{\sin B \cdot \sqrt{\color{blue}{2 \cdot x + 2}}} - \frac{x}{\tan B} \]
      5. *-commutativeN/A

        \[\leadsto \frac{F}{\sin B \cdot \sqrt{\color{blue}{x \cdot 2} + 2}} - \frac{x}{\tan B} \]
      6. lower-fma.f6498.9

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

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

    if 7.00000000000000038e-11 < F

    1. Initial program 56.2%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
      2. lower-sin.f6499.9

        \[\leadsto \frac{1}{\color{blue}{\sin B}} - \frac{x}{\tan B} \]
    7. Applied rewrites99.9%

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

Alternative 8: 92.1% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq -5.5 \cdot 10^{-102}:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{B}\\

\mathbf{elif}\;F \leq 3.9 \cdot 10^{-16}:\\
\;\;\;\;\frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - t\_0\\

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


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

    1. Initial program 56.9%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6499.7

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    6. Step-by-step derivation
      1. lift-tan.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\color{blue}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      2. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      3. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      6. lift-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} + \frac{-1}{\sin B} \]
      7. lift-sin.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \frac{-1}{\color{blue}{\sin B}} \]
      8. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      10. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} + \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      11. unsub-negN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      12. lower--.f6499.7

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{1}{\tan B}} \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - x \cdot \color{blue}{\frac{1}{\tan B}} \]
      15. un-div-invN/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
      16. remove-double-negN/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}}{\tan B} \]
      17. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\tan B}} \]
      19. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      20. remove-double-neg99.8

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

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

    if -4.9e5 < F < -5.4999999999999997e-102

    1. Initial program 99.3%

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

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

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

      \[\leadsto \frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \color{blue}{\frac{x}{B}} \]
    6. Step-by-step derivation
      1. lower-/.f6486.7

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

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

    if -5.4999999999999997e-102 < F < 3.89999999999999977e-16

    1. Initial program 99.5%

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

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

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

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

        \[\leadsto \frac{F}{\color{blue}{B \cdot \sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      2. lower-sqrt.f64N/A

        \[\leadsto \frac{F}{B \cdot \color{blue}{\sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      3. associate-+r+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 + 2 \cdot x\right) + {F}^{2}}}} - \frac{x}{\tan B} \]
      4. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 \cdot x + 2\right)} + {F}^{2}}} - \frac{x}{\tan B} \]
      5. associate-+l+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{2 \cdot x + \left(2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      6. *-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{x \cdot 2} + \left(2 + {F}^{2}\right)}} - \frac{x}{\tan B} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      8. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}} - \frac{x}{\tan B} \]
      9. unpow2N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}} - \frac{x}{\tan B} \]
      10. lower-fma.f6490.5

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

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

    if 3.89999999999999977e-16 < F

    1. Initial program 56.7%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
      2. lower-sin.f6498.8

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

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

Alternative 9: 82.8% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\\ t_1 := \frac{-1}{\sin B}\\ t_2 := \frac{x}{\tan B}\\ t_3 := \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - t\_2\\ \mathbf{if}\;F \leq -490000:\\ \;\;\;\;t\_1 - t\_2\\ \mathbf{elif}\;F \leq -5.5 \cdot 10^{-102}:\\ \;\;\;\;\frac{F}{\sin B \cdot t\_0} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 3 \cdot 10^{-126}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;F \leq 10^{+120}:\\ \;\;\;\;\mathsf{fma}\left(-1, \frac{t\_1}{\frac{t\_0}{F}}, \frac{-x}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (sqrt (fma 2.0 x (fma F F 2.0))))
        (t_1 (/ -1.0 (sin B)))
        (t_2 (/ x (tan B)))
        (t_3 (- (/ F (* B (sqrt (fma x 2.0 (fma F F 2.0))))) t_2)))
   (if (<= F -490000.0)
     (- t_1 t_2)
     (if (<= F -5.5e-102)
       (- (/ F (* (sin B) t_0)) (/ x B))
       (if (<= F 3e-126)
         t_3
         (if (<= F 1e+120) (fma -1.0 (/ t_1 (/ t_0 F)) (/ (- x) B)) t_3))))))
double code(double F, double B, double x) {
	double t_0 = sqrt(fma(2.0, x, fma(F, F, 2.0)));
	double t_1 = -1.0 / sin(B);
	double t_2 = x / tan(B);
	double t_3 = (F / (B * sqrt(fma(x, 2.0, fma(F, F, 2.0))))) - t_2;
	double tmp;
	if (F <= -490000.0) {
		tmp = t_1 - t_2;
	} else if (F <= -5.5e-102) {
		tmp = (F / (sin(B) * t_0)) - (x / B);
	} else if (F <= 3e-126) {
		tmp = t_3;
	} else if (F <= 1e+120) {
		tmp = fma(-1.0, (t_1 / (t_0 / F)), (-x / B));
	} else {
		tmp = t_3;
	}
	return tmp;
}
function code(F, B, x)
	t_0 = sqrt(fma(2.0, x, fma(F, F, 2.0)))
	t_1 = Float64(-1.0 / sin(B))
	t_2 = Float64(x / tan(B))
	t_3 = Float64(Float64(F / Float64(B * sqrt(fma(x, 2.0, fma(F, F, 2.0))))) - t_2)
	tmp = 0.0
	if (F <= -490000.0)
		tmp = Float64(t_1 - t_2);
	elseif (F <= -5.5e-102)
		tmp = Float64(Float64(F / Float64(sin(B) * t_0)) - Float64(x / B));
	elseif (F <= 3e-126)
		tmp = t_3;
	elseif (F <= 1e+120)
		tmp = fma(-1.0, Float64(t_1 / Float64(t_0 / F)), Float64(Float64(-x) / B));
	else
		tmp = t_3;
	end
	return tmp
end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(F / N[(B * N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]}, If[LessEqual[F, -490000.0], N[(t$95$1 - t$95$2), $MachinePrecision], If[LessEqual[F, -5.5e-102], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3e-126], t$95$3, If[LessEqual[F, 1e+120], N[(-1.0 * N[(t$95$1 / N[(t$95$0 / F), $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\\
t_1 := \frac{-1}{\sin B}\\
t_2 := \frac{x}{\tan B}\\
t_3 := \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - t\_2\\
\mathbf{if}\;F \leq -490000:\\
\;\;\;\;t\_1 - t\_2\\

\mathbf{elif}\;F \leq -5.5 \cdot 10^{-102}:\\
\;\;\;\;\frac{F}{\sin B \cdot t\_0} - \frac{x}{B}\\

\mathbf{elif}\;F \leq 3 \cdot 10^{-126}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;F \leq 10^{+120}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{t\_1}{\frac{t\_0}{F}}, \frac{-x}{B}\right)\\

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


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

    1. Initial program 56.9%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6499.7

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    6. Step-by-step derivation
      1. lift-tan.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\color{blue}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      2. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      3. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      6. lift-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} + \frac{-1}{\sin B} \]
      7. lift-sin.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \frac{-1}{\color{blue}{\sin B}} \]
      8. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      10. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} + \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      11. unsub-negN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      12. lower--.f6499.7

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{1}{\tan B}} \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - x \cdot \color{blue}{\frac{1}{\tan B}} \]
      15. un-div-invN/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
      16. remove-double-negN/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}}{\tan B} \]
      17. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\tan B}} \]
      19. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      20. remove-double-neg99.8

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

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

    if -4.9e5 < F < -5.4999999999999997e-102

    1. Initial program 99.3%

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

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

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

      \[\leadsto \frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \color{blue}{\frac{x}{B}} \]
    6. Step-by-step derivation
      1. lower-/.f6486.7

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

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

    if -5.4999999999999997e-102 < F < 3.0000000000000002e-126 or 9.9999999999999998e119 < F

    1. Initial program 77.8%

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

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

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

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

        \[\leadsto \frac{F}{\color{blue}{B \cdot \sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      2. lower-sqrt.f64N/A

        \[\leadsto \frac{F}{B \cdot \color{blue}{\sqrt{2 + \left(2 \cdot x + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      3. associate-+r+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 + 2 \cdot x\right) + {F}^{2}}}} - \frac{x}{\tan B} \]
      4. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\left(2 \cdot x + 2\right)} + {F}^{2}}} - \frac{x}{\tan B} \]
      5. associate-+l+N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{2 \cdot x + \left(2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      6. *-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{x \cdot 2} + \left(2 + {F}^{2}\right)}} - \frac{x}{\tan B} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}} - \frac{x}{\tan B} \]
      8. +-commutativeN/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}} - \frac{x}{\tan B} \]
      9. unpow2N/A

        \[\leadsto \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}} - \frac{x}{\tan B} \]
      10. lower-fma.f6480.2

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

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

    if 3.0000000000000002e-126 < F < 9.9999999999999998e119

    1. Initial program 85.4%

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

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

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{\frac{-1}{\sin B}}{\frac{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}{F}}, \color{blue}{-1 \cdot \frac{x}{B}}\right) \]
    6. Step-by-step derivation
      1. associate-*r/N/A

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

        \[\leadsto \mathsf{fma}\left(-1, \frac{\frac{-1}{\sin B}}{\frac{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}{F}}, \color{blue}{\frac{-1 \cdot x}{B}}\right) \]
      3. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(-1, \frac{\frac{-1}{\sin B}}{\frac{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}{F}}, \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B}\right) \]
      4. lower-neg.f6491.4

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

      \[\leadsto \mathsf{fma}\left(-1, \frac{\frac{-1}{\sin B}}{\frac{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}{F}}, \color{blue}{\frac{-x}{B}}\right) \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 10: 56.5% accurate, 2.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.4 \cdot 10^{-5}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{fma}\left(B \cdot B, F \cdot 0.16666666666666666, F\right), \mathsf{fma}\left(x, \left(B \cdot B\right) \cdot 0.3333333333333333, -x\right)\right)}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{\mathsf{fma}\left(\mathsf{fma}\left(B, B \cdot 0.008333333333333333, -0.16666666666666666\right), B \cdot \left(B \cdot B\right), B\right)} - \frac{x}{\tan B}\\


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

    1. Initial program 72.2%

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

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

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

    if 1.39999999999999998e-5 < B

    1. Initial program 86.7%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6458.5

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    6. Step-by-step derivation
      1. lift-tan.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\color{blue}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      2. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      3. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      6. lift-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} + \frac{-1}{\sin B} \]
      7. lift-sin.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \frac{-1}{\color{blue}{\sin B}} \]
      8. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      10. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} + \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      11. unsub-negN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      12. lower--.f6458.5

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{1}{\tan B}} \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - x \cdot \color{blue}{\frac{1}{\tan B}} \]
      15. un-div-invN/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
      16. remove-double-negN/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}}{\tan B} \]
      17. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\tan B}} \]
      19. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      20. remove-double-neg58.6

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    7. Applied rewrites58.6%

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

      \[\leadsto \frac{-1}{\color{blue}{B \cdot \left(1 + {B}^{2} \cdot \left(\frac{1}{120} \cdot {B}^{2} - \frac{1}{6}\right)\right)}} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{-1}{B \cdot \color{blue}{\left({B}^{2} \cdot \left(\frac{1}{120} \cdot {B}^{2} - \frac{1}{6}\right) + 1\right)}} - \frac{x}{\tan B} \]
      2. distribute-rgt-inN/A

        \[\leadsto \frac{-1}{\color{blue}{\left({B}^{2} \cdot \left(\frac{1}{120} \cdot {B}^{2} - \frac{1}{6}\right)\right) \cdot B + 1 \cdot B}} - \frac{x}{\tan B} \]
      3. *-commutativeN/A

        \[\leadsto \frac{-1}{\color{blue}{\left(\left(\frac{1}{120} \cdot {B}^{2} - \frac{1}{6}\right) \cdot {B}^{2}\right)} \cdot B + 1 \cdot B} - \frac{x}{\tan B} \]
      4. associate-*l*N/A

        \[\leadsto \frac{-1}{\color{blue}{\left(\frac{1}{120} \cdot {B}^{2} - \frac{1}{6}\right) \cdot \left({B}^{2} \cdot B\right)} + 1 \cdot B} - \frac{x}{\tan B} \]
      5. *-lft-identityN/A

        \[\leadsto \frac{-1}{\left(\frac{1}{120} \cdot {B}^{2} - \frac{1}{6}\right) \cdot \left({B}^{2} \cdot B\right) + \color{blue}{B}} - \frac{x}{\tan B} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\mathsf{fma}\left(\frac{1}{120} \cdot {B}^{2} - \frac{1}{6}, {B}^{2} \cdot B, B\right)}} - \frac{x}{\tan B} \]
      7. sub-negN/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(\color{blue}{\frac{1}{120} \cdot {B}^{2} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, {B}^{2} \cdot B, B\right)} - \frac{x}{\tan B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(\color{blue}{{B}^{2} \cdot \frac{1}{120}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), {B}^{2} \cdot B, B\right)} - \frac{x}{\tan B} \]
      9. unpow2N/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(\color{blue}{\left(B \cdot B\right)} \cdot \frac{1}{120} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), {B}^{2} \cdot B, B\right)} - \frac{x}{\tan B} \]
      10. associate-*l*N/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(\color{blue}{B \cdot \left(B \cdot \frac{1}{120}\right)} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), {B}^{2} \cdot B, B\right)} - \frac{x}{\tan B} \]
      11. metadata-evalN/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(B \cdot \left(B \cdot \frac{1}{120}\right) + \color{blue}{\frac{-1}{6}}, {B}^{2} \cdot B, B\right)} - \frac{x}{\tan B} \]
      12. lower-fma.f64N/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(B, B \cdot \frac{1}{120}, \frac{-1}{6}\right)}, {B}^{2} \cdot B, B\right)} - \frac{x}{\tan B} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(\mathsf{fma}\left(B, \color{blue}{B \cdot \frac{1}{120}}, \frac{-1}{6}\right), {B}^{2} \cdot B, B\right)} - \frac{x}{\tan B} \]
      14. lower-*.f64N/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(\mathsf{fma}\left(B, B \cdot \frac{1}{120}, \frac{-1}{6}\right), \color{blue}{{B}^{2} \cdot B}, B\right)} - \frac{x}{\tan B} \]
      15. unpow2N/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(\mathsf{fma}\left(B, B \cdot \frac{1}{120}, \frac{-1}{6}\right), \color{blue}{\left(B \cdot B\right)} \cdot B, B\right)} - \frac{x}{\tan B} \]
      16. lower-*.f6455.3

        \[\leadsto \frac{-1}{\mathsf{fma}\left(\mathsf{fma}\left(B, B \cdot 0.008333333333333333, -0.16666666666666666\right), \color{blue}{\left(B \cdot B\right)} \cdot B, B\right)} - \frac{x}{\tan B} \]
    10. Applied rewrites55.3%

      \[\leadsto \frac{-1}{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(B, B \cdot 0.008333333333333333, -0.16666666666666666\right), \left(B \cdot B\right) \cdot B, B\right)}} - \frac{x}{\tan B} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.4 \cdot 10^{-5}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{fma}\left(B \cdot B, F \cdot 0.16666666666666666, F\right), \mathsf{fma}\left(x, \left(B \cdot B\right) \cdot 0.3333333333333333, -x\right)\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\mathsf{fma}\left(\mathsf{fma}\left(B, B \cdot 0.008333333333333333, -0.16666666666666666\right), B \cdot \left(B \cdot B\right), B\right)} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 56.4% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.4 \cdot 10^{-5}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{fma}\left(B \cdot B, F \cdot 0.16666666666666666, F\right), \mathsf{fma}\left(x, \left(B \cdot B\right) \cdot 0.3333333333333333, -x\right)\right)}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{\mathsf{fma}\left(B, \left(B \cdot B\right) \cdot -0.16666666666666666, B\right)} - \frac{x}{\tan B}\\


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

    1. Initial program 72.2%

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

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

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

    if 1.39999999999999998e-5 < B

    1. Initial program 86.7%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6458.5

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    6. Step-by-step derivation
      1. lift-tan.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\color{blue}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      2. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      3. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      6. lift-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} + \frac{-1}{\sin B} \]
      7. lift-sin.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \frac{-1}{\color{blue}{\sin B}} \]
      8. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      10. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} + \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      11. unsub-negN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      12. lower--.f6458.5

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{1}{\tan B}} \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - x \cdot \color{blue}{\frac{1}{\tan B}} \]
      15. un-div-invN/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
      16. remove-double-negN/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}}{\tan B} \]
      17. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\tan B}} \]
      19. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      20. remove-double-neg58.6

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    7. Applied rewrites58.6%

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

      \[\leadsto \frac{-1}{\color{blue}{B \cdot \left(1 + \frac{-1}{6} \cdot {B}^{2}\right)}} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{-1}{B \cdot \color{blue}{\left(\frac{-1}{6} \cdot {B}^{2} + 1\right)}} - \frac{x}{\tan B} \]
      2. distribute-lft-inN/A

        \[\leadsto \frac{-1}{\color{blue}{B \cdot \left(\frac{-1}{6} \cdot {B}^{2}\right) + B \cdot 1}} - \frac{x}{\tan B} \]
      3. *-rgt-identityN/A

        \[\leadsto \frac{-1}{B \cdot \left(\frac{-1}{6} \cdot {B}^{2}\right) + \color{blue}{B}} - \frac{x}{\tan B} \]
      4. lower-fma.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\mathsf{fma}\left(B, \frac{-1}{6} \cdot {B}^{2}, B\right)}} - \frac{x}{\tan B} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(B, \color{blue}{\frac{-1}{6} \cdot {B}^{2}}, B\right)} - \frac{x}{\tan B} \]
      6. unpow2N/A

        \[\leadsto \frac{-1}{\mathsf{fma}\left(B, \frac{-1}{6} \cdot \color{blue}{\left(B \cdot B\right)}, B\right)} - \frac{x}{\tan B} \]
      7. lower-*.f6455.4

        \[\leadsto \frac{-1}{\mathsf{fma}\left(B, -0.16666666666666666 \cdot \color{blue}{\left(B \cdot B\right)}, B\right)} - \frac{x}{\tan B} \]
    10. Applied rewrites55.4%

      \[\leadsto \frac{-1}{\color{blue}{\mathsf{fma}\left(B, -0.16666666666666666 \cdot \left(B \cdot B\right), B\right)}} - \frac{x}{\tan B} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.4 \cdot 10^{-5}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{fma}\left(B \cdot B, F \cdot 0.16666666666666666, F\right), \mathsf{fma}\left(x, \left(B \cdot B\right) \cdot 0.3333333333333333, -x\right)\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\mathsf{fma}\left(B, \left(B \cdot B\right) \cdot -0.16666666666666666, B\right)} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 55.6% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B \leq 8.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{fma}\left(B \cdot B, F \cdot 0.16666666666666666, F\right), \mathsf{fma}\left(x, \left(B \cdot B\right) \cdot 0.3333333333333333, -x\right)\right)}{B}\\

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


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

    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. Add Preprocessing
    3. Taylor expanded in B around 0

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

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

    if 8.20000000000000009e-5 < B

    1. Initial program 86.5%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6457.8

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{-1}{\sin B}} \]
    6. Step-by-step derivation
      1. lift-tan.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\color{blue}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      2. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{x \cdot 1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      3. associate-*r/N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      4. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      5. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{1}{\tan B}}\right)\right) + \frac{-1}{\sin B} \]
      6. lift-neg.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} + \frac{-1}{\sin B} \]
      7. lift-sin.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \frac{-1}{\color{blue}{\sin B}} \]
      8. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      9. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} + \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      10. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} + \color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right)} \]
      11. unsub-negN/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      12. lower--.f6457.8

        \[\leadsto \color{blue}{\frac{-1}{\sin B} - x \cdot \frac{1}{\tan B}} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{x \cdot \frac{1}{\tan B}} \]
      14. lift-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - x \cdot \color{blue}{\frac{1}{\tan B}} \]
      15. un-div-invN/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{x}{\tan B}} \]
      16. remove-double-negN/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}}{\tan B} \]
      17. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\tan B}} \]
      19. lift-neg.f64N/A

        \[\leadsto \frac{-1}{\sin B} - \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)}{\tan B} \]
      20. remove-double-neg57.9

        \[\leadsto \frac{-1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    7. Applied rewrites57.9%

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

      \[\leadsto \color{blue}{\frac{-1}{B}} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. lower-/.f6445.0

        \[\leadsto \color{blue}{\frac{-1}{B}} - \frac{x}{\tan B} \]
    10. Applied rewrites45.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 8.2 \cdot 10^{-5}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{fma}\left(B \cdot B, F \cdot 0.16666666666666666, F\right), \mathsf{fma}\left(x, \left(B \cdot B\right) \cdot 0.3333333333333333, -x\right)\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 51.1% accurate, 3.0× speedup?

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

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

\mathbf{elif}\;F \leq -700:\\
\;\;\;\;\frac{-1}{\sin B}\\

\mathbf{elif}\;F \leq 3.9 \cdot 10^{-16}:\\
\;\;\;\;\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}\\

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


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

    1. Initial program 45.8%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6440.0

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites40.0%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(1 + x\right)\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(1 + x\right)\right)}{B}} \]
      4. distribute-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{-1} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      6. unsub-negN/A

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
      7. lower--.f6458.5

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

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

    if -6.60000000000000061e73 < F < -700

    1. Initial program 93.7%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6496.5

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

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

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6468.6

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} \]
    8. Applied rewrites68.6%

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

    if -700 < F < 3.89999999999999977e-16

    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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6463.2

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites63.2%

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

    if 3.89999999999999977e-16 < F

    1. Initial program 56.7%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6443.3

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites43.3%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6457.9

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

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

Alternative 14: 50.4% accurate, 5.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -720:\\
\;\;\;\;\frac{-1}{\mathsf{fma}\left(B, \left(B \cdot B\right) \cdot -0.16666666666666666, B\right)} - \frac{x}{B}\\

\mathbf{elif}\;F \leq 3.9 \cdot 10^{-16}:\\
\;\;\;\;\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}\\

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


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

    1. Initial program 57.6%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6498.9

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{-1}{\sin B} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} + \frac{-1}{\sin B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} + \frac{-1}{\sin B} \]
      4. lower-neg.f6477.2

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{-1}{\sin B} \]
    8. Applied rewrites77.2%

      \[\leadsto \color{blue}{\frac{-x}{B}} + \frac{-1}{\sin B} \]
    9. Taylor expanded in B around 0

      \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\color{blue}{B \cdot \left(1 + \frac{-1}{6} \cdot {B}^{2}\right)}} \]
    10. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{B \cdot \color{blue}{\left(\frac{-1}{6} \cdot {B}^{2} + 1\right)}} \]
      2. distribute-lft-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\color{blue}{B \cdot \left(\frac{-1}{6} \cdot {B}^{2}\right) + B \cdot 1}} \]
      3. *-rgt-identityN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{B \cdot \left(\frac{-1}{6} \cdot {B}^{2}\right) + \color{blue}{B}} \]
      4. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\color{blue}{\mathsf{fma}\left(B, \frac{-1}{6} \cdot {B}^{2}, B\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\mathsf{fma}\left(B, \color{blue}{\frac{-1}{6} \cdot {B}^{2}}, B\right)} \]
      6. unpow2N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\mathsf{fma}\left(B, \frac{-1}{6} \cdot \color{blue}{\left(B \cdot B\right)}, B\right)} \]
      7. lower-*.f6450.9

        \[\leadsto \frac{-x}{B} + \frac{-1}{\mathsf{fma}\left(B, -0.16666666666666666 \cdot \color{blue}{\left(B \cdot B\right)}, B\right)} \]
    11. Applied rewrites50.9%

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

    if -720 < F < 3.89999999999999977e-16

    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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6463.2

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites63.2%

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

    if 3.89999999999999977e-16 < F

    1. Initial program 56.7%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6443.3

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites43.3%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6457.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -720:\\ \;\;\;\;\frac{-1}{\mathsf{fma}\left(B, \left(B \cdot B\right) \cdot -0.16666666666666666, B\right)} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 3.9 \cdot 10^{-16}:\\ \;\;\;\;\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 50.5% accurate, 6.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -720:\\
\;\;\;\;\frac{-1}{\mathsf{fma}\left(B, \left(B \cdot B\right) \cdot -0.16666666666666666, B\right)} - \frac{x}{B}\\

\mathbf{elif}\;F \leq 1.62 \cdot 10^{+165}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} - x}{B}\\

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


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

    1. Initial program 57.6%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6498.9

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{-1}{\sin B} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} + \frac{-1}{\sin B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} + \frac{-1}{\sin B} \]
      4. lower-neg.f6477.2

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{-1}{\sin B} \]
    8. Applied rewrites77.2%

      \[\leadsto \color{blue}{\frac{-x}{B}} + \frac{-1}{\sin B} \]
    9. Taylor expanded in B around 0

      \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\color{blue}{B \cdot \left(1 + \frac{-1}{6} \cdot {B}^{2}\right)}} \]
    10. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{B \cdot \color{blue}{\left(\frac{-1}{6} \cdot {B}^{2} + 1\right)}} \]
      2. distribute-lft-inN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\color{blue}{B \cdot \left(\frac{-1}{6} \cdot {B}^{2}\right) + B \cdot 1}} \]
      3. *-rgt-identityN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{B \cdot \left(\frac{-1}{6} \cdot {B}^{2}\right) + \color{blue}{B}} \]
      4. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\color{blue}{\mathsf{fma}\left(B, \frac{-1}{6} \cdot {B}^{2}, B\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\mathsf{fma}\left(B, \color{blue}{\frac{-1}{6} \cdot {B}^{2}}, B\right)} \]
      6. unpow2N/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} + \frac{-1}{\mathsf{fma}\left(B, \frac{-1}{6} \cdot \color{blue}{\left(B \cdot B\right)}, B\right)} \]
      7. lower-*.f6450.9

        \[\leadsto \frac{-x}{B} + \frac{-1}{\mathsf{fma}\left(B, -0.16666666666666666 \cdot \color{blue}{\left(B \cdot B\right)}, B\right)} \]
    11. Applied rewrites50.9%

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

    if -720 < F < 1.61999999999999993e165

    1. Initial program 93.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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6462.5

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites62.5%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\mathsf{fma}\left(F, F, 2\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      2. lift-fma.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\color{blue}{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      4. lift-sqrt.f64N/A

        \[\leadsto \frac{F \cdot \color{blue}{\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      5. lift-neg.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      6. lift-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      7. lift-/.f6462.5

        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    7. Applied rewrites62.5%

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

      \[\leadsto \frac{\frac{F}{\color{blue}{\sqrt{2 + {F}^{2}}}} - x}{B} \]
    9. Step-by-step derivation
      1. lower-sqrt.f64N/A

        \[\leadsto \frac{\frac{F}{\color{blue}{\sqrt{2 + {F}^{2}}}} - x}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{F}{\sqrt{\color{blue}{{F}^{2} + 2}}} - x}{B} \]
      3. unpow2N/A

        \[\leadsto \frac{\frac{F}{\sqrt{\color{blue}{F \cdot F} + 2}} - x}{B} \]
      4. lower-fma.f6462.5

        \[\leadsto \frac{\frac{F}{\sqrt{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}} - x}{B} \]
    10. Applied rewrites62.5%

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

    if 1.61999999999999993e165 < F

    1. Initial program 33.2%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6423.7

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites23.7%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -720:\\ \;\;\;\;\frac{-1}{\mathsf{fma}\left(B, \left(B \cdot B\right) \cdot -0.16666666666666666, B\right)} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.62 \cdot 10^{+165}:\\ \;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 50.6% accurate, 6.8× speedup?

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

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

\mathbf{elif}\;F \leq 1.62 \cdot 10^{+165}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} - x}{B}\\

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


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

    1. Initial program 56.9%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6499.7

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

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

      \[\leadsto \color{blue}{\frac{{B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) - \left(1 + x\right)}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{{B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) - \left(1 + x\right)}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{{B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) + \left(\mathsf{neg}\left(\left(1 + x\right)\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({B}^{2}, \frac{1}{3} \cdot x - \frac{1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}}{B} \]
      4. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      6. sub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\frac{1}{3} \cdot x + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{x \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      8. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, x \cdot \frac{1}{3} + \color{blue}{\frac{-1}{6}}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      9. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right)}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      10. distribute-neg-inN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right), \color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}\right)}{B} \]
      11. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right), \color{blue}{-1} + \left(\mathsf{neg}\left(x\right)\right)\right)}{B} \]
      12. unsub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right), \color{blue}{-1 - x}\right)}{B} \]
      13. lower--.f6451.5

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), \color{blue}{-1 - x}\right)}{B} \]
    8. Applied rewrites51.5%

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

    if -1.92e6 < F < 1.61999999999999993e165

    1. Initial program 93.5%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6462.1

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites62.1%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\mathsf{fma}\left(F, F, 2\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      2. lift-fma.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\color{blue}{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      4. lift-sqrt.f64N/A

        \[\leadsto \frac{F \cdot \color{blue}{\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      5. lift-neg.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      6. lift-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      7. lift-/.f6462.1

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

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

      \[\leadsto \frac{\frac{F}{\color{blue}{\sqrt{2 + {F}^{2}}}} - x}{B} \]
    9. Step-by-step derivation
      1. lower-sqrt.f64N/A

        \[\leadsto \frac{\frac{F}{\color{blue}{\sqrt{2 + {F}^{2}}}} - x}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{F}{\sqrt{\color{blue}{{F}^{2} + 2}}} - x}{B} \]
      3. unpow2N/A

        \[\leadsto \frac{\frac{F}{\sqrt{\color{blue}{F \cdot F} + 2}} - x}{B} \]
      4. lower-fma.f6462.1

        \[\leadsto \frac{\frac{F}{\sqrt{\color{blue}{\mathsf{fma}\left(F, F, 2\right)}}} - x}{B} \]
    10. Applied rewrites62.1%

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

    if 1.61999999999999993e165 < F

    1. Initial program 33.2%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6423.7

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites23.7%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

Alternative 17: 50.4% accurate, 6.8× speedup?

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

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

\mathbf{elif}\;F \leq 3.9 \cdot 10^{-16}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, 2\right)}} - x}{B}\\

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


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

    1. Initial program 56.9%

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6499.7

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

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

      \[\leadsto \color{blue}{\frac{{B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) - \left(1 + x\right)}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{{B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) - \left(1 + x\right)}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{{B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) + \left(\mathsf{neg}\left(\left(1 + x\right)\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({B}^{2}, \frac{1}{3} \cdot x - \frac{1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}}{B} \]
      4. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      6. sub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\frac{1}{3} \cdot x + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{x \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      8. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, x \cdot \frac{1}{3} + \color{blue}{\frac{-1}{6}}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      9. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right)}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      10. distribute-neg-inN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right), \color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}\right)}{B} \]
      11. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right), \color{blue}{-1} + \left(\mathsf{neg}\left(x\right)\right)\right)}{B} \]
      12. unsub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right), \color{blue}{-1 - x}\right)}{B} \]
      13. lower--.f6451.5

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), \color{blue}{-1 - x}\right)}{B} \]
    8. Applied rewrites51.5%

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

    if -750 < F < 3.89999999999999977e-16

    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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6462.7

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites62.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\mathsf{fma}\left(F, F, 2\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      2. lift-fma.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\color{blue}{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      4. lift-sqrt.f64N/A

        \[\leadsto \frac{F \cdot \color{blue}{\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      5. lift-neg.f64N/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      6. lift-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      7. lift-/.f6462.7

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

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

      \[\leadsto \frac{\frac{F}{\color{blue}{\sqrt{2 + 2 \cdot x}}} - x}{B} \]
    9. Step-by-step derivation
      1. lower-sqrt.f64N/A

        \[\leadsto \frac{\frac{F}{\color{blue}{\sqrt{2 + 2 \cdot x}}} - x}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{F}{\sqrt{\color{blue}{2 \cdot x + 2}}} - x}{B} \]
      3. lower-fma.f6462.0

        \[\leadsto \frac{\frac{F}{\sqrt{\color{blue}{\mathsf{fma}\left(2, x, 2\right)}}} - x}{B} \]
    10. Applied rewrites62.0%

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

    if 3.89999999999999977e-16 < F

    1. Initial program 56.7%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6443.3

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites43.3%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6457.9

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

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

Alternative 18: 43.6% accurate, 9.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -6 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), -1 - x\right)}{B}\\ \mathbf{elif}\;F \leq 4 \cdot 10^{-83}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -6e-62)
   (/
    (fma (* B B) (fma x 0.3333333333333333 -0.16666666666666666) (- -1.0 x))
    B)
   (if (<= F 4e-83) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -6e-62) {
		tmp = fma((B * B), fma(x, 0.3333333333333333, -0.16666666666666666), (-1.0 - x)) / B;
	} else if (F <= 4e-83) {
		tmp = -x / B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -6e-62)
		tmp = Float64(fma(Float64(B * B), fma(x, 0.3333333333333333, -0.16666666666666666), Float64(-1.0 - x)) / B);
	elseif (F <= 4e-83)
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -6e-62], N[(N[(N[(B * B), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.16666666666666666), $MachinePrecision] + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4e-83], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6488.5

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

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

      \[\leadsto \color{blue}{\frac{{B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) - \left(1 + x\right)}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{{B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) - \left(1 + x\right)}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{{B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) + \left(\mathsf{neg}\left(\left(1 + x\right)\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({B}^{2}, \frac{1}{3} \cdot x - \frac{1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}}{B} \]
      4. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      6. sub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\frac{1}{3} \cdot x + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{x \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      8. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, x \cdot \frac{1}{3} + \color{blue}{\frac{-1}{6}}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      9. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right)}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      10. distribute-neg-inN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right), \color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}\right)}{B} \]
      11. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right), \color{blue}{-1} + \left(\mathsf{neg}\left(x\right)\right)\right)}{B} \]
      12. unsub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, \frac{1}{3}, \frac{-1}{6}\right), \color{blue}{-1 - x}\right)}{B} \]
      13. lower--.f6447.6

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), \color{blue}{-1 - x}\right)}{B} \]
    8. Applied rewrites47.6%

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

    if -6.0000000000000002e-62 < F < 4.0000000000000001e-83

    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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6459.7

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites59.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} \]
      4. lower-neg.f6446.1

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

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

    if 4.0000000000000001e-83 < F

    1. Initial program 61.5%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6446.4

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites46.4%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6454.1

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

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

Alternative 19: 43.5% accurate, 11.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -6 \cdot 10^{-62}:\\ \;\;\;\;\frac{\mathsf{fma}\left(B, B \cdot -0.16666666666666666, -1 - x\right)}{B}\\ \mathbf{elif}\;F \leq 4 \cdot 10^{-83}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -6e-62)
   (/ (fma B (* B -0.16666666666666666) (- -1.0 x)) B)
   (if (<= F 4e-83) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -6e-62) {
		tmp = fma(B, (B * -0.16666666666666666), (-1.0 - x)) / B;
	} else if (F <= 4e-83) {
		tmp = -x / B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -6e-62)
		tmp = Float64(fma(B, Float64(B * -0.16666666666666666), Float64(-1.0 - x)) / B);
	elseif (F <= 4e-83)
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -6e-62], N[(N[(B * N[(B * -0.16666666666666666), $MachinePrecision] + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4e-83], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -6 \cdot 10^{-62}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B, B \cdot -0.16666666666666666, -1 - x\right)}{B}\\

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

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


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

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \frac{1}{\tan B}\right)\right) + \color{blue}{\frac{-1}{\sin B}} \]
      2. lower-sin.f6488.5

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

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} + \frac{-1}{\sin B} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} + \frac{-1}{\sin B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} + \frac{-1}{\sin B} \]
      4. lower-neg.f6470.2

        \[\leadsto \frac{\color{blue}{-x}}{B} + \frac{-1}{\sin B} \]
    8. Applied rewrites70.2%

      \[\leadsto \color{blue}{\frac{-x}{B}} + \frac{-1}{\sin B} \]
    9. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{\left(-1 \cdot x + \frac{-1}{6} \cdot {B}^{2}\right) - 1}{B}} \]
    10. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-1 \cdot x + \frac{-1}{6} \cdot {B}^{2}\right) - 1}{B}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(\frac{-1}{6} \cdot {B}^{2} + -1 \cdot x\right)} - 1}{B} \]
      3. associate--l+N/A

        \[\leadsto \frac{\color{blue}{\frac{-1}{6} \cdot {B}^{2} + \left(-1 \cdot x - 1\right)}}{B} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{{B}^{2} \cdot \frac{-1}{6}} + \left(-1 \cdot x - 1\right)}{B} \]
      5. sub-negN/A

        \[\leadsto \frac{{B}^{2} \cdot \frac{-1}{6} + \color{blue}{\left(-1 \cdot x + \left(\mathsf{neg}\left(1\right)\right)\right)}}{B} \]
      6. mul-1-negN/A

        \[\leadsto \frac{{B}^{2} \cdot \frac{-1}{6} + \left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right)}{B} \]
      7. distribute-neg-inN/A

        \[\leadsto \frac{{B}^{2} \cdot \frac{-1}{6} + \color{blue}{\left(\mathsf{neg}\left(\left(x + 1\right)\right)\right)}}{B} \]
      8. +-commutativeN/A

        \[\leadsto \frac{{B}^{2} \cdot \frac{-1}{6} + \left(\mathsf{neg}\left(\color{blue}{\left(1 + x\right)}\right)\right)}{B} \]
      9. unpow2N/A

        \[\leadsto \frac{\color{blue}{\left(B \cdot B\right)} \cdot \frac{-1}{6} + \left(\mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      10. associate-*l*N/A

        \[\leadsto \frac{\color{blue}{B \cdot \left(B \cdot \frac{-1}{6}\right)} + \left(\mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      11. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(B, B \cdot \frac{-1}{6}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}}{B} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(B, \color{blue}{B \cdot \frac{-1}{6}}, \mathsf{neg}\left(\left(1 + x\right)\right)\right)}{B} \]
      13. distribute-neg-inN/A

        \[\leadsto \frac{\mathsf{fma}\left(B, B \cdot \frac{-1}{6}, \color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}\right)}{B} \]
      14. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B, B \cdot \frac{-1}{6}, \color{blue}{-1} + \left(\mathsf{neg}\left(x\right)\right)\right)}{B} \]
      15. unsub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B, B \cdot \frac{-1}{6}, \color{blue}{-1 - x}\right)}{B} \]
      16. lower--.f6447.5

        \[\leadsto \frac{\mathsf{fma}\left(B, B \cdot -0.16666666666666666, \color{blue}{-1 - x}\right)}{B} \]
    11. Applied rewrites47.5%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B, B \cdot -0.16666666666666666, -1 - x\right)}{B}} \]

    if -6.0000000000000002e-62 < F < 4.0000000000000001e-83

    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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6459.7

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites59.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} \]
      4. lower-neg.f6446.1

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

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

    if 4.0000000000000001e-83 < F

    1. Initial program 61.5%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6446.4

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites46.4%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6454.1

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

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

Alternative 20: 43.5% accurate, 13.6× speedup?

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

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

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

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


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

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6443.8

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites43.8%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(1 + x\right)\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(1 + x\right)\right)}{B}} \]
      4. distribute-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{-1} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      6. unsub-negN/A

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
      7. lower--.f6447.4

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

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

    if -6.0000000000000002e-62 < F < 4.0000000000000001e-83

    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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6459.7

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites59.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} \]
      4. lower-neg.f6446.1

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

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

    if 4.0000000000000001e-83 < F

    1. Initial program 61.5%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6446.4

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites46.4%

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

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6454.1

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

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

Alternative 21: 36.5% accurate, 17.5× speedup?

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

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

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


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

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6443.8

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites43.8%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(1 + x\right)\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(1 + x\right)\right)}{B}} \]
      4. distribute-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{-1} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      6. unsub-negN/A

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
      7. lower--.f6447.4

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

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

    if -6.0000000000000002e-62 < F

    1. Initial program 80.6%

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

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6453.1

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Applied rewrites53.1%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} \]
      4. lower-neg.f6435.8

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

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

Alternative 22: 29.0% accurate, 26.3× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
  4. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    2. sub-negN/A

      \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
    3. lower-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
    4. lower-sqrt.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    5. lower-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    6. +-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    7. associate-+l+N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    8. *-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    9. +-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    10. lower-fma.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    11. +-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    12. unpow2N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    13. lower-fma.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    14. lower-neg.f6450.3

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
  5. Applied rewrites50.3%

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
    2. mul-1-negN/A

      \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} \]
    3. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} \]
    4. lower-neg.f6433.0

      \[\leadsto \frac{\color{blue}{-x}}{B} \]
  8. Applied rewrites33.0%

    \[\leadsto \color{blue}{\frac{-x}{B}} \]
  9. Add Preprocessing

Alternative 23: 10.7% accurate, 30.7× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
  4. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    2. sub-negN/A

      \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
    3. lower-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
    4. lower-sqrt.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    5. lower-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    6. +-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    7. associate-+l+N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    8. *-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    9. +-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    10. lower-fma.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    11. +-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    12. unpow2N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    13. lower-fma.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    14. lower-neg.f6450.3

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
  5. Applied rewrites50.3%

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
    2. mul-1-negN/A

      \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(1 + x\right)\right)}}{B} \]
    3. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(1 + x\right)\right)}{B}} \]
    4. distribute-neg-inN/A

      \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
    5. metadata-evalN/A

      \[\leadsto \frac{\color{blue}{-1} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
    6. unsub-negN/A

      \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    7. lower--.f6430.6

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

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

    \[\leadsto \color{blue}{\frac{-1}{B}} \]
  10. Step-by-step derivation
    1. lower-/.f649.5

      \[\leadsto \color{blue}{\frac{-1}{B}} \]
  11. Applied rewrites9.5%

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

Reproduce

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