VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.0% → 99.7%
Time: 15.8s
Alternatives: 19
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 19 alternatives:

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

Initial Program: 77.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, t\_0, -t\_1\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000004e154 < F < 1e8

    1. Initial program 97.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{{\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. Applied rewrites99.7%

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

    if 1e8 < F

    1. Initial program 61.9%

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

      \[\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. Applied rewrites77.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \frac{1}{\sin B}, -\frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
    8. 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} \]
    9. Applied rewrites99.9%

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

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

Alternative 2: 99.7% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, t\_0, -t\_1\right)\\

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


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

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

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

      \[\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. clear-numN/A

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

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\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. lift-*.f64N/A

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

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

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

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

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

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

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

    if -1.00000000000000004e154 < F < 1e8

    1. Initial program 97.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{{\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. Applied rewrites99.7%

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

    if 1e8 < F

    1. Initial program 61.9%

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

      \[\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. Applied rewrites77.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \frac{1}{\sin B}, -\frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
    8. 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} \]
    9. 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 3: 99.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -8 \cdot 10^{+153}:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 200000000:\\ \;\;\;\;\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 -8e+153)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 200000000.0)
       (- (/ 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 <= -8e+153) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 200000000.0) {
		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 <= -8e+153)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 200000000.0)
		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, -8e+153], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 200000000.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] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;F \leq 200000000:\\
\;\;\;\;\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 < -8e153

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

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

      \[\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. clear-numN/A

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

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\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. lift-*.f64N/A

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

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

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

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

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

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

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

    if -8e153 < F < 2e8

    1. Initial program 97.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{{\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. Applied rewrites99.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}} \]

    if 2e8 < F

    1. Initial program 61.9%

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

      \[\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. Applied rewrites77.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \frac{1}{\sin B}, -\frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x}{\tan B} \]
    8. 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} \]
    9. 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 4: 99.0% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\tan B}\\ \mathbf{if}\;F \leq -1.42:\\ \;\;\;\;\frac{-1}{\sin B} - t\_0\\ \mathbf{elif}\;F \leq 1.6:\\ \;\;\;\;\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.42)
     (- (/ -1.0 (sin B)) t_0)
     (if (<= F 1.6)
       (- (/ 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.42) {
		tmp = (-1.0 / sin(B)) - t_0;
	} else if (F <= 1.6) {
		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.42)
		tmp = Float64(Float64(-1.0 / sin(B)) - t_0);
	elseif (F <= 1.6)
		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.42], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 1.6], 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.42:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\

\mathbf{elif}\;F \leq 1.6:\\
\;\;\;\;\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.4199999999999999

    1. Initial program 53.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.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. clear-numN/A

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

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\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. lift-*.f64N/A

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

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

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

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

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

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

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

    if -1.4199999999999999 < F < 1.6000000000000001

    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{{\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. Applied rewrites99.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \frac{1}{\sin B}, -\frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.6000000000000001 < F

    1. Initial program 62.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 rewrites77.1%

      \[\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. Applied rewrites77.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \frac{1}{\sin B}, -\frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 89.7% accurate, 1.5× speedup?

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

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

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

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

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


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

    1. Initial program 58.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.f6497.8

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{\color{blue}{\sin B}} \]
    5. Applied rewrites97.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. clear-numN/A

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

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\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. lift-*.f64N/A

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

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

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

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

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

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

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

    if -2.9000000000000002e-34 < F < -3.39999999999999976e-79

    1. Initial program 99.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{F}{\color{blue}{\sqrt{2 + {F}^{2}}}}, \frac{1}{\sin B}, \mathsf{neg}\left(\frac{x}{B}\right)\right) \]
    9. Step-by-step derivation
      1. lower-sqrt.f64N/A

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

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

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

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

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

    if -3.39999999999999976e-79 < F < 1.81999999999999994e-63

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.81999999999999994e-63 < F

    1. Initial program 65.0%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \frac{1}{\sin B}, -\frac{x}{\tan B}\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 84.9% accurate, 1.6× speedup?

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

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

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

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

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


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

    1. Initial program 58.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.f6497.8

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{\color{blue}{\sin B}} \]
    5. Applied rewrites97.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. clear-numN/A

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

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\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. lift-*.f64N/A

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

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

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

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

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

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

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

    if -2.9000000000000002e-34 < F < -3.39999999999999976e-79

    1. Initial program 99.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{F}{\color{blue}{\sqrt{2 + {F}^{2}}}}, \frac{1}{\sin B}, \mathsf{neg}\left(\frac{x}{B}\right)\right) \]
    9. Step-by-step derivation
      1. lower-sqrt.f64N/A

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

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

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

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

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

    if -3.39999999999999976e-79 < F < 1.02e11

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.02e11 < F

    1. Initial program 60.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 rewrites76.2%

      \[\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. Applied rewrites76.4%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\sin B}} - \frac{x}{B} \]
      4. lower-/.f6478.5

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{x}{B}} \]
    10. Applied rewrites78.5%

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

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

Alternative 7: 76.1% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
t_0 := -\frac{x}{\tan B}\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{-85}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.8000000000000004e-85 or 1.8e-77 < x

    1. Initial program 81.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \cos B}{\color{blue}{\mathsf{neg}\left(\sin B\right)}} \]
      7. lower-sin.f6488.3

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

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

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

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

        \[\leadsto \frac{x \cdot \cos B}{\color{blue}{\mathsf{neg}\left(\sin B\right)}} \]
      4. associate-/l*N/A

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

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

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right) \cdot \frac{\cos B}{\mathsf{neg}\left(\sin B\right)} \]
      7. clear-numN/A

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\tan B}\right)} \]
      14. div-invN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\mathsf{neg}\left(\tan B\right)}} \]
      15. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{\tan B}} \]
      16. lift-/.f6488.4

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    7. Applied rewrites88.4%

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

    if -5.8000000000000004e-85 < x < 1.8e-77

    1. Initial program 69.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 rewrites71.7%

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{F}{\color{blue}{\sqrt{2 + {F}^{2}}}}, \frac{1}{\sin B}, \mathsf{neg}\left(\frac{x}{B}\right)\right) \]
    9. Step-by-step derivation
      1. lower-sqrt.f64N/A

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

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

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

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

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

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

Alternative 8: 76.1% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
t_0 := -\frac{x}{\tan B}\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{-85}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -5.8000000000000004e-85 or 1.8e-77 < x

    1. Initial program 81.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \cos B}{\color{blue}{\mathsf{neg}\left(\sin B\right)}} \]
      7. lower-sin.f6488.3

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

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

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

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

        \[\leadsto \frac{x \cdot \cos B}{\color{blue}{\mathsf{neg}\left(\sin B\right)}} \]
      4. associate-/l*N/A

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

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

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right) \cdot \frac{\cos B}{\mathsf{neg}\left(\sin B\right)} \]
      7. clear-numN/A

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\tan B}\right)} \]
      14. div-invN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\mathsf{neg}\left(\tan B\right)}} \]
      15. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{\tan B}} \]
      16. lift-/.f6488.4

        \[\leadsto \color{blue}{\frac{-x}{\tan B}} \]
    7. Applied rewrites88.4%

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

    if -5.8000000000000004e-85 < x < 1.8e-77

    1. Initial program 69.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 rewrites71.7%

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, \frac{1}{\sin B}, -\color{blue}{\frac{x}{B}}\right) \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)} \cdot \sin B} - \frac{x}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.7%

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

Alternative 9: 70.5% accurate, 2.4× speedup?

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

\\
\begin{array}{l}
t_0 := -\frac{x}{\tan B}\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{-86}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq 1.5 \cdot 10^{-97}:\\
\;\;\;\;\frac{-1}{\sin B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.6999999999999998e-86 or 1.50000000000000012e-97 < x

    1. Initial program 79.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 x around inf

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \cos B}{\color{blue}{\mathsf{neg}\left(\sin B\right)}} \]
      7. lower-sin.f6484.8

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

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

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

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

        \[\leadsto \frac{x \cdot \cos B}{\color{blue}{\mathsf{neg}\left(\sin B\right)}} \]
      4. associate-/l*N/A

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

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

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right) \cdot \frac{\cos B}{\mathsf{neg}\left(\sin B\right)} \]
      7. clear-numN/A

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\tan B}\right)} \]
      14. div-invN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\mathsf{neg}\left(\tan B\right)}} \]
      15. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{\tan B}} \]
      16. lift-/.f6484.9

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

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

    if -3.6999999999999998e-86 < x < 7.60000000000000006e-134

    1. Initial program 75.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 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.f6462.0

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

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

    if 7.60000000000000006e-134 < x < 1.50000000000000012e-97

    1. Initial program 34.8%

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

      \[\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.f6467.2

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

      \[\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.f6467.2

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

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

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

Alternative 10: 56.4% accurate, 3.1× speedup?

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

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

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


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

    1. Initial program 73.3%

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

      \[\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.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 rewrites53.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. 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-/.f6453.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}} \]
    7. Applied rewrites53.1%

      \[\leadsto \color{blue}{\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}} \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

        \[\leadsto \frac{\frac{F}{\color{blue}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}} - x}{B} \]
      4. clear-numN/A

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

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

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

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

    if 1.29999999999999991e-12 < B

    1. Initial program 83.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 x around inf

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \cos B}{\color{blue}{\mathsf{neg}\left(\sin B\right)}} \]
      7. lower-sin.f6457.0

        \[\leadsto \frac{x \cdot \cos B}{-\color{blue}{\sin B}} \]
    5. Applied rewrites57.0%

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

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

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

        \[\leadsto \frac{x \cdot \cos B}{\color{blue}{\mathsf{neg}\left(\sin B\right)}} \]
      4. associate-/l*N/A

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

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

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right) \cdot \frac{\cos B}{\mathsf{neg}\left(\sin B\right)} \]
      7. clear-numN/A

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\color{blue}{\tan B}\right)} \]
      14. div-invN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)}{\mathsf{neg}\left(\tan B\right)}} \]
      15. frac-2negN/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{\tan B}} \]
      16. lift-/.f6457.2

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

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

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

Alternative 11: 50.4% accurate, 3.1× speedup?

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

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

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

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


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

    1. Initial program 31.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 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.f6458.2

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

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

    if -1.45e181 < F < 1.09999999999999998e-13

    1. Initial program 94.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.f6446.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 rewrites46.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-/.f6446.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 rewrites46.8%

      \[\leadsto \color{blue}{\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}} \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

        \[\leadsto \frac{\frac{F}{\color{blue}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}} - x}{B} \]
      4. clear-numN/A

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

        \[\leadsto \frac{\color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}{F}}} - x}{B} \]
      6. lower-/.f6446.8

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

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

    if 1.09999999999999998e-13 < F

    1. Initial program 63.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.f6438.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 rewrites38.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 \frac{\color{blue}{\left(1 + \frac{-1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}}\right) - x}}{B} \]
    7. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{2}, \frac{\mathsf{fma}\left(2, x, 2\right)}{\color{blue}{F \cdot F}}, 1 - x\right)}{B} \]
      11. lower--.f6452.0

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

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

Alternative 12: 51.1% accurate, 5.2× speedup?

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

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

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

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


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

    1. Initial program 42.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.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. associate--r+N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, -1\right) - x}{B} \]
      9. 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)}, -1\right) - x}{B} \]
      10. *-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), -1\right) - x}{B} \]
      11. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, x \cdot \frac{1}{3} + \color{blue}{\frac{-1}{6}}, -1\right) - x}{B} \]
      12. lower-fma.f6445.4

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

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

    if -3.30000000000000011e101 < F < 1.09999999999999998e-13

    1. Initial program 98.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. 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. 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-/.f6446.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}} \]
    7. Applied rewrites46.6%

      \[\leadsto \color{blue}{\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}} \]
    8. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

        \[\leadsto \frac{\frac{F}{\color{blue}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}} - x}{B} \]
      4. clear-numN/A

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

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

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

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

    if 1.09999999999999998e-13 < F

    1. Initial program 63.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.f6438.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 rewrites38.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 \frac{\color{blue}{\left(1 + \frac{-1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}}\right) - x}}{B} \]
    7. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{2}, \frac{\mathsf{fma}\left(2, x, 2\right)}{\color{blue}{F \cdot F}}, 1 - x\right)}{B} \]
      11. lower--.f6452.0

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

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

Alternative 13: 51.1% accurate, 6.7× speedup?

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

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

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

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


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

    1. Initial program 42.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.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. associate--r+N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, -1\right) - x}{B} \]
      9. 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)}, -1\right) - x}{B} \]
      10. *-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), -1\right) - x}{B} \]
      11. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, x \cdot \frac{1}{3} + \color{blue}{\frac{-1}{6}}, -1\right) - x}{B} \]
      12. lower-fma.f6445.4

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

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

    if -3.30000000000000011e101 < F < 1.09999999999999998e-13

    1. Initial program 98.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. 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. 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-/.f6446.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}} \]
    7. Applied rewrites46.6%

      \[\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.f6446.6

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

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

    if 1.09999999999999998e-13 < F

    1. Initial program 63.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.f6438.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 rewrites38.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 \frac{\color{blue}{\left(1 + \frac{-1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}}\right) - x}}{B} \]
    7. Step-by-step derivation
      1. sub-negN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{2}, \frac{\mathsf{fma}\left(2, x, 2\right)}{\color{blue}{F \cdot F}}, 1 - x\right)}{B} \]
      11. lower--.f6452.0

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

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

Alternative 14: 51.6% accurate, 6.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -3.3 \cdot 10^{+101}:\\ \;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), -1\right) - x}{B}\\ \mathbf{elif}\;F \leq 400000:\\ \;\;\;\;\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 -3.3e+101)
   (/
    (- (fma (* B B) (fma x 0.3333333333333333 -0.16666666666666666) -1.0) x)
    B)
   (if (<= F 400000.0)
     (/ (- (/ 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 <= -3.3e+101) {
		tmp = (fma((B * B), fma(x, 0.3333333333333333, -0.16666666666666666), -1.0) - x) / B;
	} else if (F <= 400000.0) {
		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 <= -3.3e+101)
		tmp = Float64(Float64(fma(Float64(B * B), fma(x, 0.3333333333333333, -0.16666666666666666), -1.0) - x) / B);
	elseif (F <= 400000.0)
		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, -3.3e+101], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.16666666666666666), $MachinePrecision] + -1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 400000.0], 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 -3.3 \cdot 10^{+101}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), -1\right) - x}{B}\\

\mathbf{elif}\;F \leq 400000:\\
\;\;\;\;\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 < -3.30000000000000011e101

    1. Initial program 42.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.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. associate--r+N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, -1\right) - x}{B} \]
      9. 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)}, -1\right) - x}{B} \]
      10. *-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), -1\right) - x}{B} \]
      11. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, x \cdot \frac{1}{3} + \color{blue}{\frac{-1}{6}}, -1\right) - x}{B} \]
      12. lower-fma.f6445.4

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

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

    if -3.30000000000000011e101 < F < 4e5

    1. Initial program 98.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. 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.f6445.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 rewrites45.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. 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-/.f6445.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}} \]
    7. Applied rewrites46.0%

      \[\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.f6446.0

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

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

    if 4e5 < F

    1. Initial program 61.9%

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

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

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

Alternative 15: 44.3% accurate, 9.7× speedup?

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

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

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

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


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

    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.f6497.8

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

      \[\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. associate--r+N/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, -1\right) - x}{B} \]
      9. 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)}, -1\right) - x}{B} \]
      10. *-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), -1\right) - x}{B} \]
      11. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, x \cdot \frac{1}{3} + \color{blue}{\frac{-1}{6}}, -1\right) - x}{B} \]
      12. lower-fma.f6444.6

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right)}, -1\right) - x}{B} \]
    8. Applied rewrites44.6%

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

    if -1.94999999999999999e-22 < F < 1.64999999999999997e-63

    1. Initial program 99.5%

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

      \[\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.f6448.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 rewrites48.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.f6430.5

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

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

    if 1.64999999999999997e-63 < F

    1. Initial program 65.0%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in 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.f6437.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 rewrites37.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--.f6450.0

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

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

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

Alternative 16: 43.0% accurate, 13.6× speedup?

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

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

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

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


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

    1. Initial program 69.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.f6431.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 rewrites31.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--.f6436.0

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

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

    if -1.25e-175 < F < 1.64999999999999997e-63

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. 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.f6455.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 rewrites55.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 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.f6437.0

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    8. Applied rewrites37.0%

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

    if 1.64999999999999997e-63 < F

    1. Initial program 65.0%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in 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.f6437.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 rewrites37.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--.f6450.0

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

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

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

Alternative 17: 31.8% accurate, 14.1× speedup?

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

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

\mathbf{elif}\;x \leq 1.3 \cdot 10^{-204}:\\
\;\;\;\;\frac{-1}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.9999999999999991e-97 or 1.29999999999999991e-204 < x

    1. Initial program 77.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.f6440.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 rewrites40.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 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.f6437.1

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

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

    if -9.9999999999999991e-97 < x < 1.29999999999999991e-204

    1. Initial program 73.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.f6438.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 rewrites38.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 -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--.f6418.1

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

      \[\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-/.f6418.1

        \[\leadsto \color{blue}{\frac{-1}{B}} \]
    11. Applied rewrites18.1%

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

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

Alternative 18: 35.9% accurate, 17.5× speedup?

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

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

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


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

    1. Initial program 69.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.f6431.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 rewrites31.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--.f6436.0

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

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

    if -1.25e-175 < F

    1. Initial program 80.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.f6445.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 rewrites45.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 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.f6430.2

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    8. Applied rewrites30.2%

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

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

Alternative 19: 10.8% 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 76.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.f6439.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 rewrites39.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}{-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--.f6427.3

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

    \[\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-/.f6410.1

      \[\leadsto \color{blue}{\frac{-1}{B}} \]
  11. Applied rewrites10.1%

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

Reproduce

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