VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.7% → 99.7%
Time: 18.4s
Alternatives: 32
Speedup: 2.2×

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 32 alternatives:

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

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

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

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

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


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

    1. Initial program 59.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 egg-rr76.5%

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

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

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

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

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

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

    if -7.4999999999999999e50 < F < 5.49999999999999966e27

    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 egg-rr99.6%

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

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

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

    if 5.49999999999999966e27 < F

    1. Initial program 52.1%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.7% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 59.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 egg-rr76.5%

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

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

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

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

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

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

    if -2.8999999999999998e51 < F < 9.99999999999999958e27

    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 egg-rr99.6%

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

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

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

    if 9.99999999999999958e27 < F

    1. Initial program 52.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 59.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 egg-rr76.5%

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

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

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

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

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

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

    if -2e52 < F < 2e8

    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 egg-rr99.6%

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

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

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

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

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

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

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

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

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

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

    if 2e8 < F

    1. Initial program 53.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 \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.6% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 57.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 egg-rr73.6%

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

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

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

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

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

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

    if -2.70000000000000022e96 < F < 1.1e8

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}}{\color{blue}{\sin B}} - \frac{x}{\tan B} \]
      4. associate-/l/N/A

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

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

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

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

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

    if 1.1e8 < F

    1. Initial program 53.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 \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.2% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;F \leq 1.26 \cdot 10^{-6}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{\sin B} - t\_0\\

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


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

    1. Initial program 64.2%

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

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

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

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

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

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

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

    if -2e21 < F < 1.26000000000000001e-6

    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 egg-rr99.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{F \cdot \color{blue}{\sqrt{\frac{1}{2}}}}{\sin B} - \frac{x}{\tan B} \]
      4. lower-sin.f6499.1

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

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

    if 1.26000000000000001e-6 < F

    1. Initial program 55.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 \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    6. Applied egg-rr99.3%

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

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

Alternative 6: 80.6% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -9.5 \cdot 10^{+136}:\\
\;\;\;\;\frac{\left(-x\right) \cdot \cos B}{\sin B}\\

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

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

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


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

    1. Initial program 52.2%

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

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

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

    if -9.49999999999999907e136 < F < -3.6e21

    1. Initial program 86.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 egg-rr99.5%

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

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

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

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

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

    if -3.6e21 < F < 1.5499999999999999e-17

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{F}{B} \cdot \sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}} - \frac{x}{\tan B} \]
      7. lower-fma.f6482.9

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

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

    if 1.5499999999999999e-17 < F

    1. Initial program 56.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 F around inf

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{x \cdot \color{blue}{\cos B}}{\sin B} \]
      7. lower-sin.f6498.0

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

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

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

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

Alternative 7: 91.1% accurate, 1.6× speedup?

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

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

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

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


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

    1. Initial program 64.2%

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

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

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

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

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

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

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

    if -2e21 < F < 1.5499999999999999e-17

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{F}{B} \cdot \sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}} - \frac{x}{\tan B} \]
      7. lower-fma.f6482.9

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

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

    if 1.5499999999999999e-17 < F

    1. Initial program 56.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 F around inf

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{x \cdot \color{blue}{\cos B}}{\sin B} \]
      7. lower-sin.f6498.0

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

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

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

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

Alternative 8: 73.7% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -9.5 \cdot 10^{+136}:\\
\;\;\;\;\frac{\left(-x\right) \cdot \cos B}{\sin B}\\

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

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

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


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

    1. Initial program 52.2%

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

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

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

    if -9.49999999999999907e136 < F < -2.3e21

    1. Initial program 86.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 egg-rr99.5%

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

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

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

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

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

    if -2.3e21 < F < 1.5499999999999999e-17

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{F}{B} \cdot \sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}} - \frac{x}{\tan B} \]
      7. lower-fma.f6482.9

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

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

    if 1.5499999999999999e-17 < F

    1. Initial program 56.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 F around inf

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{x \cdot \color{blue}{\cos B}}{\sin B} \]
      7. lower-sin.f6498.0

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

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

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

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

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

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

Alternative 9: 73.6% accurate, 1.6× speedup?

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

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

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

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

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


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

    1. Initial program 52.2%

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{\frac{\left(F \cdot \sqrt{\frac{1}{2}}\right) \cdot \sqrt{\frac{1}{{x}^{3}}}}{\sin B}} - \frac{\cos B}{\sin B}\right) \]
      5. lower-*.f64N/A

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

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

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

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

        \[\leadsto x \cdot \left(\frac{\left(F \cdot \sqrt{\frac{1}{2}}\right) \cdot \sqrt{\color{blue}{\frac{1}{{x}^{3}}}}}{\sin B} - \frac{\cos B}{\sin B}\right) \]
      10. cube-multN/A

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

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

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

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

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

        \[\leadsto x \cdot \left(\frac{\left(F \cdot \sqrt{\frac{1}{2}}\right) \cdot \sqrt{\frac{1}{x \cdot \left(x \cdot x\right)}}}{\sin B} - \frac{\color{blue}{\cos B}}{\sin B}\right) \]
      16. lower-sin.f6444.9

        \[\leadsto x \cdot \left(\frac{\left(F \cdot \sqrt{0.5}\right) \cdot \sqrt{\frac{1}{x \cdot \left(x \cdot x\right)}}}{\sin B} - \frac{\cos B}{\color{blue}{\sin B}}\right) \]
    5. Simplified44.9%

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

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

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

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

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

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

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

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

    if -2.7000000000000002e136 < F < -2.3e21

    1. Initial program 86.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 egg-rr99.5%

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

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

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

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

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

    if -2.3e21 < F < 1.5499999999999999e-17

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{F}{B} \cdot \sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}} - \frac{x}{\tan B} \]
      7. lower-fma.f6482.9

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

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

    if 1.5499999999999999e-17 < F

    1. Initial program 56.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 F around inf

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{x \cdot \color{blue}{\cos B}}{\sin B} \]
      7. lower-sin.f6498.0

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

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

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

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

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

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

Alternative 10: 73.6% accurate, 2.1× speedup?

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

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

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

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

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


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

    1. Initial program 52.2%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{x \cdot \color{blue}{\cos B}}{\sin B} \]
      7. lower-sin.f6462.3

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      3. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{{x}^{1}} \cdot \cos B}{\sin B} \]
      4. remove-double-negN/A

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{{\color{blue}{\left(-1 \cdot \left(\mathsf{neg}\left(x\right)\right)\right)}}^{1} \cdot \cos B}{\sin B} \]
      7. unpow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{x \cdot x}}\right) \cdot \cos B}{\sin B} \]
      15. pow2N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{{x}^{2}}}\right) \cdot \cos B}{\sin B} \]
      16. sqrt-pow1N/A

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot {x}^{\color{blue}{1}}\right) \cdot \cos B}{\sin B} \]
      18. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \color{blue}{x}\right) \cdot \cos B}{\sin B} \]
      19. neg-mul-1N/A

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(\mathsf{neg}\left(x\right)\right) \cdot \cos B}{\color{blue}{\sin B}} \]
    7. Applied egg-rr62.4%

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

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

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

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

    if -9.49999999999999907e136 < F < -2e21

    1. Initial program 86.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 egg-rr99.5%

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

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

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

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

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

    if -2e21 < F < 1.5499999999999999e-17

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{F}{B} \cdot \sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}} - \frac{x}{\tan B} \]
      7. lower-fma.f6482.9

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

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

    if 1.5499999999999999e-17 < F

    1. Initial program 56.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 F around inf

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{x \cdot \color{blue}{\cos B}}{\sin B} \]
      7. lower-sin.f6498.0

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

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

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

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

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

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

Alternative 11: 73.5% accurate, 2.1× speedup?

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

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

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

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

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


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

    1. Initial program 52.2%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{x \cdot \color{blue}{\cos B}}{\sin B} \]
      7. lower-sin.f6462.3

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      3. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{{x}^{1}} \cdot \cos B}{\sin B} \]
      4. remove-double-negN/A

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{{\color{blue}{\left(-1 \cdot \left(\mathsf{neg}\left(x\right)\right)\right)}}^{1} \cdot \cos B}{\sin B} \]
      7. unpow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{x \cdot x}}\right) \cdot \cos B}{\sin B} \]
      15. pow2N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{{x}^{2}}}\right) \cdot \cos B}{\sin B} \]
      16. sqrt-pow1N/A

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot {x}^{\color{blue}{1}}\right) \cdot \cos B}{\sin B} \]
      18. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \color{blue}{x}\right) \cdot \cos B}{\sin B} \]
      19. neg-mul-1N/A

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(\mathsf{neg}\left(x\right)\right) \cdot \cos B}{\color{blue}{\sin B}} \]
    7. Applied egg-rr62.4%

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

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

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

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

    if -9.49999999999999907e136 < F < -8.5e21

    1. Initial program 86.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 egg-rr99.5%

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

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

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

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

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

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

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

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

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

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

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

    if -8.5e21 < F < 1.5499999999999999e-17

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{F}{B} \cdot \sqrt{\frac{1}{\color{blue}{F \cdot F} + 2}} - \frac{x}{\tan B} \]
      7. lower-fma.f6482.9

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

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

    if 1.5499999999999999e-17 < F

    1. Initial program 56.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 F around inf

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{x \cdot \color{blue}{\cos B}}{\sin B} \]
      7. lower-sin.f6498.0

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

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

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

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

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

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

Alternative 12: 77.2% accurate, 2.2× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -850 or 30 < x

    1. Initial program 83.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 \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    4. Step-by-step derivation
      1. lower--.f64N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      3. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{{x}^{1}} \cdot \cos B}{\sin B} \]
      4. remove-double-negN/A

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{{\color{blue}{\left(-1 \cdot \left(\mathsf{neg}\left(x\right)\right)\right)}}^{1} \cdot \cos B}{\sin B} \]
      7. unpow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{x \cdot x}}\right) \cdot \cos B}{\sin B} \]
      15. pow2N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{{x}^{2}}}\right) \cdot \cos B}{\sin B} \]
      16. sqrt-pow1N/A

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot {x}^{\color{blue}{1}}\right) \cdot \cos B}{\sin B} \]
      18. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \color{blue}{x}\right) \cdot \cos B}{\sin B} \]
      19. neg-mul-1N/A

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(\mathsf{neg}\left(x\right)\right) \cdot \cos B}{\color{blue}{\sin B}} \]
    7. Applied egg-rr99.6%

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

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

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

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

    if -850 < x < 30

    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. Applied egg-rr77.1%

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 56.0% accurate, 2.3× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\\
\mathbf{if}\;B \leq 80000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, t\_0, x \cdot 0.3333333333333333\right), F \cdot t\_0\right) - x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 8e7

    1. Initial program 73.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 egg-rr85.5%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

    if 8e7 < B

    1. Initial program 87.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 F around inf

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      3. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{{x}^{1}} \cdot \cos B}{\sin B} \]
      4. remove-double-negN/A

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{{\color{blue}{\left(-1 \cdot \left(\mathsf{neg}\left(x\right)\right)\right)}}^{1} \cdot \cos B}{\sin B} \]
      7. unpow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{x \cdot x}}\right) \cdot \cos B}{\sin B} \]
      15. pow2N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{{x}^{2}}}\right) \cdot \cos B}{\sin B} \]
      16. sqrt-pow1N/A

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot {x}^{\color{blue}{1}}\right) \cdot \cos B}{\sin B} \]
      18. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \color{blue}{x}\right) \cdot \cos B}{\sin B} \]
      19. neg-mul-1N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 56.0% accurate, 2.3× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\\
\mathbf{if}\;B \leq 80000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, t\_0, x \cdot 0.3333333333333333\right), F \cdot t\_0\right) - x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 8e7

    1. Initial program 73.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 egg-rr85.5%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

    if 8e7 < B

    1. Initial program 87.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 F around inf

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      3. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{{x}^{1}} \cdot \cos B}{\sin B} \]
      4. remove-double-negN/A

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{{\color{blue}{\left(-1 \cdot \left(\mathsf{neg}\left(x\right)\right)\right)}}^{1} \cdot \cos B}{\sin B} \]
      7. unpow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{x \cdot x}}\right) \cdot \cos B}{\sin B} \]
      15. pow2N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{{x}^{2}}}\right) \cdot \cos B}{\sin B} \]
      16. sqrt-pow1N/A

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot {x}^{\color{blue}{1}}\right) \cdot \cos B}{\sin B} \]
      18. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \color{blue}{x}\right) \cdot \cos B}{\sin B} \]
      19. neg-mul-1N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(B, \left(B \cdot B\right) \cdot \mathsf{fma}\left(B \cdot B, 0.008333333333333333, -0.16666666666666666\right), B\right)}} - \frac{x}{\tan B} \]
    11. Taylor expanded in B around inf

      \[\leadsto \frac{1}{\mathsf{fma}\left(B, \left(B \cdot B\right) \cdot \color{blue}{\left(\frac{1}{120} \cdot {B}^{2}\right)}, B\right)} - \frac{x}{\tan B} \]
    12. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \frac{1}{\mathsf{fma}\left(B, \left(B \cdot B\right) \cdot \left(\color{blue}{\left(B \cdot B\right)} \cdot 0.008333333333333333\right), B\right)} - \frac{x}{\tan B} \]
    13. Simplified57.5%

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

Alternative 15: 55.8% accurate, 2.5× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\\
\mathbf{if}\;B \leq 80000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, t\_0, x \cdot 0.3333333333333333\right), F \cdot t\_0\right) - x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 8e7

    1. Initial program 73.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 egg-rr85.5%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

    if 8e7 < B

    1. Initial program 87.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 F around inf

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      3. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{{x}^{1}} \cdot \cos B}{\sin B} \]
      4. remove-double-negN/A

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{{\color{blue}{\left(-1 \cdot \left(\mathsf{neg}\left(x\right)\right)\right)}}^{1} \cdot \cos B}{\sin B} \]
      7. unpow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{x \cdot x}}\right) \cdot \cos B}{\sin B} \]
      15. pow2N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{{x}^{2}}}\right) \cdot \cos B}{\sin B} \]
      16. sqrt-pow1N/A

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot {x}^{\color{blue}{1}}\right) \cdot \cos B}{\sin B} \]
      18. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \color{blue}{x}\right) \cdot \cos B}{\sin B} \]
      19. neg-mul-1N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 55.2% accurate, 2.8× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\\
\mathbf{if}\;B \leq 80000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, t\_0, x \cdot 0.3333333333333333\right), F \cdot t\_0\right) - x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 8e7

    1. Initial program 73.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 egg-rr85.5%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

    if 8e7 < B

    1. Initial program 87.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 F around inf

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B}} - \frac{x \cdot \cos B}{\sin B} \]
      3. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{{x}^{1}} \cdot \cos B}{\sin B} \]
      4. remove-double-negN/A

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{{\color{blue}{\left(-1 \cdot \left(\mathsf{neg}\left(x\right)\right)\right)}}^{1} \cdot \cos B}{\sin B} \]
      7. unpow-prod-downN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{x \cdot x}}\right) \cdot \cos B}{\sin B} \]
      15. pow2N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \sqrt{\color{blue}{{x}^{2}}}\right) \cdot \cos B}{\sin B} \]
      16. sqrt-pow1N/A

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

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot {x}^{\color{blue}{1}}\right) \cdot \cos B}{\sin B} \]
      18. unpow1N/A

        \[\leadsto \frac{1}{\sin B} - \frac{\left(-1 \cdot \color{blue}{x}\right) \cdot \cos B}{\sin B} \]
      19. neg-mul-1N/A

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

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

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

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

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

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

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

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

Alternative 17: 46.4% accurate, 3.0× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\\
\mathbf{if}\;B \leq 2.3 \cdot 10^{+38}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, t\_0, x \cdot 0.3333333333333333\right), F \cdot t\_0\right) - x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 2.3000000000000001e38

    1. Initial program 74.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 egg-rr85.9%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

    if 2.3000000000000001e38 < B

    1. Initial program 86.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 F around inf

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\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.f6419.2

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

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

Alternative 18: 51.0% accurate, 3.1× speedup?

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

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

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

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


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

    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. Applied egg-rr70.3%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \color{blue}{\frac{-1}{F}}\right) - x}{B} \]
    10. Applied egg-rr45.4%

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

    if -5.0000000000000004e127 < F < 2.7499999999999999e159

    1. Initial program 95.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. Applied egg-rr99.6%

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\right) - x}{B}} \]
    7. Applied egg-rr53.9%

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

    if 2.7499999999999999e159 < F

    1. Initial program 24.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.f6429.9

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

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

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

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

Alternative 19: 46.1% accurate, 3.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 1.25e30

    1. Initial program 74.4%

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

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

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

    if 1.25e30 < B

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\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.f6418.7

        \[\leadsto \frac{1}{\color{blue}{\sin B}} \]
    8. Simplified18.7%

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

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

Alternative 20: 51.0% accurate, 3.8× speedup?

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

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

\mathbf{elif}\;F \leq 4.2 \cdot 10^{+40}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \mathsf{fma}\left(B \cdot B, F \cdot 0.16666666666666666, F\right), \mathsf{fma}\left(x, \left(B \cdot B\right) \cdot 0.3333333333333333, -x\right)\right)}{B}\\

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


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

    1. Initial program 64.6%

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \color{blue}{\frac{-1}{F}}\right) - x}{B} \]
    10. Applied egg-rr46.1%

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

    if -1e11 < F < 4.2000000000000002e40

    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{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
    4. Simplified51.5%

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

    if 4.2000000000000002e40 < F

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

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

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

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

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

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

Alternative 21: 50.8% accurate, 4.1× speedup?

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

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

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

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


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

    1. Initial program 64.6%

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \color{blue}{\frac{-1}{F}}\right) - x}{B} \]
    10. Applied egg-rr46.1%

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

    if -9.6e6 < F < 1.5499999999999999e-17

    1. Initial program 99.5%

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

    if 1.5499999999999999e-17 < F

    1. Initial program 56.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.f6447.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. Simplified47.4%

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

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

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

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

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

Alternative 22: 50.8% accurate, 5.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -85000000:\\ \;\;\;\;\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.55 \cdot 10^{-17}:\\ \;\;\;\;\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -85000000.0)
   (/
    (- (fma (* B B) (fma x 0.3333333333333333 -0.16666666666666666) -1.0) x)
    B)
   (if (<= F 1.55e-17)
     (/ (fma F (sqrt (/ 1.0 (fma x 2.0 (fma F F 2.0)))) (- x)) B)
     (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -85000000.0) {
		tmp = (fma((B * B), fma(x, 0.3333333333333333, -0.16666666666666666), -1.0) - x) / B;
	} else if (F <= 1.55e-17) {
		tmp = fma(F, sqrt((1.0 / fma(x, 2.0, fma(F, F, 2.0)))), -x) / B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -85000000.0)
		tmp = Float64(Float64(fma(Float64(B * B), fma(x, 0.3333333333333333, -0.16666666666666666), -1.0) - x) / B);
	elseif (F <= 1.55e-17)
		tmp = Float64(fma(F, sqrt(Float64(1.0 / fma(x, 2.0, fma(F, F, 2.0)))), Float64(-x)) / B);
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -85000000.0], 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.55e-17], N[(N[(F * N[Sqrt[N[(1.0 / N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + (-x)), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -85000000:\\
\;\;\;\;\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.55 \cdot 10^{-17}:\\
\;\;\;\;\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}\\

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


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

    1. Initial program 64.6%

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

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

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

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

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. sub-negN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}}{B} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
    6. Simplified35.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\right) - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto \frac{\color{blue}{\left({B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) - 1\right)} - x}{B} \]
    8. Step-by-step derivation
      1. 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} \]
      2. 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} \]
      3. 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} \]
      4. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, -1\right) - x}{B} \]
      5. 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} \]
      6. sub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\frac{1}{3} \cdot x + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, -1\right) - x}{B} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{x \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), -1\right) - x}{B} \]
      8. 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} \]
      9. lower-fma.f6446.0

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right)}, -1\right) - x}{B} \]
    9. Simplified46.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), -1\right)} - x}{B} \]

    if -8.5e7 < F < 1.5499999999999999e-17

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. 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.f6451.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. Simplified51.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}} \]

    if 1.5499999999999999e-17 < F

    1. Initial program 56.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.f6447.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. Simplified47.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Taylor expanded in F around inf

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6460.7

        \[\leadsto \frac{\color{blue}{1 - x}}{B} \]
    8. Simplified60.7%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 23: 50.7% accurate, 6.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -0.68:\\ \;\;\;\;\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.55 \cdot 10^{-17}:\\ \;\;\;\;\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, 2\right)}}, -x\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -0.68)
   (/
    (- (fma (* B B) (fma x 0.3333333333333333 -0.16666666666666666) -1.0) x)
    B)
   (if (<= F 1.55e-17)
     (/ (fma F (sqrt (/ 1.0 (fma x 2.0 2.0))) (- x)) B)
     (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -0.68) {
		tmp = (fma((B * B), fma(x, 0.3333333333333333, -0.16666666666666666), -1.0) - x) / B;
	} else if (F <= 1.55e-17) {
		tmp = fma(F, sqrt((1.0 / fma(x, 2.0, 2.0))), -x) / B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -0.68)
		tmp = Float64(Float64(fma(Float64(B * B), fma(x, 0.3333333333333333, -0.16666666666666666), -1.0) - x) / B);
	elseif (F <= 1.55e-17)
		tmp = Float64(fma(F, sqrt(Float64(1.0 / fma(x, 2.0, 2.0))), Float64(-x)) / B);
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -0.68], 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.55e-17], N[(N[(F * N[Sqrt[N[(1.0 / N[(x * 2.0 + 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 -0.68:\\
\;\;\;\;\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.55 \cdot 10^{-17}:\\
\;\;\;\;\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, 2\right)}}, -x\right)}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -0.680000000000000049

    1. Initial program 64.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Applied egg-rr79.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sin B}, F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{-x}{\tan B}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. sub-negN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}}{B} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
    6. Simplified35.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\right) - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto \frac{\color{blue}{\left({B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) - 1\right)} - x}{B} \]
    8. Step-by-step derivation
      1. 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} \]
      2. 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} \]
      3. 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} \]
      4. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, -1\right) - x}{B} \]
      5. 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} \]
      6. sub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\frac{1}{3} \cdot x + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, -1\right) - x}{B} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{x \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), -1\right) - x}{B} \]
      8. 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} \]
      9. lower-fma.f6446.0

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right)}, -1\right) - x}{B} \]
    9. Simplified46.0%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), -1\right)} - x}{B} \]

    if -0.680000000000000049 < F < 1.5499999999999999e-17

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. 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.f6451.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. Simplified51.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Taylor expanded in F around 0

      \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} - x}}{B} \]
    7. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + 2 \cdot x}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + 2 \cdot x}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + 2 \cdot x}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + 2}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. lower-neg.f6450.8

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, 2\right)}}, \color{blue}{-x}\right)}{B} \]
    8. Simplified50.8%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, 2\right)}}, -x\right)}}{B} \]

    if 1.5499999999999999e-17 < F

    1. Initial program 56.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.f6447.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. Simplified47.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Taylor expanded in F around inf

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6460.7

        \[\leadsto \frac{\color{blue}{1 - x}}{B} \]
    8. Simplified60.7%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 24: 43.5% accurate, 9.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.65 \cdot 10^{-66}:\\ \;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), -1\right) - x}{B}\\ \mathbf{elif}\;F \leq 3.9 \cdot 10^{-116}:\\ \;\;\;\;\frac{x \cdot \mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.65e-66)
   (/
    (- (fma (* B B) (fma x 0.3333333333333333 -0.16666666666666666) -1.0) x)
    B)
   (if (<= F 3.9e-116)
     (/ (* x (fma (* B B) 0.3333333333333333 -1.0)) B)
     (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.65e-66) {
		tmp = (fma((B * B), fma(x, 0.3333333333333333, -0.16666666666666666), -1.0) - x) / B;
	} else if (F <= 3.9e-116) {
		tmp = (x * fma((B * B), 0.3333333333333333, -1.0)) / B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.65e-66)
		tmp = Float64(Float64(fma(Float64(B * B), fma(x, 0.3333333333333333, -0.16666666666666666), -1.0) - x) / B);
	elseif (F <= 3.9e-116)
		tmp = Float64(Float64(x * fma(Float64(B * B), 0.3333333333333333, -1.0)) / B);
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -1.65e-66], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.16666666666666666), $MachinePrecision] + -1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.9e-116], N[(N[(x * N[(N[(B * B), $MachinePrecision] * 0.3333333333333333 + -1.0), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.65 \cdot 10^{-66}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), -1\right) - x}{B}\\

\mathbf{elif}\;F \leq 3.9 \cdot 10^{-116}:\\
\;\;\;\;\frac{x \cdot \mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.6499999999999999e-66

    1. Initial program 68.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 egg-rr81.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sin B}, F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{-x}{\tan B}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. sub-negN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}}{B} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
    6. Simplified38.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\right) - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto \frac{\color{blue}{\left({B}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{6}\right) - 1\right)} - x}{B} \]
    8. Step-by-step derivation
      1. 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} \]
      2. 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} \]
      3. 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} \]
      4. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x - \frac{1}{6}, -1\right) - x}{B} \]
      5. 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} \]
      6. sub-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\frac{1}{3} \cdot x + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, -1\right) - x}{B} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{x \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), -1\right) - x}{B} \]
      8. 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} \]
      9. lower-fma.f6442.7

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{\mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right)}, -1\right) - x}{B} \]
    9. Simplified42.7%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(x, 0.3333333333333333, -0.16666666666666666\right), -1\right)} - x}{B} \]

    if -1.6499999999999999e-66 < F < 3.9000000000000001e-116

    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 egg-rr99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sin B}, F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{-x}{\tan B}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. sub-negN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}}{B} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
    6. Simplified52.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\right) - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \frac{\color{blue}{\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) - x}}{B} \]
    8. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{\color{blue}{\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      2. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(\frac{1}{3} \cdot {B}^{2}\right) \cdot x} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\left(\frac{1}{3} \cdot {B}^{2}\right) \cdot x + \color{blue}{-1 \cdot x}}{B} \]
      4. distribute-rgt-inN/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(\frac{1}{3} \cdot {B}^{2} + -1\right)}}{B} \]
      5. metadata-evalN/A

        \[\leadsto \frac{x \cdot \left(\frac{1}{3} \cdot {B}^{2} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)}{B} \]
      6. sub-negN/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(\frac{1}{3} \cdot {B}^{2} - 1\right)}}{B} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(\frac{1}{3} \cdot {B}^{2} - 1\right)}}{B} \]
      8. sub-negN/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(\frac{1}{3} \cdot {B}^{2} + \left(\mathsf{neg}\left(1\right)\right)\right)}}{B} \]
      9. *-commutativeN/A

        \[\leadsto \frac{x \cdot \left(\color{blue}{{B}^{2} \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(1\right)\right)\right)}{B} \]
      10. metadata-evalN/A

        \[\leadsto \frac{x \cdot \left({B}^{2} \cdot \frac{1}{3} + \color{blue}{-1}\right)}{B} \]
      11. lower-fma.f64N/A

        \[\leadsto \frac{x \cdot \color{blue}{\mathsf{fma}\left({B}^{2}, \frac{1}{3}, -1\right)}}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{x \cdot \mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3}, -1\right)}{B} \]
      13. lower-*.f6437.8

        \[\leadsto \frac{x \cdot \mathsf{fma}\left(\color{blue}{B \cdot B}, 0.3333333333333333, -1\right)}{B} \]
    9. Simplified37.8%

      \[\leadsto \frac{\color{blue}{x \cdot \mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}}{B} \]

    if 3.9000000000000001e-116 < F

    1. Initial program 63.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.f6446.9

        \[\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. Simplified46.9%

      \[\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--.f6455.6

        \[\leadsto \frac{\color{blue}{1 - x}}{B} \]
    8. Simplified55.6%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 25: 43.5% accurate, 9.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -3.9 \cdot 10^{-67}:\\ \;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, x \cdot 0.3333333333333333, -1\right) - x}{B}\\ \mathbf{elif}\;F \leq 1.95 \cdot 10^{-114}:\\ \;\;\;\;\frac{x \cdot \mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -3.9e-67)
   (/ (- (fma (* B B) (* x 0.3333333333333333) -1.0) x) B)
   (if (<= F 1.95e-114)
     (/ (* x (fma (* B B) 0.3333333333333333 -1.0)) B)
     (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.9e-67) {
		tmp = (fma((B * B), (x * 0.3333333333333333), -1.0) - x) / B;
	} else if (F <= 1.95e-114) {
		tmp = (x * fma((B * B), 0.3333333333333333, -1.0)) / B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -3.9e-67)
		tmp = Float64(Float64(fma(Float64(B * B), Float64(x * 0.3333333333333333), -1.0) - x) / B);
	elseif (F <= 1.95e-114)
		tmp = Float64(Float64(x * fma(Float64(B * B), 0.3333333333333333, -1.0)) / B);
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -3.9e-67], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(x * 0.3333333333333333), $MachinePrecision] + -1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.95e-114], N[(N[(x * N[(N[(B * B), $MachinePrecision] * 0.3333333333333333 + -1.0), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.9 \cdot 10^{-67}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, x \cdot 0.3333333333333333, -1\right) - x}{B}\\

\mathbf{elif}\;F \leq 1.95 \cdot 10^{-114}:\\
\;\;\;\;\frac{x \cdot \mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -3.8999999999999998e-67

    1. Initial program 68.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 egg-rr81.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sin B}, F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{-x}{\tan B}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. sub-negN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}}{B} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
    6. Simplified38.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\right) - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot \frac{1}{6}, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot \frac{1}{3}\right), F \cdot \color{blue}{\frac{-1}{F}}\right) - x}{B} \]
    8. Step-by-step derivation
      1. lower-/.f6442.7

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \color{blue}{\frac{-1}{F}}\right) - x}{B} \]
    9. Simplified42.7%

      \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \color{blue}{\frac{-1}{F}}\right) - x}{B} \]
    10. Taylor expanded in F around 0

      \[\leadsto \frac{\color{blue}{\left(\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) - 1\right)} - x}{B} \]
    11. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{\color{blue}{\left(\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) + \left(\mathsf{neg}\left(1\right)\right)\right)} - x}{B} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\left(\color{blue}{\left({B}^{2} \cdot x\right) \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(1\right)\right)\right) - x}{B} \]
      3. associate-*r*N/A

        \[\leadsto \frac{\left(\color{blue}{{B}^{2} \cdot \left(x \cdot \frac{1}{3}\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) - x}{B} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\left({B}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot x\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\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, -1\right)} - x}{B} \]
      7. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x, -1\right) - x}{B} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3} \cdot x, -1\right) - x}{B} \]
      9. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{x \cdot \frac{1}{3}}, -1\right) - x}{B} \]
      10. lower-*.f6442.7

        \[\leadsto \frac{\mathsf{fma}\left(B \cdot B, \color{blue}{x \cdot 0.3333333333333333}, -1\right) - x}{B} \]
    12. Simplified42.7%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(B \cdot B, x \cdot 0.3333333333333333, -1\right)} - x}{B} \]

    if -3.8999999999999998e-67 < F < 1.95000000000000001e-114

    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 egg-rr99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sin B}, F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{-x}{\tan B}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. sub-negN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}}{B} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
    6. Simplified52.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\right) - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \frac{\color{blue}{\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) - x}}{B} \]
    8. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{\color{blue}{\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      2. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(\frac{1}{3} \cdot {B}^{2}\right) \cdot x} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\left(\frac{1}{3} \cdot {B}^{2}\right) \cdot x + \color{blue}{-1 \cdot x}}{B} \]
      4. distribute-rgt-inN/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(\frac{1}{3} \cdot {B}^{2} + -1\right)}}{B} \]
      5. metadata-evalN/A

        \[\leadsto \frac{x \cdot \left(\frac{1}{3} \cdot {B}^{2} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)}{B} \]
      6. sub-negN/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(\frac{1}{3} \cdot {B}^{2} - 1\right)}}{B} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(\frac{1}{3} \cdot {B}^{2} - 1\right)}}{B} \]
      8. sub-negN/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(\frac{1}{3} \cdot {B}^{2} + \left(\mathsf{neg}\left(1\right)\right)\right)}}{B} \]
      9. *-commutativeN/A

        \[\leadsto \frac{x \cdot \left(\color{blue}{{B}^{2} \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(1\right)\right)\right)}{B} \]
      10. metadata-evalN/A

        \[\leadsto \frac{x \cdot \left({B}^{2} \cdot \frac{1}{3} + \color{blue}{-1}\right)}{B} \]
      11. lower-fma.f64N/A

        \[\leadsto \frac{x \cdot \color{blue}{\mathsf{fma}\left({B}^{2}, \frac{1}{3}, -1\right)}}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{x \cdot \mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3}, -1\right)}{B} \]
      13. lower-*.f6437.8

        \[\leadsto \frac{x \cdot \mathsf{fma}\left(\color{blue}{B \cdot B}, 0.3333333333333333, -1\right)}{B} \]
    9. Simplified37.8%

      \[\leadsto \frac{\color{blue}{x \cdot \mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}}{B} \]

    if 1.95000000000000001e-114 < F

    1. Initial program 63.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.f6446.9

        \[\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. Simplified46.9%

      \[\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--.f6455.6

        \[\leadsto \frac{\color{blue}{1 - x}}{B} \]
    8. Simplified55.6%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 26: 43.5% accurate, 9.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -8.2 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 2.8 \cdot 10^{-115}:\\ \;\;\;\;\frac{x \cdot \mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -8.2e-68)
   (/ (- -1.0 x) B)
   (if (<= F 2.8e-115)
     (/ (* x (fma (* B B) 0.3333333333333333 -1.0)) B)
     (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -8.2e-68) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 2.8e-115) {
		tmp = (x * fma((B * B), 0.3333333333333333, -1.0)) / B;
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -8.2e-68)
		tmp = Float64(Float64(-1.0 - x) / B);
	elseif (F <= 2.8e-115)
		tmp = Float64(Float64(x * fma(Float64(B * B), 0.3333333333333333, -1.0)) / B);
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -8.2e-68], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.8e-115], N[(N[(x * N[(N[(B * B), $MachinePrecision] * 0.3333333333333333 + -1.0), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.2 \cdot 10^{-68}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq 2.8 \cdot 10^{-115}:\\
\;\;\;\;\frac{x \cdot \mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -8.20000000000000042e-68

    1. Initial program 68.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.f6436.6

        \[\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. Simplified36.6%

      \[\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--.f6441.4

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    8. Simplified41.4%

      \[\leadsto \color{blue}{\frac{-1 - x}{B}} \]

    if -8.20000000000000042e-68 < F < 2.79999999999999987e-115

    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 egg-rr99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sin B}, F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{-x}{\tan B}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. sub-negN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}}{B} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
    6. Simplified52.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\right) - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \frac{\color{blue}{\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) - x}}{B} \]
    8. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{\color{blue}{\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      2. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(\frac{1}{3} \cdot {B}^{2}\right) \cdot x} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\left(\frac{1}{3} \cdot {B}^{2}\right) \cdot x + \color{blue}{-1 \cdot x}}{B} \]
      4. distribute-rgt-inN/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(\frac{1}{3} \cdot {B}^{2} + -1\right)}}{B} \]
      5. metadata-evalN/A

        \[\leadsto \frac{x \cdot \left(\frac{1}{3} \cdot {B}^{2} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)}{B} \]
      6. sub-negN/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(\frac{1}{3} \cdot {B}^{2} - 1\right)}}{B} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(\frac{1}{3} \cdot {B}^{2} - 1\right)}}{B} \]
      8. sub-negN/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(\frac{1}{3} \cdot {B}^{2} + \left(\mathsf{neg}\left(1\right)\right)\right)}}{B} \]
      9. *-commutativeN/A

        \[\leadsto \frac{x \cdot \left(\color{blue}{{B}^{2} \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(1\right)\right)\right)}{B} \]
      10. metadata-evalN/A

        \[\leadsto \frac{x \cdot \left({B}^{2} \cdot \frac{1}{3} + \color{blue}{-1}\right)}{B} \]
      11. lower-fma.f64N/A

        \[\leadsto \frac{x \cdot \color{blue}{\mathsf{fma}\left({B}^{2}, \frac{1}{3}, -1\right)}}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{x \cdot \mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3}, -1\right)}{B} \]
      13. lower-*.f6437.8

        \[\leadsto \frac{x \cdot \mathsf{fma}\left(\color{blue}{B \cdot B}, 0.3333333333333333, -1\right)}{B} \]
    9. Simplified37.8%

      \[\leadsto \frac{\color{blue}{x \cdot \mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}}{B} \]

    if 2.79999999999999987e-115 < F

    1. Initial program 63.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.f6446.9

        \[\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. Simplified46.9%

      \[\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--.f6455.6

        \[\leadsto \frac{\color{blue}{1 - x}}{B} \]
    8. Simplified55.6%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 27: 43.5% accurate, 9.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -7.3 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.95 \cdot 10^{-114}:\\ \;\;\;\;x \cdot \frac{\mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -7.3e-68)
   (/ (- -1.0 x) B)
   (if (<= F 1.95e-114)
     (* x (/ (fma (* B B) 0.3333333333333333 -1.0) B))
     (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -7.3e-68) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 1.95e-114) {
		tmp = x * (fma((B * B), 0.3333333333333333, -1.0) / B);
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -7.3e-68)
		tmp = Float64(Float64(-1.0 - x) / B);
	elseif (F <= 1.95e-114)
		tmp = Float64(x * Float64(fma(Float64(B * B), 0.3333333333333333, -1.0) / B));
	else
		tmp = Float64(Float64(1.0 - x) / B);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -7.3e-68], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.95e-114], N[(x * N[(N[(N[(B * B), $MachinePrecision] * 0.3333333333333333 + -1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.3 \cdot 10^{-68}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq 1.95 \cdot 10^{-114}:\\
\;\;\;\;x \cdot \frac{\mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -7.30000000000000009e-68

    1. Initial program 68.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.f6436.6

        \[\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. Simplified36.6%

      \[\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--.f6441.4

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    8. Simplified41.4%

      \[\leadsto \color{blue}{\frac{-1 - x}{B}} \]

    if -7.30000000000000009e-68 < F < 1.95000000000000001e-114

    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 egg-rr99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\sin B}, F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{-x}{\tan B}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{-1 \cdot x + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right)}{B} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. sub-negN/A

        \[\leadsto \frac{\color{blue}{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}}{B} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
    6. Simplified52.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(F \cdot 0.16666666666666666, \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}, x \cdot 0.3333333333333333\right), F \cdot \sqrt{\frac{1}{2 + \mathsf{fma}\left(x, 2, F \cdot F\right)}}\right) - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \color{blue}{\frac{\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) - x}{B}} \]
    8. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \frac{\color{blue}{\frac{1}{3} \cdot \left({B}^{2} \cdot x\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      2. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(\frac{1}{3} \cdot {B}^{2}\right) \cdot x} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\left(\frac{1}{3} \cdot {B}^{2}\right) \cdot x + \color{blue}{-1 \cdot x}}{B} \]
      4. distribute-rgt-inN/A

        \[\leadsto \frac{\color{blue}{x \cdot \left(\frac{1}{3} \cdot {B}^{2} + -1\right)}}{B} \]
      5. metadata-evalN/A

        \[\leadsto \frac{x \cdot \left(\frac{1}{3} \cdot {B}^{2} + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)}{B} \]
      6. sub-negN/A

        \[\leadsto \frac{x \cdot \color{blue}{\left(\frac{1}{3} \cdot {B}^{2} - 1\right)}}{B} \]
      7. associate-/l*N/A

        \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{3} \cdot {B}^{2} - 1}{B}} \]
      8. lower-*.f64N/A

        \[\leadsto \color{blue}{x \cdot \frac{\frac{1}{3} \cdot {B}^{2} - 1}{B}} \]
      9. lower-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{3} \cdot {B}^{2} - 1}{B}} \]
      10. sub-negN/A

        \[\leadsto x \cdot \frac{\color{blue}{\frac{1}{3} \cdot {B}^{2} + \left(\mathsf{neg}\left(1\right)\right)}}{B} \]
      11. *-commutativeN/A

        \[\leadsto x \cdot \frac{\color{blue}{{B}^{2} \cdot \frac{1}{3}} + \left(\mathsf{neg}\left(1\right)\right)}{B} \]
      12. metadata-evalN/A

        \[\leadsto x \cdot \frac{{B}^{2} \cdot \frac{1}{3} + \color{blue}{-1}}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto x \cdot \frac{\color{blue}{\mathsf{fma}\left({B}^{2}, \frac{1}{3}, -1\right)}}{B} \]
      14. unpow2N/A

        \[\leadsto x \cdot \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, \frac{1}{3}, -1\right)}{B} \]
      15. lower-*.f6437.7

        \[\leadsto x \cdot \frac{\mathsf{fma}\left(\color{blue}{B \cdot B}, 0.3333333333333333, -1\right)}{B} \]
    9. Simplified37.7%

      \[\leadsto \color{blue}{x \cdot \frac{\mathsf{fma}\left(B \cdot B, 0.3333333333333333, -1\right)}{B}} \]

    if 1.95000000000000001e-114 < F

    1. Initial program 63.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.f6446.9

        \[\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. Simplified46.9%

      \[\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--.f6455.6

        \[\leadsto \frac{\color{blue}{1 - x}}{B} \]
    8. Simplified55.6%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 28: 43.8% accurate, 13.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -8.5 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 5.5 \cdot 10^{-71}:\\ \;\;\;\;-\frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -8.5e-68)
   (/ (- -1.0 x) B)
   (if (<= F 5.5e-71) (- (/ x B)) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -8.5e-68) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 5.5e-71) {
		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 <= (-8.5d-68)) then
        tmp = ((-1.0d0) - x) / b
    else if (f <= 5.5d-71) 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 <= -8.5e-68) {
		tmp = (-1.0 - x) / B;
	} else if (F <= 5.5e-71) {
		tmp = -(x / B);
	} else {
		tmp = (1.0 - x) / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -8.5e-68:
		tmp = (-1.0 - x) / B
	elif F <= 5.5e-71:
		tmp = -(x / B)
	else:
		tmp = (1.0 - x) / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -8.5e-68)
		tmp = Float64(Float64(-1.0 - x) / B);
	elseif (F <= 5.5e-71)
		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 <= -8.5e-68)
		tmp = (-1.0 - x) / B;
	elseif (F <= 5.5e-71)
		tmp = -(x / B);
	else
		tmp = (1.0 - x) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -8.5e-68], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.5e-71], (-N[(x / B), $MachinePrecision]), N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.5 \cdot 10^{-68}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{elif}\;F \leq 5.5 \cdot 10^{-71}:\\
\;\;\;\;-\frac{x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -8.50000000000000026e-68

    1. Initial program 68.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.f6436.6

        \[\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. Simplified36.6%

      \[\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--.f6441.4

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    8. Simplified41.4%

      \[\leadsto \color{blue}{\frac{-1 - x}{B}} \]

    if -8.50000000000000026e-68 < F < 5.4999999999999997e-71

    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.f6450.3

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Simplified50.3%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Taylor expanded in F around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    7. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} \]
      4. lower-neg.f6437.2

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    8. Simplified37.2%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]

    if 5.4999999999999997e-71 < F

    1. Initial program 61.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.f6447.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. Simplified47.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Taylor expanded in F around inf

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
      2. lower--.f6457.3

        \[\leadsto \frac{\color{blue}{1 - x}}{B} \]
    8. Simplified57.3%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -8.5 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 5.5 \cdot 10^{-71}:\\ \;\;\;\;-\frac{x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 29: 30.8% accurate, 14.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -\frac{x}{B}\\ \mathbf{if}\;x \leq -3.8 \cdot 10^{-119}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-208}:\\ \;\;\;\;\frac{1}{B}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (- (/ x B))))
   (if (<= x -3.8e-119) t_0 (if (<= x 4.6e-208) (/ 1.0 B) t_0))))
double code(double F, double B, double x) {
	double t_0 = -(x / B);
	double tmp;
	if (x <= -3.8e-119) {
		tmp = t_0;
	} else if (x <= 4.6e-208) {
		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 <= (-3.8d-119)) then
        tmp = t_0
    else if (x <= 4.6d-208) 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 <= -3.8e-119) {
		tmp = t_0;
	} else if (x <= 4.6e-208) {
		tmp = 1.0 / B;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = -(x / B)
	tmp = 0
	if x <= -3.8e-119:
		tmp = t_0
	elif x <= 4.6e-208:
		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 <= -3.8e-119)
		tmp = t_0;
	elseif (x <= 4.6e-208)
		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 <= -3.8e-119)
		tmp = t_0;
	elseif (x <= 4.6e-208)
		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, -3.8e-119], t$95$0, If[LessEqual[x, 4.6e-208], N[(1.0 / B), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{-119}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 4.6 \cdot 10^{-208}:\\
\;\;\;\;\frac{1}{B}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.79999999999999975e-119 or 4.59999999999999993e-208 < x

    1. Initial program 78.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.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. Simplified46.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Taylor expanded in F around 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.f6439.3

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    8. Simplified39.3%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]

    if -3.79999999999999975e-119 < x < 4.59999999999999993e-208

    1. Initial program 73.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.f6440.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. Simplified40.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 \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{{F}^{2}}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{{F}^{2}}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      2. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{F \cdot F}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      3. lower-*.f6419.0

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{F \cdot F}}}, -x\right)}{B} \]
    8. Simplified19.0%

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{F \cdot F}}}, -x\right)}{B} \]
    9. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{B}} \]
    10. Step-by-step derivation
      1. lower-/.f6417.8

        \[\leadsto \color{blue}{\frac{1}{B}} \]
    11. Simplified17.8%

      \[\leadsto \color{blue}{\frac{1}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification33.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-119}:\\ \;\;\;\;-\frac{x}{B}\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-208}:\\ \;\;\;\;\frac{1}{B}\\ \mathbf{else}:\\ \;\;\;\;-\frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 30: 37.0% accurate, 17.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -7.2 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;-\frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -7.2e-68) (/ (- -1.0 x) B) (- (/ x B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -7.2e-68) {
		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 <= (-7.2d-68)) 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 <= -7.2e-68) {
		tmp = (-1.0 - x) / B;
	} else {
		tmp = -(x / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -7.2e-68:
		tmp = (-1.0 - x) / B
	else:
		tmp = -(x / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -7.2e-68)
		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 <= -7.2e-68)
		tmp = (-1.0 - x) / B;
	else
		tmp = -(x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -7.2e-68], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], (-N[(x / B), $MachinePrecision])]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.2 \cdot 10^{-68}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{else}:\\
\;\;\;\;-\frac{x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -7.20000000000000015e-68

    1. Initial program 68.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.f6436.6

        \[\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. Simplified36.6%

      \[\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--.f6441.4

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    8. Simplified41.4%

      \[\leadsto \color{blue}{\frac{-1 - x}{B}} \]

    if -7.20000000000000015e-68 < F

    1. Initial program 82.2%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
      2. sub-negN/A

        \[\leadsto \frac{\color{blue}{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      3. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(F, \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}, \mathsf{neg}\left(x\right)\right)}}{B} \]
      4. lower-sqrt.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \color{blue}{\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      6. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\left(2 \cdot x + {F}^{2}\right) + 2}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      7. associate-+l+N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{2 \cdot x + \left({F}^{2} + 2\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{x \cdot 2} + \left({F}^{2} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      9. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{x \cdot 2 + \color{blue}{\left(2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      10. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{\mathsf{fma}\left(x, 2, 2 + {F}^{2}\right)}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      11. +-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{{F}^{2} + 2}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      12. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{F \cdot F} + 2\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      13. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      14. lower-neg.f6449.2

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, \color{blue}{-x}\right)}{B} \]
    5. Simplified49.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Taylor expanded in F around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    7. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{B}} \]
      4. lower-neg.f6435.1

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    8. Simplified35.1%

      \[\leadsto \color{blue}{\frac{-x}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification37.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -7.2 \cdot 10^{-68}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;-\frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 31: 17.6% accurate, 20.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq 1.9 \cdot 10^{-267}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \end{array} \]
(FPCore (F B x) :precision binary64 (if (<= F 1.9e-267) (/ -1.0 B) (/ 1.0 B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= 1.9e-267) {
		tmp = -1.0 / B;
	} else {
		tmp = 1.0 / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= 1.9d-267) then
        tmp = (-1.0d0) / b
    else
        tmp = 1.0d0 / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= 1.9e-267) {
		tmp = -1.0 / B;
	} else {
		tmp = 1.0 / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= 1.9e-267:
		tmp = -1.0 / B
	else:
		tmp = 1.0 / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= 1.9e-267)
		tmp = Float64(-1.0 / B);
	else
		tmp = Float64(1.0 / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= 1.9e-267)
		tmp = -1.0 / B;
	else
		tmp = 1.0 / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, 1.9e-267], N[(-1.0 / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.9 \cdot 10^{-267}:\\
\;\;\;\;\frac{-1}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 1.90000000000000001e-267

    1. Initial program 79.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.f6441.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. Simplified41.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Taylor expanded in F around -inf

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    7. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\left(1 + x\right)\right)}}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left(1 + x\right)\right)}{B}} \]
      4. distribute-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(x\right)\right)}}{B} \]
      5. metadata-evalN/A

        \[\leadsto \frac{\color{blue}{-1} + \left(\mathsf{neg}\left(x\right)\right)}{B} \]
      6. unsub-negN/A

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
      7. lower--.f6433.2

        \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
    8. Simplified33.2%

      \[\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-/.f6416.7

        \[\leadsto \color{blue}{\frac{-1}{B}} \]
    11. Simplified16.7%

      \[\leadsto \color{blue}{\frac{-1}{B}} \]

    if 1.90000000000000001e-267 < F

    1. Initial program 74.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.f6448.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. Simplified48.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, -x\right)}{B}} \]
    6. Taylor expanded in F around inf

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{{F}^{2}}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{{F}^{2}}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      2. unpow2N/A

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{F \cdot F}}}, \mathsf{neg}\left(x\right)\right)}{B} \]
      3. lower-*.f6434.1

        \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\frac{1}{\color{blue}{F \cdot F}}}, -x\right)}{B} \]
    8. Simplified34.1%

      \[\leadsto \frac{\mathsf{fma}\left(F, \sqrt{\color{blue}{\frac{1}{F \cdot F}}}, -x\right)}{B} \]
    9. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{B}} \]
    10. Step-by-step derivation
      1. lower-/.f6418.3

        \[\leadsto \color{blue}{\frac{1}{B}} \]
    11. Simplified18.3%

      \[\leadsto \color{blue}{\frac{1}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 32: 11.0% 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 77.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.f6444.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. Simplified44.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--.f6430.4

      \[\leadsto \frac{\color{blue}{-1 - x}}{B} \]
  8. Simplified30.4%

    \[\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.7

      \[\leadsto \color{blue}{\frac{-1}{B}} \]
  11. Simplified10.7%

    \[\leadsto \color{blue}{\frac{-1}{B}} \]
  12. Add Preprocessing

Reproduce

?
herbie shell --seed 2024207 
(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))))))