VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.1% → 99.4%
Time: 9.3s
Alternatives: 17
Speedup: 1.6×

Specification

?
\[\begin{array}{l} \\ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (+
  (- (* x (/ 1.0 (tan B))))
  (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
	return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(f, b, x)
use fmin_fmax_functions
    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 17 alternatives:

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

Initial Program: 77.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (+
  (- (* x (/ 1.0 (tan B))))
  (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
	return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(f, b, x)
use fmin_fmax_functions
    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.4% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.1 \cdot 10^{+27}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\

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

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


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

    1. Initial program 54.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}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
    4. Step-by-step derivation
      1. Applied rewrites99.7%

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

      if -1.0999999999999999e27 < F < 5.8000000000000004e-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. Step-by-step derivation
        1. lift-+.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(F, \frac{\color{blue}{\sqrt{\frac{1}{2 + {F}^{2}}}}}{\sin B}, \frac{-x}{\tan B}\right) \]
      6. Step-by-step derivation
        1. Applied rewrites99.7%

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

        if 5.8000000000000004e-6 < F

        1. Initial program 60.6%

          \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B} + \frac{1}{\sin B}} \]
        6. Step-by-step derivation
          1. Applied rewrites99.9%

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

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

        Alternative 2: 99.0% accurate, 1.5× speedup?

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

          1. Initial program 56.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}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
          4. Step-by-step derivation
            1. Applied rewrites99.7%

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

            if -1.3999999999999999 < F < 5.8000000000000004e-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. Step-by-step derivation
              1. lift-+.f64N/A

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(F, \frac{\color{blue}{\sqrt{\frac{1}{2 + {F}^{2}}}}}{\sin B}, \frac{-x}{\tan B}\right) \]
            6. Step-by-step derivation
              1. Applied rewrites99.7%

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

                \[\leadsto \mathsf{fma}\left(F, \frac{\sqrt{\frac{1}{2}}}{\sin B}, \frac{-x}{\tan B}\right) \]
              3. Step-by-step derivation
                1. Applied rewrites99.7%

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

                if 5.8000000000000004e-6 < F

                1. Initial program 60.6%

                  \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-+.f64N/A

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B} + \frac{1}{\sin B}} \]
                6. Step-by-step derivation
                  1. Applied rewrites99.9%

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

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

                Alternative 3: 91.7% accurate, 1.6× speedup?

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

                  1. Initial program 56.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}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
                  4. Step-by-step derivation
                    1. Applied rewrites99.7%

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

                    if -6300 < F < 5.8000000000000004e-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. Taylor expanded in B around 0

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

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

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

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

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

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

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

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

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

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

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

                      if 5.8000000000000004e-6 < F

                      1. Initial program 60.6%

                        \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. lift-+.f64N/A

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B} + \frac{1}{\sin B}} \]
                      6. Step-by-step derivation
                        1. Applied rewrites99.9%

                          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, \cos B \cdot x, 1\right)}{\sin B}} \]
                      7. Recombined 3 regimes into one program.
                      8. Final simplification91.5%

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

                      Alternative 4: 84.4% accurate, 1.6× speedup?

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

                        1. Initial program 56.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}{-1 \cdot \left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right)} \]
                        4. Step-by-step derivation
                          1. Applied rewrites99.7%

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

                          if -6300 < F < 1.55e152

                          1. Initial program 97.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 \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{B} \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}} \]
                          4. Step-by-step derivation
                            1. Applied rewrites81.0%

                              \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}} \]
                            2. Step-by-step derivation
                              1. Applied rewrites83.4%

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

                              if 1.55e152 < F

                              1. Initial program 20.1%

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

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

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

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

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

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

                                Alternative 5: 76.5% accurate, 2.1× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.9 \cdot 10^{+126}:\\ \;\;\;\;\mathsf{fma}\left(F, \frac{-1}{B \cdot F}, \frac{-x}{\tan B}\right)\\ \mathbf{elif}\;F \leq -9 \cdot 10^{+88}:\\ \;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 1.55 \cdot 10^{+152}:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\sin B}\\ \end{array} \end{array} \]
                                (FPCore (F B x)
                                 :precision binary64
                                 (if (<= F -1.9e+126)
                                   (fma F (/ -1.0 (* B F)) (/ (- x) (tan B)))
                                   (if (<= F -9e+88)
                                     (* (sqrt (/ 1.0 (fma F F 2.0))) (/ F (sin B)))
                                     (if (<= F 1.55e+152)
                                       (+ (* x (/ -1.0 (tan B))) (/ F (* B (sqrt (fma x 2.0 (fma F F 2.0))))))
                                       (+ (- (/ x B)) (/ 1.0 (sin B)))))))
                                double code(double F, double B, double x) {
                                	double tmp;
                                	if (F <= -1.9e+126) {
                                		tmp = fma(F, (-1.0 / (B * F)), (-x / tan(B)));
                                	} else if (F <= -9e+88) {
                                		tmp = sqrt((1.0 / fma(F, F, 2.0))) * (F / sin(B));
                                	} else if (F <= 1.55e+152) {
                                		tmp = (x * (-1.0 / tan(B))) + (F / (B * sqrt(fma(x, 2.0, fma(F, F, 2.0)))));
                                	} else {
                                		tmp = -(x / B) + (1.0 / sin(B));
                                	}
                                	return tmp;
                                }
                                
                                function code(F, B, x)
                                	tmp = 0.0
                                	if (F <= -1.9e+126)
                                		tmp = fma(F, Float64(-1.0 / Float64(B * F)), Float64(Float64(-x) / tan(B)));
                                	elseif (F <= -9e+88)
                                		tmp = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * Float64(F / sin(B)));
                                	elseif (F <= 1.55e+152)
                                		tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(F / Float64(B * sqrt(fma(x, 2.0, fma(F, F, 2.0))))));
                                	else
                                		tmp = Float64(Float64(-Float64(x / B)) + Float64(1.0 / sin(B)));
                                	end
                                	return tmp
                                end
                                
                                code[F_, B_, x_] := If[LessEqual[F, -1.9e+126], N[(F * N[(-1.0 / N[(B * F), $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -9e+88], N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.55e+152], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(F / N[(B * N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;F \leq -1.9 \cdot 10^{+126}:\\
                                \;\;\;\;\mathsf{fma}\left(F, \frac{-1}{B \cdot F}, \frac{-x}{\tan B}\right)\\
                                
                                \mathbf{elif}\;F \leq -9 \cdot 10^{+88}:\\
                                \;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
                                
                                \mathbf{elif}\;F \leq 1.55 \cdot 10^{+152}:\\
                                \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B \cdot \sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\sin B}\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 4 regimes
                                2. if F < -1.90000000000000008e126

                                  1. Initial program 41.4%

                                    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
                                  2. Add Preprocessing
                                  3. Step-by-step derivation
                                    1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \mathsf{fma}\left(F, \frac{-1}{B \cdot \color{blue}{F}}, \frac{-x}{\tan B}\right) \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites79.3%

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

                                      if -1.90000000000000008e126 < F < -9e88

                                      1. Initial program 99.3%

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

                                        \[\leadsto \color{blue}{\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + {F}^{2}}}} \]
                                      4. Step-by-step derivation
                                        1. Applied rewrites82.2%

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

                                        if -9e88 < F < 1.55e152

                                        1. Initial program 96.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 \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{B} \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}} \]
                                        4. Step-by-step derivation
                                          1. Applied rewrites80.1%

                                            \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}} \]
                                          2. Step-by-step derivation
                                            1. Applied rewrites83.3%

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

                                            if 1.55e152 < F

                                            1. Initial program 20.1%

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

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

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

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

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

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

                                              Alternative 6: 56.0% accurate, 2.3× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(B \cdot B\right) \cdot F\\ t_1 := \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\ \mathbf{if}\;B \leq 1.24 \cdot 10^{+14}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_1, \mathsf{fma}\left(t\_0, 0.16666666666666666, F\right), \mathsf{fma}\left(\mathsf{fma}\left(\left(-F\right) \cdot -0.019444444444444445, t\_1, x \cdot 0.022222222222222223\right), B \cdot B, 0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right)\right) - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(F, \frac{-1}{\mathsf{fma}\left(t\_0, -0.16666666666666666, F\right) \cdot B}, \frac{-x}{\tan B}\right)\\ \end{array} \end{array} \]
                                              (FPCore (F B x)
                                               :precision binary64
                                               (let* ((t_0 (* (* B B) F)) (t_1 (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
                                                 (if (<= B 1.24e+14)
                                                   (/
                                                    (-
                                                     (fma
                                                      t_1
                                                      (fma t_0 0.16666666666666666 F)
                                                      (*
                                                       (fma
                                                        (fma (* (- F) -0.019444444444444445) t_1 (* x 0.022222222222222223))
                                                        (* B B)
                                                        (* 0.3333333333333333 x))
                                                       (* B B)))
                                                     x)
                                                    B)
                                                   (fma
                                                    F
                                                    (/ -1.0 (* (fma t_0 -0.16666666666666666 F) B))
                                                    (/ (- x) (tan B))))))
                                              double code(double F, double B, double x) {
                                              	double t_0 = (B * B) * F;
                                              	double t_1 = sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0))));
                                              	double tmp;
                                              	if (B <= 1.24e+14) {
                                              		tmp = (fma(t_1, fma(t_0, 0.16666666666666666, F), (fma(fma((-F * -0.019444444444444445), t_1, (x * 0.022222222222222223)), (B * B), (0.3333333333333333 * x)) * (B * B))) - x) / B;
                                              	} else {
                                              		tmp = fma(F, (-1.0 / (fma(t_0, -0.16666666666666666, F) * B)), (-x / tan(B)));
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(F, B, x)
                                              	t_0 = Float64(Float64(B * B) * F)
                                              	t_1 = sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0))))
                                              	tmp = 0.0
                                              	if (B <= 1.24e+14)
                                              		tmp = Float64(Float64(fma(t_1, fma(t_0, 0.16666666666666666, F), Float64(fma(fma(Float64(Float64(-F) * -0.019444444444444445), t_1, Float64(x * 0.022222222222222223)), Float64(B * B), Float64(0.3333333333333333 * x)) * Float64(B * B))) - x) / B);
                                              	else
                                              		tmp = fma(F, Float64(-1.0 / Float64(fma(t_0, -0.16666666666666666, F) * B)), Float64(Float64(-x) / tan(B)));
                                              	end
                                              	return tmp
                                              end
                                              
                                              code[F_, B_, x_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] * F), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, 1.24e+14], N[(N[(N[(t$95$1 * N[(t$95$0 * 0.16666666666666666 + F), $MachinePrecision] + N[(N[(N[(N[((-F) * -0.019444444444444445), $MachinePrecision] * t$95$1 + N[(x * 0.022222222222222223), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(F * N[(-1.0 / N[(N[(t$95$0 * -0.16666666666666666 + F), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              t_0 := \left(B \cdot B\right) \cdot F\\
                                              t_1 := \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
                                              \mathbf{if}\;B \leq 1.24 \cdot 10^{+14}:\\
                                              \;\;\;\;\frac{\mathsf{fma}\left(t\_1, \mathsf{fma}\left(t\_0, 0.16666666666666666, F\right), \mathsf{fma}\left(\mathsf{fma}\left(\left(-F\right) \cdot -0.019444444444444445, t\_1, x \cdot 0.022222222222222223\right), B \cdot B, 0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right)\right) - x}{B}\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\mathsf{fma}\left(F, \frac{-1}{\mathsf{fma}\left(t\_0, -0.16666666666666666, F\right) \cdot B}, \frac{-x}{\tan B}\right)\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 2 regimes
                                              2. if B < 1.24e14

                                                1. Initial program 75.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{\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) + \left(\frac{1}{3} \cdot x + {B}^{2} \cdot \left(-1 \cdot \left(\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} \cdot \left(\frac{-1}{36} \cdot F + \frac{1}{120} \cdot F\right)\right) + \left(\frac{-1}{9} \cdot x + \frac{2}{15} \cdot x\right)\right)\right)\right)\right) - x}{B}} \]
                                                4. Applied rewrites63.5%

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

                                                if 1.24e14 < B

                                                1. Initial program 85.6%

                                                  \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
                                                2. Add Preprocessing
                                                3. Step-by-step derivation
                                                  1. lift-+.f64N/A

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

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

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

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

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

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

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

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

                                                  \[\leadsto \mathsf{fma}\left(F, \color{blue}{\frac{-1}{F \cdot \sin B}}, \frac{-x}{\tan B}\right) \]
                                                6. Step-by-step derivation
                                                  1. Applied rewrites54.8%

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

                                                    \[\leadsto \mathsf{fma}\left(F, \frac{-1}{B \cdot \color{blue}{\left(F + \frac{-1}{6} \cdot \left({B}^{2} \cdot F\right)\right)}}, \frac{-x}{\tan B}\right) \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites52.4%

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

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

                                                  Alternative 7: 55.7% accurate, 2.4× speedup?

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

                                                    1. Initial program 75.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{\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) + \left(\frac{1}{3} \cdot x + {B}^{2} \cdot \left(-1 \cdot \left(\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} \cdot \left(\frac{-1}{36} \cdot F + \frac{1}{120} \cdot F\right)\right) + \left(\frac{-1}{9} \cdot x + \frac{2}{15} \cdot x\right)\right)\right)\right)\right) - x}{B}} \]
                                                    4. Applied rewrites63.5%

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

                                                    if 1.24e14 < B

                                                    1. Initial program 85.6%

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

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

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

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

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

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

                                                      Alternative 8: 55.2% accurate, 2.4× speedup?

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

                                                        1. Initial program 75.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{\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) + \left(\frac{1}{3} \cdot x + {B}^{2} \cdot \left(-1 \cdot \left(\sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} \cdot \left(\frac{-1}{36} \cdot F + \frac{1}{120} \cdot F\right)\right) + \left(\frac{-1}{9} \cdot x + \frac{2}{15} \cdot x\right)\right)\right)\right)\right) - x}{B}} \]
                                                        4. Applied rewrites63.5%

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

                                                        if 1.24e14 < B

                                                        1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

                                                                \[\leadsto \frac{\color{blue}{-x}}{\tan B} + \frac{1}{B} \]
                                                              8. lift-/.f6442.6

                                                                \[\leadsto \color{blue}{\frac{-x}{\tan B}} + \frac{1}{B} \]
                                                            3. Applied rewrites42.6%

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

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

                                                          Alternative 9: 58.2% accurate, 2.6× speedup?

                                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -2 \cdot 10^{+90}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 58:\\ \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\sin B}\\ \end{array} \end{array} \]
                                                          (FPCore (F B x)
                                                           :precision binary64
                                                           (if (<= F -2e+90)
                                                             (/ (- -1.0 x) B)
                                                             (if (<= F 58.0)
                                                               (/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
                                                               (+ (- (/ x B)) (/ 1.0 (sin B))))))
                                                          double code(double F, double B, double x) {
                                                          	double tmp;
                                                          	if (F <= -2e+90) {
                                                          		tmp = (-1.0 - x) / B;
                                                          	} else if (F <= 58.0) {
                                                          		tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
                                                          	} else {
                                                          		tmp = -(x / B) + (1.0 / sin(B));
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          function code(F, B, x)
                                                          	tmp = 0.0
                                                          	if (F <= -2e+90)
                                                          		tmp = Float64(Float64(-1.0 - x) / B);
                                                          	elseif (F <= 58.0)
                                                          		tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B);
                                                          	else
                                                          		tmp = Float64(Float64(-Float64(x / B)) + Float64(1.0 / sin(B)));
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          code[F_, B_, x_] := If[LessEqual[F, -2e+90], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 58.0], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          \mathbf{if}\;F \leq -2 \cdot 10^{+90}:\\
                                                          \;\;\;\;\frac{-1 - x}{B}\\
                                                          
                                                          \mathbf{elif}\;F \leq 58:\\
                                                          \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\sin B}\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 3 regimes
                                                          2. if F < -1.99999999999999993e90

                                                            1. Initial program 49.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. Applied rewrites29.9%

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

                                                                \[\leadsto \frac{-1 - x}{B} \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites47.6%

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

                                                                if -1.99999999999999993e90 < F < 58

                                                                1. Initial program 98.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. Applied rewrites55.8%

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

                                                                  if 58 < F

                                                                  1. Initial program 60.0%

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

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

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

                                                                      \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{1}{\sin B} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites81.0%

                                                                        \[\leadsto \left(-\color{blue}{\frac{x}{B}}\right) + \frac{1}{\sin B} \]
                                                                    4. Recombined 3 regimes into one program.
                                                                    5. Add Preprocessing

                                                                    Alternative 10: 55.2% accurate, 2.7× speedup?

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

                                                                      1. Initial program 75.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{\left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} + {B}^{2} \cdot \left(\frac{1}{6} \cdot \left(F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}}\right) + \frac{1}{3} \cdot x\right)\right) - x}{B}} \]
                                                                      4. Applied rewrites63.5%

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

                                                                      if 1.24e14 < B

                                                                      1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

                                                                              \[\leadsto \frac{\color{blue}{-x}}{\tan B} + \frac{1}{B} \]
                                                                            8. lift-/.f6442.6

                                                                              \[\leadsto \color{blue}{\frac{-x}{\tan B}} + \frac{1}{B} \]
                                                                          3. Applied rewrites42.6%

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

                                                                        Alternative 11: 51.1% accurate, 5.7× speedup?

                                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -5 \cdot 10^{+105}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 6.8 \cdot 10^{+78}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{\mathsf{fma}\left(\left(B \cdot B\right) \cdot x, -0.3333333333333333, x\right)}{B}\right) + \frac{1}{B}\\ \end{array} \end{array} \]
                                                                        (FPCore (F B x)
                                                                         :precision binary64
                                                                         (if (<= F -5e+105)
                                                                           (/ (- -1.0 x) B)
                                                                           (if (<= F 6.8e+78)
                                                                             (/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
                                                                             (+ (- (/ (fma (* (* B B) x) -0.3333333333333333 x) B)) (/ 1.0 B)))))
                                                                        double code(double F, double B, double x) {
                                                                        	double tmp;
                                                                        	if (F <= -5e+105) {
                                                                        		tmp = (-1.0 - x) / B;
                                                                        	} else if (F <= 6.8e+78) {
                                                                        		tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
                                                                        	} else {
                                                                        		tmp = -(fma(((B * B) * x), -0.3333333333333333, x) / B) + (1.0 / B);
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        function code(F, B, x)
                                                                        	tmp = 0.0
                                                                        	if (F <= -5e+105)
                                                                        		tmp = Float64(Float64(-1.0 - x) / B);
                                                                        	elseif (F <= 6.8e+78)
                                                                        		tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B);
                                                                        	else
                                                                        		tmp = Float64(Float64(-Float64(fma(Float64(Float64(B * B) * x), -0.3333333333333333, x) / B)) + Float64(1.0 / B));
                                                                        	end
                                                                        	return tmp
                                                                        end
                                                                        
                                                                        code[F_, B_, x_] := If[LessEqual[F, -5e+105], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 6.8e+78], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(N[(N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision] / B), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]
                                                                        
                                                                        \begin{array}{l}
                                                                        
                                                                        \\
                                                                        \begin{array}{l}
                                                                        \mathbf{if}\;F \leq -5 \cdot 10^{+105}:\\
                                                                        \;\;\;\;\frac{-1 - x}{B}\\
                                                                        
                                                                        \mathbf{elif}\;F \leq 6.8 \cdot 10^{+78}:\\
                                                                        \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;\left(-\frac{\mathsf{fma}\left(\left(B \cdot B\right) \cdot x, -0.3333333333333333, x\right)}{B}\right) + \frac{1}{B}\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 3 regimes
                                                                        2. if F < -5.00000000000000046e105

                                                                          1. Initial program 47.0%

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

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

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

                                                                              \[\leadsto \frac{-1 - x}{B} \]
                                                                            3. Step-by-step derivation
                                                                              1. Applied rewrites48.4%

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

                                                                              if -5.00000000000000046e105 < F < 6.80000000000000014e78

                                                                              1. Initial program 98.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. Applied rewrites57.1%

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

                                                                                if 6.80000000000000014e78 < F

                                                                                1. Initial program 48.5%

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

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

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

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

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

                                                                                      \[\leadsto \left(-\color{blue}{\frac{x + \frac{-1}{3} \cdot \left({B}^{2} \cdot x\right)}{B}}\right) + \frac{1}{B} \]
                                                                                    3. Step-by-step derivation
                                                                                      1. Applied rewrites63.9%

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

                                                                                    Alternative 12: 50.8% accurate, 6.0× speedup?

                                                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.4:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.5}{F}, \frac{\mathsf{fma}\left(2, x, 2\right)}{F}, 1\right) - x}{B}\\ \end{array} \end{array} \]
                                                                                    (FPCore (F B x)
                                                                                     :precision binary64
                                                                                     (if (<= F -1.4)
                                                                                       (/ (- -1.0 x) B)
                                                                                       (if (<= F 5.8e-6)
                                                                                         (/ (- (* (sqrt (/ 1.0 (fma 2.0 x 2.0))) F) x) B)
                                                                                         (/ (- (fma (/ -0.5 F) (/ (fma 2.0 x 2.0) F) 1.0) x) B))))
                                                                                    double code(double F, double B, double x) {
                                                                                    	double tmp;
                                                                                    	if (F <= -1.4) {
                                                                                    		tmp = (-1.0 - x) / B;
                                                                                    	} else if (F <= 5.8e-6) {
                                                                                    		tmp = ((sqrt((1.0 / fma(2.0, x, 2.0))) * F) - x) / B;
                                                                                    	} else {
                                                                                    		tmp = (fma((-0.5 / F), (fma(2.0, x, 2.0) / F), 1.0) - x) / B;
                                                                                    	}
                                                                                    	return tmp;
                                                                                    }
                                                                                    
                                                                                    function code(F, B, x)
                                                                                    	tmp = 0.0
                                                                                    	if (F <= -1.4)
                                                                                    		tmp = Float64(Float64(-1.0 - x) / B);
                                                                                    	elseif (F <= 5.8e-6)
                                                                                    		tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, 2.0))) * F) - x) / B);
                                                                                    	else
                                                                                    		tmp = Float64(Float64(fma(Float64(-0.5 / F), Float64(fma(2.0, x, 2.0) / F), 1.0) - x) / B);
                                                                                    	end
                                                                                    	return tmp
                                                                                    end
                                                                                    
                                                                                    code[F_, B_, x_] := If[LessEqual[F, -1.4], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.8e-6], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(-0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
                                                                                    
                                                                                    \begin{array}{l}
                                                                                    
                                                                                    \\
                                                                                    \begin{array}{l}
                                                                                    \mathbf{if}\;F \leq -1.4:\\
                                                                                    \;\;\;\;\frac{-1 - x}{B}\\
                                                                                    
                                                                                    \mathbf{elif}\;F \leq 5.8 \cdot 10^{-6}:\\
                                                                                    \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\
                                                                                    
                                                                                    \mathbf{else}:\\
                                                                                    \;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.5}{F}, \frac{\mathsf{fma}\left(2, x, 2\right)}{F}, 1\right) - x}{B}\\
                                                                                    
                                                                                    
                                                                                    \end{array}
                                                                                    \end{array}
                                                                                    
                                                                                    Derivation
                                                                                    1. Split input into 3 regimes
                                                                                    2. if F < -1.3999999999999999

                                                                                      1. Initial program 56.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. Applied rewrites36.7%

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

                                                                                          \[\leadsto \frac{-1 - x}{B} \]
                                                                                        3. Step-by-step derivation
                                                                                          1. Applied rewrites51.3%

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

                                                                                          if -1.3999999999999999 < F < 5.8000000000000004e-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. 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. Applied rewrites55.0%

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

                                                                                              \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                                                                                            3. Step-by-step derivation
                                                                                              1. Applied rewrites55.0%

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

                                                                                              if 5.8000000000000004e-6 < F

                                                                                              1. Initial program 60.6%

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

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

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

                                                                                                  \[\leadsto \frac{\left(1 + \frac{-1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}}\right) - x}{B} \]
                                                                                                3. Step-by-step derivation
                                                                                                  1. Applied rewrites65.0%

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

                                                                                                Alternative 13: 51.0% accurate, 6.1× speedup?

                                                                                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.65 \cdot 10^{+161}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 7.8 \cdot 10^{+79}:\\ \;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{\mathsf{fma}\left(\left(B \cdot B\right) \cdot x, -0.3333333333333333, x\right)}{B}\right) + \frac{1}{B}\\ \end{array} \end{array} \]
                                                                                                (FPCore (F B x)
                                                                                                 :precision binary64
                                                                                                 (if (<= F -1.65e+161)
                                                                                                   (/ (- -1.0 x) B)
                                                                                                   (if (<= F 7.8e+79)
                                                                                                     (/ (- (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) x) B)
                                                                                                     (+ (- (/ (fma (* (* B B) x) -0.3333333333333333 x) B)) (/ 1.0 B)))))
                                                                                                double code(double F, double B, double x) {
                                                                                                	double tmp;
                                                                                                	if (F <= -1.65e+161) {
                                                                                                		tmp = (-1.0 - x) / B;
                                                                                                	} else if (F <= 7.8e+79) {
                                                                                                		tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B;
                                                                                                	} else {
                                                                                                		tmp = -(fma(((B * B) * x), -0.3333333333333333, x) / B) + (1.0 / B);
                                                                                                	}
                                                                                                	return tmp;
                                                                                                }
                                                                                                
                                                                                                function code(F, B, x)
                                                                                                	tmp = 0.0
                                                                                                	if (F <= -1.65e+161)
                                                                                                		tmp = Float64(Float64(-1.0 - x) / B);
                                                                                                	elseif (F <= 7.8e+79)
                                                                                                		tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B);
                                                                                                	else
                                                                                                		tmp = Float64(Float64(-Float64(fma(Float64(Float64(B * B) * x), -0.3333333333333333, x) / B)) + Float64(1.0 / B));
                                                                                                	end
                                                                                                	return tmp
                                                                                                end
                                                                                                
                                                                                                code[F_, B_, x_] := If[LessEqual[F, -1.65e+161], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.8e+79], N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(N[(N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision] / B), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]
                                                                                                
                                                                                                \begin{array}{l}
                                                                                                
                                                                                                \\
                                                                                                \begin{array}{l}
                                                                                                \mathbf{if}\;F \leq -1.65 \cdot 10^{+161}:\\
                                                                                                \;\;\;\;\frac{-1 - x}{B}\\
                                                                                                
                                                                                                \mathbf{elif}\;F \leq 7.8 \cdot 10^{+79}:\\
                                                                                                \;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
                                                                                                
                                                                                                \mathbf{else}:\\
                                                                                                \;\;\;\;\left(-\frac{\mathsf{fma}\left(\left(B \cdot B\right) \cdot x, -0.3333333333333333, x\right)}{B}\right) + \frac{1}{B}\\
                                                                                                
                                                                                                
                                                                                                \end{array}
                                                                                                \end{array}
                                                                                                
                                                                                                Derivation
                                                                                                1. Split input into 3 regimes
                                                                                                2. if F < -1.64999999999999999e161

                                                                                                  1. Initial program 33.6%

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

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

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

                                                                                                      \[\leadsto \frac{-1 - x}{B} \]
                                                                                                    3. Step-by-step derivation
                                                                                                      1. Applied rewrites52.2%

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

                                                                                                      if -1.64999999999999999e161 < F < 7.7999999999999994e79

                                                                                                      1. Initial program 97.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. Applied rewrites55.5%

                                                                                                          \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}} \]
                                                                                                        2. Step-by-step derivation
                                                                                                          1. Applied rewrites55.5%

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

                                                                                                          if 7.7999999999999994e79 < F

                                                                                                          1. Initial program 48.5%

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

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

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

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

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

                                                                                                                \[\leadsto \left(-\color{blue}{\frac{x + \frac{-1}{3} \cdot \left({B}^{2} \cdot x\right)}{B}}\right) + \frac{1}{B} \]
                                                                                                              3. Step-by-step derivation
                                                                                                                1. Applied rewrites63.9%

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

                                                                                                                \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.65 \cdot 10^{+161}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 7.8 \cdot 10^{+79}:\\ \;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{\mathsf{fma}\left(\left(B \cdot B\right) \cdot x, -0.3333333333333333, x\right)}{B}\right) + \frac{1}{B}\\ \end{array} \]
                                                                                                              6. Add Preprocessing

                                                                                                              Alternative 14: 50.9% accurate, 6.2× speedup?

                                                                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.4:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 5.8 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
                                                                                                              (FPCore (F B x)
                                                                                                               :precision binary64
                                                                                                               (if (<= F -1.4)
                                                                                                                 (/ (- -1.0 x) B)
                                                                                                                 (if (<= F 5.8e-6)
                                                                                                                   (/ (- (* (sqrt (/ 1.0 (fma 2.0 x 2.0))) F) x) B)
                                                                                                                   (/ (- 1.0 x) B))))
                                                                                                              double code(double F, double B, double x) {
                                                                                                              	double tmp;
                                                                                                              	if (F <= -1.4) {
                                                                                                              		tmp = (-1.0 - x) / B;
                                                                                                              	} else if (F <= 5.8e-6) {
                                                                                                              		tmp = ((sqrt((1.0 / fma(2.0, x, 2.0))) * F) - x) / B;
                                                                                                              	} else {
                                                                                                              		tmp = (1.0 - x) / B;
                                                                                                              	}
                                                                                                              	return tmp;
                                                                                                              }
                                                                                                              
                                                                                                              function code(F, B, x)
                                                                                                              	tmp = 0.0
                                                                                                              	if (F <= -1.4)
                                                                                                              		tmp = Float64(Float64(-1.0 - x) / B);
                                                                                                              	elseif (F <= 5.8e-6)
                                                                                                              		tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, 2.0))) * F) - x) / B);
                                                                                                              	else
                                                                                                              		tmp = Float64(Float64(1.0 - x) / B);
                                                                                                              	end
                                                                                                              	return tmp
                                                                                                              end
                                                                                                              
                                                                                                              code[F_, B_, x_] := If[LessEqual[F, -1.4], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.8e-6], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
                                                                                                              
                                                                                                              \begin{array}{l}
                                                                                                              
                                                                                                              \\
                                                                                                              \begin{array}{l}
                                                                                                              \mathbf{if}\;F \leq -1.4:\\
                                                                                                              \;\;\;\;\frac{-1 - x}{B}\\
                                                                                                              
                                                                                                              \mathbf{elif}\;F \leq 5.8 \cdot 10^{-6}:\\
                                                                                                              \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\
                                                                                                              
                                                                                                              \mathbf{else}:\\
                                                                                                              \;\;\;\;\frac{1 - x}{B}\\
                                                                                                              
                                                                                                              
                                                                                                              \end{array}
                                                                                                              \end{array}
                                                                                                              
                                                                                                              Derivation
                                                                                                              1. Split input into 3 regimes
                                                                                                              2. if F < -1.3999999999999999

                                                                                                                1. Initial program 56.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. Applied rewrites36.7%

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

                                                                                                                    \[\leadsto \frac{-1 - x}{B} \]
                                                                                                                  3. Step-by-step derivation
                                                                                                                    1. Applied rewrites51.3%

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

                                                                                                                    if -1.3999999999999999 < F < 5.8000000000000004e-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. 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. Applied rewrites55.0%

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

                                                                                                                        \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                                                                                                                      3. Step-by-step derivation
                                                                                                                        1. Applied rewrites55.0%

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

                                                                                                                        if 5.8000000000000004e-6 < F

                                                                                                                        1. Initial program 60.6%

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

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

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

                                                                                                                            \[\leadsto \frac{1 - x}{B} \]
                                                                                                                          3. Step-by-step derivation
                                                                                                                            1. Applied rewrites65.0%

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

                                                                                                                          Alternative 15: 43.4% accurate, 13.6× speedup?

                                                                                                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.45 \cdot 10^{-35}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.45 \cdot 10^{-68}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - x}{B}\\ \end{array} \end{array} \]
                                                                                                                          (FPCore (F B x)
                                                                                                                           :precision binary64
                                                                                                                           (if (<= F -1.45e-35)
                                                                                                                             (/ (- -1.0 x) B)
                                                                                                                             (if (<= F 1.45e-68) (/ (- x) B) (/ (- 1.0 x) B))))
                                                                                                                          double code(double F, double B, double x) {
                                                                                                                          	double tmp;
                                                                                                                          	if (F <= -1.45e-35) {
                                                                                                                          		tmp = (-1.0 - x) / B;
                                                                                                                          	} else if (F <= 1.45e-68) {
                                                                                                                          		tmp = -x / B;
                                                                                                                          	} else {
                                                                                                                          		tmp = (1.0 - x) / B;
                                                                                                                          	}
                                                                                                                          	return tmp;
                                                                                                                          }
                                                                                                                          
                                                                                                                          module fmin_fmax_functions
                                                                                                                              implicit none
                                                                                                                              private
                                                                                                                              public fmax
                                                                                                                              public fmin
                                                                                                                          
                                                                                                                              interface fmax
                                                                                                                                  module procedure fmax88
                                                                                                                                  module procedure fmax44
                                                                                                                                  module procedure fmax84
                                                                                                                                  module procedure fmax48
                                                                                                                              end interface
                                                                                                                              interface fmin
                                                                                                                                  module procedure fmin88
                                                                                                                                  module procedure fmin44
                                                                                                                                  module procedure fmin84
                                                                                                                                  module procedure fmin48
                                                                                                                              end interface
                                                                                                                          contains
                                                                                                                              real(8) function fmax88(x, y) result (res)
                                                                                                                                  real(8), intent (in) :: x
                                                                                                                                  real(8), intent (in) :: y
                                                                                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                                              end function
                                                                                                                              real(4) function fmax44(x, y) result (res)
                                                                                                                                  real(4), intent (in) :: x
                                                                                                                                  real(4), intent (in) :: y
                                                                                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                                              end function
                                                                                                                              real(8) function fmax84(x, y) result(res)
                                                                                                                                  real(8), intent (in) :: x
                                                                                                                                  real(4), intent (in) :: y
                                                                                                                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                                                                              end function
                                                                                                                              real(8) function fmax48(x, y) result(res)
                                                                                                                                  real(4), intent (in) :: x
                                                                                                                                  real(8), intent (in) :: y
                                                                                                                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                                                                              end function
                                                                                                                              real(8) function fmin88(x, y) result (res)
                                                                                                                                  real(8), intent (in) :: x
                                                                                                                                  real(8), intent (in) :: y
                                                                                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                                              end function
                                                                                                                              real(4) function fmin44(x, y) result (res)
                                                                                                                                  real(4), intent (in) :: x
                                                                                                                                  real(4), intent (in) :: y
                                                                                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                                              end function
                                                                                                                              real(8) function fmin84(x, y) result(res)
                                                                                                                                  real(8), intent (in) :: x
                                                                                                                                  real(4), intent (in) :: y
                                                                                                                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                                                                              end function
                                                                                                                              real(8) function fmin48(x, y) result(res)
                                                                                                                                  real(4), intent (in) :: x
                                                                                                                                  real(8), intent (in) :: y
                                                                                                                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                                                                              end function
                                                                                                                          end module
                                                                                                                          
                                                                                                                          real(8) function code(f, b, x)
                                                                                                                          use fmin_fmax_functions
                                                                                                                              real(8), intent (in) :: f
                                                                                                                              real(8), intent (in) :: b
                                                                                                                              real(8), intent (in) :: x
                                                                                                                              real(8) :: tmp
                                                                                                                              if (f <= (-1.45d-35)) then
                                                                                                                                  tmp = ((-1.0d0) - x) / b
                                                                                                                              else if (f <= 1.45d-68) then
                                                                                                                                  tmp = -x / b
                                                                                                                              else
                                                                                                                                  tmp = (1.0d0 - x) / b
                                                                                                                              end if
                                                                                                                              code = tmp
                                                                                                                          end function
                                                                                                                          
                                                                                                                          public static double code(double F, double B, double x) {
                                                                                                                          	double tmp;
                                                                                                                          	if (F <= -1.45e-35) {
                                                                                                                          		tmp = (-1.0 - x) / B;
                                                                                                                          	} else if (F <= 1.45e-68) {
                                                                                                                          		tmp = -x / B;
                                                                                                                          	} else {
                                                                                                                          		tmp = (1.0 - x) / B;
                                                                                                                          	}
                                                                                                                          	return tmp;
                                                                                                                          }
                                                                                                                          
                                                                                                                          def code(F, B, x):
                                                                                                                          	tmp = 0
                                                                                                                          	if F <= -1.45e-35:
                                                                                                                          		tmp = (-1.0 - x) / B
                                                                                                                          	elif F <= 1.45e-68:
                                                                                                                          		tmp = -x / B
                                                                                                                          	else:
                                                                                                                          		tmp = (1.0 - x) / B
                                                                                                                          	return tmp
                                                                                                                          
                                                                                                                          function code(F, B, x)
                                                                                                                          	tmp = 0.0
                                                                                                                          	if (F <= -1.45e-35)
                                                                                                                          		tmp = Float64(Float64(-1.0 - x) / B);
                                                                                                                          	elseif (F <= 1.45e-68)
                                                                                                                          		tmp = Float64(Float64(-x) / B);
                                                                                                                          	else
                                                                                                                          		tmp = Float64(Float64(1.0 - x) / B);
                                                                                                                          	end
                                                                                                                          	return tmp
                                                                                                                          end
                                                                                                                          
                                                                                                                          function tmp_2 = code(F, B, x)
                                                                                                                          	tmp = 0.0;
                                                                                                                          	if (F <= -1.45e-35)
                                                                                                                          		tmp = (-1.0 - x) / B;
                                                                                                                          	elseif (F <= 1.45e-68)
                                                                                                                          		tmp = -x / B;
                                                                                                                          	else
                                                                                                                          		tmp = (1.0 - x) / B;
                                                                                                                          	end
                                                                                                                          	tmp_2 = tmp;
                                                                                                                          end
                                                                                                                          
                                                                                                                          code[F_, B_, x_] := If[LessEqual[F, -1.45e-35], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.45e-68], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
                                                                                                                          
                                                                                                                          \begin{array}{l}
                                                                                                                          
                                                                                                                          \\
                                                                                                                          \begin{array}{l}
                                                                                                                          \mathbf{if}\;F \leq -1.45 \cdot 10^{-35}:\\
                                                                                                                          \;\;\;\;\frac{-1 - x}{B}\\
                                                                                                                          
                                                                                                                          \mathbf{elif}\;F \leq 1.45 \cdot 10^{-68}:\\
                                                                                                                          \;\;\;\;\frac{-x}{B}\\
                                                                                                                          
                                                                                                                          \mathbf{else}:\\
                                                                                                                          \;\;\;\;\frac{1 - x}{B}\\
                                                                                                                          
                                                                                                                          
                                                                                                                          \end{array}
                                                                                                                          \end{array}
                                                                                                                          
                                                                                                                          Derivation
                                                                                                                          1. Split input into 3 regimes
                                                                                                                          2. if F < -1.4500000000000001e-35

                                                                                                                            1. Initial program 60.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. Applied rewrites41.1%

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

                                                                                                                                \[\leadsto \frac{-1 - x}{B} \]
                                                                                                                              3. Step-by-step derivation
                                                                                                                                1. Applied rewrites48.5%

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

                                                                                                                                if -1.4500000000000001e-35 < F < 1.45e-68

                                                                                                                                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. Applied rewrites55.2%

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

                                                                                                                                    \[\leadsto \frac{-1 \cdot x}{B} \]
                                                                                                                                  3. Step-by-step derivation
                                                                                                                                    1. Applied rewrites42.3%

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

                                                                                                                                    if 1.45e-68 < F

                                                                                                                                    1. Initial program 63.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. Applied rewrites54.4%

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

                                                                                                                                        \[\leadsto \frac{1 - x}{B} \]
                                                                                                                                      3. Step-by-step derivation
                                                                                                                                        1. Applied rewrites60.1%

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

                                                                                                                                      Alternative 16: 36.2% accurate, 17.5× speedup?

                                                                                                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.45 \cdot 10^{-35}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \end{array} \]
                                                                                                                                      (FPCore (F B x)
                                                                                                                                       :precision binary64
                                                                                                                                       (if (<= F -1.45e-35) (/ (- -1.0 x) B) (/ (- x) B)))
                                                                                                                                      double code(double F, double B, double x) {
                                                                                                                                      	double tmp;
                                                                                                                                      	if (F <= -1.45e-35) {
                                                                                                                                      		tmp = (-1.0 - x) / B;
                                                                                                                                      	} else {
                                                                                                                                      		tmp = -x / B;
                                                                                                                                      	}
                                                                                                                                      	return tmp;
                                                                                                                                      }
                                                                                                                                      
                                                                                                                                      module fmin_fmax_functions
                                                                                                                                          implicit none
                                                                                                                                          private
                                                                                                                                          public fmax
                                                                                                                                          public fmin
                                                                                                                                      
                                                                                                                                          interface fmax
                                                                                                                                              module procedure fmax88
                                                                                                                                              module procedure fmax44
                                                                                                                                              module procedure fmax84
                                                                                                                                              module procedure fmax48
                                                                                                                                          end interface
                                                                                                                                          interface fmin
                                                                                                                                              module procedure fmin88
                                                                                                                                              module procedure fmin44
                                                                                                                                              module procedure fmin84
                                                                                                                                              module procedure fmin48
                                                                                                                                          end interface
                                                                                                                                      contains
                                                                                                                                          real(8) function fmax88(x, y) result (res)
                                                                                                                                              real(8), intent (in) :: x
                                                                                                                                              real(8), intent (in) :: y
                                                                                                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                                                          end function
                                                                                                                                          real(4) function fmax44(x, y) result (res)
                                                                                                                                              real(4), intent (in) :: x
                                                                                                                                              real(4), intent (in) :: y
                                                                                                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                                                          end function
                                                                                                                                          real(8) function fmax84(x, y) result(res)
                                                                                                                                              real(8), intent (in) :: x
                                                                                                                                              real(4), intent (in) :: y
                                                                                                                                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                                                                                          end function
                                                                                                                                          real(8) function fmax48(x, y) result(res)
                                                                                                                                              real(4), intent (in) :: x
                                                                                                                                              real(8), intent (in) :: y
                                                                                                                                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                                                                                          end function
                                                                                                                                          real(8) function fmin88(x, y) result (res)
                                                                                                                                              real(8), intent (in) :: x
                                                                                                                                              real(8), intent (in) :: y
                                                                                                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                                                          end function
                                                                                                                                          real(4) function fmin44(x, y) result (res)
                                                                                                                                              real(4), intent (in) :: x
                                                                                                                                              real(4), intent (in) :: y
                                                                                                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                                                          end function
                                                                                                                                          real(8) function fmin84(x, y) result(res)
                                                                                                                                              real(8), intent (in) :: x
                                                                                                                                              real(4), intent (in) :: y
                                                                                                                                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                                                                                          end function
                                                                                                                                          real(8) function fmin48(x, y) result(res)
                                                                                                                                              real(4), intent (in) :: x
                                                                                                                                              real(8), intent (in) :: y
                                                                                                                                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                                                                                          end function
                                                                                                                                      end module
                                                                                                                                      
                                                                                                                                      real(8) function code(f, b, x)
                                                                                                                                      use fmin_fmax_functions
                                                                                                                                          real(8), intent (in) :: f
                                                                                                                                          real(8), intent (in) :: b
                                                                                                                                          real(8), intent (in) :: x
                                                                                                                                          real(8) :: tmp
                                                                                                                                          if (f <= (-1.45d-35)) then
                                                                                                                                              tmp = ((-1.0d0) - x) / b
                                                                                                                                          else
                                                                                                                                              tmp = -x / b
                                                                                                                                          end if
                                                                                                                                          code = tmp
                                                                                                                                      end function
                                                                                                                                      
                                                                                                                                      public static double code(double F, double B, double x) {
                                                                                                                                      	double tmp;
                                                                                                                                      	if (F <= -1.45e-35) {
                                                                                                                                      		tmp = (-1.0 - x) / B;
                                                                                                                                      	} else {
                                                                                                                                      		tmp = -x / B;
                                                                                                                                      	}
                                                                                                                                      	return tmp;
                                                                                                                                      }
                                                                                                                                      
                                                                                                                                      def code(F, B, x):
                                                                                                                                      	tmp = 0
                                                                                                                                      	if F <= -1.45e-35:
                                                                                                                                      		tmp = (-1.0 - x) / B
                                                                                                                                      	else:
                                                                                                                                      		tmp = -x / B
                                                                                                                                      	return tmp
                                                                                                                                      
                                                                                                                                      function code(F, B, x)
                                                                                                                                      	tmp = 0.0
                                                                                                                                      	if (F <= -1.45e-35)
                                                                                                                                      		tmp = Float64(Float64(-1.0 - x) / B);
                                                                                                                                      	else
                                                                                                                                      		tmp = Float64(Float64(-x) / B);
                                                                                                                                      	end
                                                                                                                                      	return tmp
                                                                                                                                      end
                                                                                                                                      
                                                                                                                                      function tmp_2 = code(F, B, x)
                                                                                                                                      	tmp = 0.0;
                                                                                                                                      	if (F <= -1.45e-35)
                                                                                                                                      		tmp = (-1.0 - x) / B;
                                                                                                                                      	else
                                                                                                                                      		tmp = -x / B;
                                                                                                                                      	end
                                                                                                                                      	tmp_2 = tmp;
                                                                                                                                      end
                                                                                                                                      
                                                                                                                                      code[F_, B_, x_] := If[LessEqual[F, -1.45e-35], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
                                                                                                                                      
                                                                                                                                      \begin{array}{l}
                                                                                                                                      
                                                                                                                                      \\
                                                                                                                                      \begin{array}{l}
                                                                                                                                      \mathbf{if}\;F \leq -1.45 \cdot 10^{-35}:\\
                                                                                                                                      \;\;\;\;\frac{-1 - x}{B}\\
                                                                                                                                      
                                                                                                                                      \mathbf{else}:\\
                                                                                                                                      \;\;\;\;\frac{-x}{B}\\
                                                                                                                                      
                                                                                                                                      
                                                                                                                                      \end{array}
                                                                                                                                      \end{array}
                                                                                                                                      
                                                                                                                                      Derivation
                                                                                                                                      1. Split input into 2 regimes
                                                                                                                                      2. if F < -1.4500000000000001e-35

                                                                                                                                        1. Initial program 60.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. Applied rewrites41.1%

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

                                                                                                                                            \[\leadsto \frac{-1 - x}{B} \]
                                                                                                                                          3. Step-by-step derivation
                                                                                                                                            1. Applied rewrites48.5%

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

                                                                                                                                            if -1.4500000000000001e-35 < F

                                                                                                                                            1. Initial program 85.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. Applied rewrites54.9%

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

                                                                                                                                                \[\leadsto \frac{-1 \cdot x}{B} \]
                                                                                                                                              3. Step-by-step derivation
                                                                                                                                                1. Applied rewrites37.8%

                                                                                                                                                  \[\leadsto \frac{-x}{B} \]
                                                                                                                                              4. Recombined 2 regimes into one program.
                                                                                                                                              5. Add Preprocessing

                                                                                                                                              Alternative 17: 29.2% accurate, 26.3× speedup?

                                                                                                                                              \[\begin{array}{l} \\ \frac{-x}{B} \end{array} \]
                                                                                                                                              (FPCore (F B x) :precision binary64 (/ (- x) B))
                                                                                                                                              double code(double F, double B, double x) {
                                                                                                                                              	return -x / B;
                                                                                                                                              }
                                                                                                                                              
                                                                                                                                              module fmin_fmax_functions
                                                                                                                                                  implicit none
                                                                                                                                                  private
                                                                                                                                                  public fmax
                                                                                                                                                  public fmin
                                                                                                                                              
                                                                                                                                                  interface fmax
                                                                                                                                                      module procedure fmax88
                                                                                                                                                      module procedure fmax44
                                                                                                                                                      module procedure fmax84
                                                                                                                                                      module procedure fmax48
                                                                                                                                                  end interface
                                                                                                                                                  interface fmin
                                                                                                                                                      module procedure fmin88
                                                                                                                                                      module procedure fmin44
                                                                                                                                                      module procedure fmin84
                                                                                                                                                      module procedure fmin48
                                                                                                                                                  end interface
                                                                                                                                              contains
                                                                                                                                                  real(8) function fmax88(x, y) result (res)
                                                                                                                                                      real(8), intent (in) :: x
                                                                                                                                                      real(8), intent (in) :: y
                                                                                                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                                                                  end function
                                                                                                                                                  real(4) function fmax44(x, y) result (res)
                                                                                                                                                      real(4), intent (in) :: x
                                                                                                                                                      real(4), intent (in) :: y
                                                                                                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                                                                  end function
                                                                                                                                                  real(8) function fmax84(x, y) result(res)
                                                                                                                                                      real(8), intent (in) :: x
                                                                                                                                                      real(4), intent (in) :: y
                                                                                                                                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                                                                                                  end function
                                                                                                                                                  real(8) function fmax48(x, y) result(res)
                                                                                                                                                      real(4), intent (in) :: x
                                                                                                                                                      real(8), intent (in) :: y
                                                                                                                                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                                                                                                  end function
                                                                                                                                                  real(8) function fmin88(x, y) result (res)
                                                                                                                                                      real(8), intent (in) :: x
                                                                                                                                                      real(8), intent (in) :: y
                                                                                                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                                                                  end function
                                                                                                                                                  real(4) function fmin44(x, y) result (res)
                                                                                                                                                      real(4), intent (in) :: x
                                                                                                                                                      real(4), intent (in) :: y
                                                                                                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                                                                  end function
                                                                                                                                                  real(8) function fmin84(x, y) result(res)
                                                                                                                                                      real(8), intent (in) :: x
                                                                                                                                                      real(4), intent (in) :: y
                                                                                                                                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                                                                                                  end function
                                                                                                                                                  real(8) function fmin48(x, y) result(res)
                                                                                                                                                      real(4), intent (in) :: x
                                                                                                                                                      real(8), intent (in) :: y
                                                                                                                                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                                                                                                  end function
                                                                                                                                              end module
                                                                                                                                              
                                                                                                                                              real(8) function code(f, b, x)
                                                                                                                                              use fmin_fmax_functions
                                                                                                                                                  real(8), intent (in) :: f
                                                                                                                                                  real(8), intent (in) :: b
                                                                                                                                                  real(8), intent (in) :: x
                                                                                                                                                  code = -x / b
                                                                                                                                              end function
                                                                                                                                              
                                                                                                                                              public static double code(double F, double B, double x) {
                                                                                                                                              	return -x / B;
                                                                                                                                              }
                                                                                                                                              
                                                                                                                                              def code(F, B, x):
                                                                                                                                              	return -x / B
                                                                                                                                              
                                                                                                                                              function code(F, B, x)
                                                                                                                                              	return Float64(Float64(-x) / B)
                                                                                                                                              end
                                                                                                                                              
                                                                                                                                              function tmp = code(F, B, x)
                                                                                                                                              	tmp = -x / B;
                                                                                                                                              end
                                                                                                                                              
                                                                                                                                              code[F_, B_, x_] := N[((-x) / B), $MachinePrecision]
                                                                                                                                              
                                                                                                                                              \begin{array}{l}
                                                                                                                                              
                                                                                                                                              \\
                                                                                                                                              \frac{-x}{B}
                                                                                                                                              \end{array}
                                                                                                                                              
                                                                                                                                              Derivation
                                                                                                                                              1. Initial program 78.0%

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

                                                                                                                                                \[\leadsto \color{blue}{\frac{F \cdot \sqrt{\frac{1}{2 + \left(2 \cdot x + {F}^{2}\right)}} - x}{B}} \]
                                                                                                                                              4. Step-by-step derivation
                                                                                                                                                1. Applied rewrites50.9%

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

                                                                                                                                                  \[\leadsto \frac{-1 \cdot x}{B} \]
                                                                                                                                                3. Step-by-step derivation
                                                                                                                                                  1. Applied rewrites33.2%

                                                                                                                                                    \[\leadsto \frac{-x}{B} \]
                                                                                                                                                  2. Add Preprocessing

                                                                                                                                                  Reproduce

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