VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.7% → 99.6%
Time: 7.9s
Alternatives: 22
Speedup: 1.5×

Specification

?
\[\begin{array}{l} \\ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (+
  (- (* x (/ 1.0 (tan B))))
  (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
	return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
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 22 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.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (+
  (- (* x (/ 1.0 (tan B))))
  (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
	return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
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.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 53.5%

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

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

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

        \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
      3. div-add-revN/A

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

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

        \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
      6. *-commutativeN/A

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

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

        \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
      9. lift-sin.f6499.8

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

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

    if -3.70000000000000029e36 < F < 1.28e8

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.28e8 < F

    1. Initial program 48.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
      7. lift-sin.f6499.8

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

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

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

Alternative 2: 99.6% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 55.2%

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

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

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

        \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
      3. div-add-revN/A

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

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

        \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
      6. *-commutativeN/A

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

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

        \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
      9. lift-sin.f6499.8

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

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

    if -2.8e17 < F < 1.08e8

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.08e8 < F

    1. Initial program 48.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
      7. lift-sin.f6499.8

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

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

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

Alternative 3: 88.6% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \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}{B}\right)\\ t_1 := \cos B \cdot x\\ \mathbf{if}\;F \leq -2.7 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1 - t\_1}{\sin B}\\ \mathbf{elif}\;F \leq -4.2 \cdot 10^{-66}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;F \leq 2.3 \cdot 10^{-175}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{elif}\;F \leq 39000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - t\_1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0
         (fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) (- (/ x B))))
        (t_1 (* (cos B) x)))
   (if (<= F -2.7e-15)
     (/ (- -1.0 t_1) (sin B))
     (if (<= F -4.2e-66)
       t_0
       (if (<= F 2.3e-175)
         (/ (* (cos B) (- x)) (sin B))
         (if (<= F 39000.0) t_0 (/ (- 1.0 t_1) (sin B))))))))
double code(double F, double B, double x) {
	double t_0 = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), -(x / B));
	double t_1 = cos(B) * x;
	double tmp;
	if (F <= -2.7e-15) {
		tmp = (-1.0 - t_1) / sin(B);
	} else if (F <= -4.2e-66) {
		tmp = t_0;
	} else if (F <= 2.3e-175) {
		tmp = (cos(B) * -x) / sin(B);
	} else if (F <= 39000.0) {
		tmp = t_0;
	} else {
		tmp = (1.0 - t_1) / sin(B);
	}
	return tmp;
}
function code(F, B, x)
	t_0 = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(-Float64(x / B)))
	t_1 = Float64(cos(B) * x)
	tmp = 0.0
	if (F <= -2.7e-15)
		tmp = Float64(Float64(-1.0 - t_1) / sin(B));
	elseif (F <= -4.2e-66)
		tmp = t_0;
	elseif (F <= 2.3e-175)
		tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B));
	elseif (F <= 39000.0)
		tmp = t_0;
	else
		tmp = Float64(Float64(1.0 - t_1) / sin(B));
	end
	return tmp
end
code[F_, B_, x_] := Block[{t$95$0 = N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -2.7e-15], N[(N[(-1.0 - t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -4.2e-66], t$95$0, If[LessEqual[F, 2.3e-175], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 39000.0], t$95$0, N[(N[(1.0 - t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \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}{B}\right)\\
t_1 := \cos B \cdot x\\
\mathbf{if}\;F \leq -2.7 \cdot 10^{-15}:\\
\;\;\;\;\frac{-1 - t\_1}{\sin B}\\

\mathbf{elif}\;F \leq -4.2 \cdot 10^{-66}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;F \leq 2.3 \cdot 10^{-175}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\

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

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


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

    1. Initial program 61.4%

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

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

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

        \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
      3. div-add-revN/A

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

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

        \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
      6. *-commutativeN/A

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

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

        \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
      9. lift-sin.f6499.2

        \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
    5. Applied rewrites99.2%

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

    if -2.70000000000000009e-15 < F < -4.2000000000000001e-66 or 2.3e-175 < F < 39000

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}{B}\right)} \]

    if -4.2000000000000001e-66 < F < 2.3e-175

    1. Initial program 99.6%

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

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

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

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

        \[\leadsto -\frac{x \cdot \cos B}{\sin B} \]
      4. *-commutativeN/A

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

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

        \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
      7. lift-sin.f6490.1

        \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
    5. Applied rewrites90.1%

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

    if 39000 < F

    1. Initial program 48.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
      7. lift-sin.f6499.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.7 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1 - \cos B \cdot x}{\sin B}\\ \mathbf{elif}\;F \leq -4.2 \cdot 10^{-66}:\\ \;\;\;\;\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}{B}\right)\\ \mathbf{elif}\;F \leq 2.3 \cdot 10^{-175}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{elif}\;F \leq 39000:\\ \;\;\;\;\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}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 84.4% accurate, 1.4× speedup?

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

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

\mathbf{elif}\;F \leq -1.3 \cdot 10^{-38}:\\
\;\;\;\;\frac{\sqrt{0.5} \cdot F}{\sin B}\\

\mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if F < -2.70000000000000009e-15

    1. Initial program 61.4%

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

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

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

        \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
      3. div-add-revN/A

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

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

        \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
      6. *-commutativeN/A

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

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

        \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
      9. lift-sin.f6499.2

        \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
    5. Applied rewrites99.2%

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

    if -2.70000000000000009e-15 < F < -1.30000000000000005e-38

    1. Initial program 99.6%

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

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

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

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

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

        \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
      5. lower-pow.f64N/A

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

        \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
      7. pow2N/A

        \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
      8. lower-fma.f64N/A

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

        \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
      10. lift-/.f6499.6

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

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

      \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\color{blue}{\sin B}} \]
    7. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\sin B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\sin B} \]
      3. metadata-evalN/A

        \[\leadsto \frac{F \cdot \sqrt{-1 \cdot \frac{-1}{2}}}{\sin B} \]
      4. sqrt-unprodN/A

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

        \[\leadsto \frac{F \cdot \left(\sqrt{-1} \cdot \sqrt{\frac{-1}{2}}\right)}{\sin B} \]
      6. sqrt-unprodN/A

        \[\leadsto \frac{F \cdot \sqrt{-1 \cdot \frac{-1}{2}}}{\sin B} \]
      7. metadata-evalN/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\sin B} \]
      8. metadata-evalN/A

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\sin B} \]
      9. *-commutativeN/A

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

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

        \[\leadsto \frac{\sqrt{\frac{1}{2}} \cdot F}{\sin B} \]
      12. metadata-evalN/A

        \[\leadsto \frac{\sqrt{\frac{1}{2}} \cdot F}{\sin B} \]
      13. lift-sin.f6499.6

        \[\leadsto \frac{\sqrt{0.5} \cdot F}{\sin B} \]
    8. Applied rewrites99.6%

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

    if -1.30000000000000005e-38 < F < 1.05000000000000009e-167

    1. Initial program 99.6%

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

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

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

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

        \[\leadsto -\frac{x \cdot \cos B}{\sin B} \]
      4. *-commutativeN/A

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

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

        \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
      7. lift-sin.f6488.8

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

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

    if 1.05000000000000009e-167 < F < 9e3

    1. Initial program 99.6%

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

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

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

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

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

        \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
      5. lower-pow.f64N/A

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

        \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
      7. pow2N/A

        \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
      8. lower-fma.f64N/A

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

        \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
      10. lift-/.f6463.4

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

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

    if 9e3 < F

    1. Initial program 48.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
      7. lift-sin.f6499.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.7 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1 - \cos B \cdot x}{\sin B}\\ \mathbf{elif}\;F \leq -1.3 \cdot 10^{-38}:\\ \;\;\;\;\frac{\sqrt{0.5} \cdot F}{\sin B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{elif}\;F \leq 9000:\\ \;\;\;\;\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 91.6% accurate, 1.4× speedup?

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

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

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

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


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

    1. Initial program 58.2%

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

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

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

        \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
      3. div-add-revN/A

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

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

        \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
      6. *-commutativeN/A

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

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

        \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
      9. lift-sin.f6499.8

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

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

    if -1.8e6 < F < 1.41999999999999996e-36

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.41999999999999996e-36 < F

      1. Initial program 52.3%

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

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

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

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

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

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

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

          \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
        7. lift-sin.f6496.1

          \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
      5. Applied rewrites96.1%

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

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

    Alternative 6: 84.3% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos B \cdot x\\ \mathbf{if}\;F \leq -2.7 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1 - t\_0}{\sin B}\\ \mathbf{elif}\;F \leq -1.3 \cdot 10^{-38}:\\ \;\;\;\;\frac{\sqrt{0.5} \cdot F}{\sin B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1.7 \cdot 10^{-13}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - t\_0}{\sin B}\\ \end{array} \end{array} \]
    (FPCore (F B x)
     :precision binary64
     (let* ((t_0 (* (cos B) x)))
       (if (<= F -2.7e-15)
         (/ (- -1.0 t_0) (sin B))
         (if (<= F -1.3e-38)
           (/ (* (sqrt 0.5) F) (sin B))
           (if (<= F 1.05e-167)
             (/ (* (cos B) (- x)) (sin B))
             (if (<= F 1.7e-13)
               (* (sqrt 0.5) (/ F (sin B)))
               (/ (- 1.0 t_0) (sin B))))))))
    double code(double F, double B, double x) {
    	double t_0 = cos(B) * x;
    	double tmp;
    	if (F <= -2.7e-15) {
    		tmp = (-1.0 - t_0) / sin(B);
    	} else if (F <= -1.3e-38) {
    		tmp = (sqrt(0.5) * F) / sin(B);
    	} else if (F <= 1.05e-167) {
    		tmp = (cos(B) * -x) / sin(B);
    	} else if (F <= 1.7e-13) {
    		tmp = sqrt(0.5) * (F / sin(B));
    	} else {
    		tmp = (1.0 - t_0) / sin(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) :: t_0
        real(8) :: tmp
        t_0 = cos(b) * x
        if (f <= (-2.7d-15)) then
            tmp = ((-1.0d0) - t_0) / sin(b)
        else if (f <= (-1.3d-38)) then
            tmp = (sqrt(0.5d0) * f) / sin(b)
        else if (f <= 1.05d-167) then
            tmp = (cos(b) * -x) / sin(b)
        else if (f <= 1.7d-13) then
            tmp = sqrt(0.5d0) * (f / sin(b))
        else
            tmp = (1.0d0 - t_0) / sin(b)
        end if
        code = tmp
    end function
    
    public static double code(double F, double B, double x) {
    	double t_0 = Math.cos(B) * x;
    	double tmp;
    	if (F <= -2.7e-15) {
    		tmp = (-1.0 - t_0) / Math.sin(B);
    	} else if (F <= -1.3e-38) {
    		tmp = (Math.sqrt(0.5) * F) / Math.sin(B);
    	} else if (F <= 1.05e-167) {
    		tmp = (Math.cos(B) * -x) / Math.sin(B);
    	} else if (F <= 1.7e-13) {
    		tmp = Math.sqrt(0.5) * (F / Math.sin(B));
    	} else {
    		tmp = (1.0 - t_0) / Math.sin(B);
    	}
    	return tmp;
    }
    
    def code(F, B, x):
    	t_0 = math.cos(B) * x
    	tmp = 0
    	if F <= -2.7e-15:
    		tmp = (-1.0 - t_0) / math.sin(B)
    	elif F <= -1.3e-38:
    		tmp = (math.sqrt(0.5) * F) / math.sin(B)
    	elif F <= 1.05e-167:
    		tmp = (math.cos(B) * -x) / math.sin(B)
    	elif F <= 1.7e-13:
    		tmp = math.sqrt(0.5) * (F / math.sin(B))
    	else:
    		tmp = (1.0 - t_0) / math.sin(B)
    	return tmp
    
    function code(F, B, x)
    	t_0 = Float64(cos(B) * x)
    	tmp = 0.0
    	if (F <= -2.7e-15)
    		tmp = Float64(Float64(-1.0 - t_0) / sin(B));
    	elseif (F <= -1.3e-38)
    		tmp = Float64(Float64(sqrt(0.5) * F) / sin(B));
    	elseif (F <= 1.05e-167)
    		tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B));
    	elseif (F <= 1.7e-13)
    		tmp = Float64(sqrt(0.5) * Float64(F / sin(B)));
    	else
    		tmp = Float64(Float64(1.0 - t_0) / sin(B));
    	end
    	return tmp
    end
    
    function tmp_2 = code(F, B, x)
    	t_0 = cos(B) * x;
    	tmp = 0.0;
    	if (F <= -2.7e-15)
    		tmp = (-1.0 - t_0) / sin(B);
    	elseif (F <= -1.3e-38)
    		tmp = (sqrt(0.5) * F) / sin(B);
    	elseif (F <= 1.05e-167)
    		tmp = (cos(B) * -x) / sin(B);
    	elseif (F <= 1.7e-13)
    		tmp = sqrt(0.5) * (F / sin(B));
    	else
    		tmp = (1.0 - t_0) / sin(B);
    	end
    	tmp_2 = tmp;
    end
    
    code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -2.7e-15], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.3e-38], N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.05e-167], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.7e-13], N[(N[Sqrt[0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \cos B \cdot x\\
    \mathbf{if}\;F \leq -2.7 \cdot 10^{-15}:\\
    \;\;\;\;\frac{-1 - t\_0}{\sin B}\\
    
    \mathbf{elif}\;F \leq -1.3 \cdot 10^{-38}:\\
    \;\;\;\;\frac{\sqrt{0.5} \cdot F}{\sin B}\\
    
    \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\
    \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
    
    \mathbf{elif}\;F \leq 1.7 \cdot 10^{-13}:\\
    \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1 - t\_0}{\sin B}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 5 regimes
    2. if F < -2.70000000000000009e-15

      1. Initial program 61.4%

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

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

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

          \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
        3. div-add-revN/A

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

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

          \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
        6. *-commutativeN/A

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

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

          \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
        9. lift-sin.f6499.2

          \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
      5. Applied rewrites99.2%

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

      if -2.70000000000000009e-15 < F < -1.30000000000000005e-38

      1. Initial program 99.6%

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

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

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

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

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

          \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
        5. lower-pow.f64N/A

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

          \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
        7. pow2N/A

          \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
        8. lower-fma.f64N/A

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

          \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
        10. lift-/.f6499.6

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

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

        \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\color{blue}{\sin B}} \]
      7. Step-by-step derivation
        1. metadata-evalN/A

          \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\sin B} \]
        2. metadata-evalN/A

          \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\sin B} \]
        3. metadata-evalN/A

          \[\leadsto \frac{F \cdot \sqrt{-1 \cdot \frac{-1}{2}}}{\sin B} \]
        4. sqrt-unprodN/A

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

          \[\leadsto \frac{F \cdot \left(\sqrt{-1} \cdot \sqrt{\frac{-1}{2}}\right)}{\sin B} \]
        6. sqrt-unprodN/A

          \[\leadsto \frac{F \cdot \sqrt{-1 \cdot \frac{-1}{2}}}{\sin B} \]
        7. metadata-evalN/A

          \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\sin B} \]
        8. metadata-evalN/A

          \[\leadsto \frac{F \cdot \sqrt{\frac{1}{2}}}{\sin B} \]
        9. *-commutativeN/A

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

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

          \[\leadsto \frac{\sqrt{\frac{1}{2}} \cdot F}{\sin B} \]
        12. metadata-evalN/A

          \[\leadsto \frac{\sqrt{\frac{1}{2}} \cdot F}{\sin B} \]
        13. lift-sin.f6499.6

          \[\leadsto \frac{\sqrt{0.5} \cdot F}{\sin B} \]
      8. Applied rewrites99.6%

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

      if -1.30000000000000005e-38 < F < 1.05000000000000009e-167

      1. Initial program 99.6%

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

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

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

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

          \[\leadsto -\frac{x \cdot \cos B}{\sin B} \]
        4. *-commutativeN/A

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

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

          \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
        7. lift-sin.f6488.8

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

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

      if 1.05000000000000009e-167 < F < 1.70000000000000008e-13

      1. Initial program 99.6%

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

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

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

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

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

          \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
        5. lower-pow.f64N/A

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

          \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
        7. pow2N/A

          \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
        8. lower-fma.f64N/A

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

          \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
        10. lift-/.f6462.9

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

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

        \[\leadsto \sqrt{\frac{1}{2}} \cdot \frac{F}{\sin B} \]
      7. Step-by-step derivation
        1. Applied rewrites62.9%

          \[\leadsto \sqrt{0.5} \cdot \frac{F}{\sin B} \]

        if 1.70000000000000008e-13 < F

        1. Initial program 50.4%

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

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

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

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

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

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

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

            \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
          7. lift-sin.f6498.4

            \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
        5. Applied rewrites98.4%

          \[\leadsto \color{blue}{\frac{1 - \cos B \cdot x}{\sin B}} \]
      8. Recombined 5 regimes into one program.
      9. Final simplification91.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.7 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1 - \cos B \cdot x}{\sin B}\\ \mathbf{elif}\;F \leq -1.3 \cdot 10^{-38}:\\ \;\;\;\;\frac{\sqrt{0.5} \cdot F}{\sin B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1.7 \cdot 10^{-13}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \]
      10. Add Preprocessing

      Alternative 7: 77.8% accurate, 1.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -28500000000:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1.7 \cdot 10^{-13}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \end{array} \]
      (FPCore (F B x)
       :precision binary64
       (if (<= F -28500000000.0)
         (/ (- -1.0 x) (sin B))
         (if (<= F 1.05e-167)
           (/ (* (cos B) (- x)) (sin B))
           (if (<= F 1.7e-13)
             (* (sqrt 0.5) (/ F (sin B)))
             (/ (- 1.0 (* (cos B) x)) (sin B))))))
      double code(double F, double B, double x) {
      	double tmp;
      	if (F <= -28500000000.0) {
      		tmp = (-1.0 - x) / sin(B);
      	} else if (F <= 1.05e-167) {
      		tmp = (cos(B) * -x) / sin(B);
      	} else if (F <= 1.7e-13) {
      		tmp = sqrt(0.5) * (F / sin(B));
      	} else {
      		tmp = (1.0 - (cos(B) * x)) / sin(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 <= (-28500000000.0d0)) then
              tmp = ((-1.0d0) - x) / sin(b)
          else if (f <= 1.05d-167) then
              tmp = (cos(b) * -x) / sin(b)
          else if (f <= 1.7d-13) then
              tmp = sqrt(0.5d0) * (f / sin(b))
          else
              tmp = (1.0d0 - (cos(b) * x)) / sin(b)
          end if
          code = tmp
      end function
      
      public static double code(double F, double B, double x) {
      	double tmp;
      	if (F <= -28500000000.0) {
      		tmp = (-1.0 - x) / Math.sin(B);
      	} else if (F <= 1.05e-167) {
      		tmp = (Math.cos(B) * -x) / Math.sin(B);
      	} else if (F <= 1.7e-13) {
      		tmp = Math.sqrt(0.5) * (F / Math.sin(B));
      	} else {
      		tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
      	}
      	return tmp;
      }
      
      def code(F, B, x):
      	tmp = 0
      	if F <= -28500000000.0:
      		tmp = (-1.0 - x) / math.sin(B)
      	elif F <= 1.05e-167:
      		tmp = (math.cos(B) * -x) / math.sin(B)
      	elif F <= 1.7e-13:
      		tmp = math.sqrt(0.5) * (F / math.sin(B))
      	else:
      		tmp = (1.0 - (math.cos(B) * x)) / math.sin(B)
      	return tmp
      
      function code(F, B, x)
      	tmp = 0.0
      	if (F <= -28500000000.0)
      		tmp = Float64(Float64(-1.0 - x) / sin(B));
      	elseif (F <= 1.05e-167)
      		tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B));
      	elseif (F <= 1.7e-13)
      		tmp = Float64(sqrt(0.5) * Float64(F / sin(B)));
      	else
      		tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B));
      	end
      	return tmp
      end
      
      function tmp_2 = code(F, B, x)
      	tmp = 0.0;
      	if (F <= -28500000000.0)
      		tmp = (-1.0 - x) / sin(B);
      	elseif (F <= 1.05e-167)
      		tmp = (cos(B) * -x) / sin(B);
      	elseif (F <= 1.7e-13)
      		tmp = sqrt(0.5) * (F / sin(B));
      	else
      		tmp = (1.0 - (cos(B) * x)) / sin(B);
      	end
      	tmp_2 = tmp;
      end
      
      code[F_, B_, x_] := If[LessEqual[F, -28500000000.0], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.05e-167], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.7e-13], N[(N[Sqrt[0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;F \leq -28500000000:\\
      \;\;\;\;\frac{-1 - x}{\sin B}\\
      
      \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\
      \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
      
      \mathbf{elif}\;F \leq 1.7 \cdot 10^{-13}:\\
      \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if F < -2.85e10

        1. Initial program 57.5%

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

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

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

            \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
          3. div-add-revN/A

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

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

            \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
          6. *-commutativeN/A

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

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

            \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
          9. lift-sin.f6499.8

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

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

          \[\leadsto -\frac{1 + x}{\sin B} \]
        7. Step-by-step derivation
          1. Applied rewrites88.1%

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

          if -2.85e10 < F < 1.05000000000000009e-167

          1. Initial program 99.6%

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

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

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

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

              \[\leadsto -\frac{x \cdot \cos B}{\sin B} \]
            4. *-commutativeN/A

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

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

              \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
            7. lift-sin.f6481.9

              \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
          5. Applied rewrites81.9%

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

          if 1.05000000000000009e-167 < F < 1.70000000000000008e-13

          1. Initial program 99.6%

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

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

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

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

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

              \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
            5. lower-pow.f64N/A

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

              \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
            7. pow2N/A

              \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
            8. lower-fma.f64N/A

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

              \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
            10. lift-/.f6462.9

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

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

            \[\leadsto \sqrt{\frac{1}{2}} \cdot \frac{F}{\sin B} \]
          7. Step-by-step derivation
            1. Applied rewrites62.9%

              \[\leadsto \sqrt{0.5} \cdot \frac{F}{\sin B} \]

            if 1.70000000000000008e-13 < F

            1. Initial program 50.4%

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

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

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

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

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

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

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

                \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
              7. lift-sin.f6498.4

                \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
            5. Applied rewrites98.4%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -28500000000:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1.7 \cdot 10^{-13}:\\ \;\;\;\;\sqrt{0.5} \cdot \frac{F}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \]
          10. Add Preprocessing

          Alternative 8: 64.4% accurate, 1.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -28500000000:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1.06 \cdot 10^{+77}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 4 \cdot 10^{+166}:\\ \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\ \mathbf{else}:\\ \;\;\;\;{\sin B}^{-1}\\ \end{array} \end{array} \]
          (FPCore (F B x)
           :precision binary64
           (if (<= F -28500000000.0)
             (/ (- -1.0 x) (sin B))
             (if (<= F 1.05e-167)
               (/ (* (cos B) (- x)) (sin B))
               (if (<= F 1.06e+77)
                 (* (/ 1.0 (sqrt (fma F F 2.0))) (/ F (sin B)))
                 (if (<= F 4e+166)
                   (/ (/ (- 1.0 (* x x)) (+ 1.0 x)) B)
                   (pow (sin B) -1.0))))))
          double code(double F, double B, double x) {
          	double tmp;
          	if (F <= -28500000000.0) {
          		tmp = (-1.0 - x) / sin(B);
          	} else if (F <= 1.05e-167) {
          		tmp = (cos(B) * -x) / sin(B);
          	} else if (F <= 1.06e+77) {
          		tmp = (1.0 / sqrt(fma(F, F, 2.0))) * (F / sin(B));
          	} else if (F <= 4e+166) {
          		tmp = ((1.0 - (x * x)) / (1.0 + x)) / B;
          	} else {
          		tmp = pow(sin(B), -1.0);
          	}
          	return tmp;
          }
          
          function code(F, B, x)
          	tmp = 0.0
          	if (F <= -28500000000.0)
          		tmp = Float64(Float64(-1.0 - x) / sin(B));
          	elseif (F <= 1.05e-167)
          		tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B));
          	elseif (F <= 1.06e+77)
          		tmp = Float64(Float64(1.0 / sqrt(fma(F, F, 2.0))) * Float64(F / sin(B)));
          	elseif (F <= 4e+166)
          		tmp = Float64(Float64(Float64(1.0 - Float64(x * x)) / Float64(1.0 + x)) / B);
          	else
          		tmp = sin(B) ^ -1.0;
          	end
          	return tmp
          end
          
          code[F_, B_, x_] := If[LessEqual[F, -28500000000.0], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.05e-167], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.06e+77], N[(N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4e+166], N[(N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;F \leq -28500000000:\\
          \;\;\;\;\frac{-1 - x}{\sin B}\\
          
          \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\
          \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
          
          \mathbf{elif}\;F \leq 1.06 \cdot 10^{+77}:\\
          \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
          
          \mathbf{elif}\;F \leq 4 \cdot 10^{+166}:\\
          \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\
          
          \mathbf{else}:\\
          \;\;\;\;{\sin B}^{-1}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 5 regimes
          2. if F < -2.85e10

            1. Initial program 57.5%

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

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

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

                \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
              3. div-add-revN/A

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

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

                \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
              6. *-commutativeN/A

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

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

                \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
              9. lift-sin.f6499.8

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

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

              \[\leadsto -\frac{1 + x}{\sin B} \]
            7. Step-by-step derivation
              1. Applied rewrites88.1%

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

              if -2.85e10 < F < 1.05000000000000009e-167

              1. Initial program 99.6%

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

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

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

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

                  \[\leadsto -\frac{x \cdot \cos B}{\sin B} \]
                4. *-commutativeN/A

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

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

                  \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
                7. lift-sin.f6481.9

                  \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
              5. Applied rewrites81.9%

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

              if 1.05000000000000009e-167 < F < 1.06000000000000003e77

              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 x around 0

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

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

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

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

                  \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                5. lower-pow.f64N/A

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

                  \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                7. pow2N/A

                  \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                8. lower-fma.f64N/A

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

                  \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                10. lift-/.f6465.7

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

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

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

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

                  \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                4. unpow-1N/A

                  \[\leadsto \sqrt{\frac{1}{F \cdot F + 2}} \cdot \frac{F}{\sin B} \]
                5. pow2N/A

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

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

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

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

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

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

                  \[\leadsto \frac{1}{\sqrt{{F}^{2} + 2}} \cdot \frac{F}{\sin B} \]
                12. pow2N/A

                  \[\leadsto \frac{1}{\sqrt{F \cdot F + 2}} \cdot \frac{F}{\sin B} \]
                13. lift-fma.f6465.6

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

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

              if 1.06000000000000003e77 < F < 3.99999999999999976e166

              1. Initial program 71.4%

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

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

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

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

                \[\leadsto \frac{1 - x}{B} \]
              7. Step-by-step derivation
                1. lower--.f6460.2

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

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

                  \[\leadsto \frac{1 - x}{B} \]
                2. flip--N/A

                  \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                3. lower-/.f64N/A

                  \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                4. metadata-evalN/A

                  \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                5. unpow2N/A

                  \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                6. lower--.f64N/A

                  \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                7. unpow2N/A

                  \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                8. lower-*.f64N/A

                  \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                9. lower-+.f6465.6

                  \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
              10. Applied rewrites65.6%

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

              if 3.99999999999999976e166 < F

              1. Initial program 15.2%

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

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

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

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

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

                  \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                5. lower-pow.f64N/A

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

                  \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                7. pow2N/A

                  \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                8. lower-fma.f64N/A

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

                  \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                10. lift-/.f641.9

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

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

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

                  \[\leadsto {\sin B}^{-1} \]
                2. lower-pow.f64N/A

                  \[\leadsto {\sin B}^{-1} \]
                3. lift-sin.f6467.5

                  \[\leadsto {\sin B}^{-1} \]
              8. Applied rewrites67.5%

                \[\leadsto {\sin B}^{\color{blue}{-1}} \]
            8. Recombined 5 regimes into one program.
            9. Final simplification76.8%

              \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -28500000000:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.05 \cdot 10^{-167}:\\ \;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1.06 \cdot 10^{+77}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 4 \cdot 10^{+166}:\\ \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\ \mathbf{else}:\\ \;\;\;\;{\sin B}^{-1}\\ \end{array} \]
            10. Add Preprocessing

            Alternative 9: 57.9% accurate, 1.6× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -2.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.02 \cdot 10^{-167}:\\ \;\;\;\;\frac{F}{B} \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.06 \cdot 10^{+77}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 4 \cdot 10^{+166}:\\ \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\ \mathbf{else}:\\ \;\;\;\;{\sin B}^{-1}\\ \end{array} \end{array} \]
            (FPCore (F B x)
             :precision binary64
             (if (<= F -2.5e-15)
               (/ (- -1.0 x) (sin B))
               (if (<= F 1.02e-167)
                 (- (* (/ F B) (pow (fma 2.0 x (fma F F 2.0)) -0.5)) (/ x B))
                 (if (<= F 1.06e+77)
                   (* (/ 1.0 (sqrt (fma F F 2.0))) (/ F (sin B)))
                   (if (<= F 4e+166)
                     (/ (/ (- 1.0 (* x x)) (+ 1.0 x)) B)
                     (pow (sin B) -1.0))))))
            double code(double F, double B, double x) {
            	double tmp;
            	if (F <= -2.5e-15) {
            		tmp = (-1.0 - x) / sin(B);
            	} else if (F <= 1.02e-167) {
            		tmp = ((F / B) * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)) - (x / B);
            	} else if (F <= 1.06e+77) {
            		tmp = (1.0 / sqrt(fma(F, F, 2.0))) * (F / sin(B));
            	} else if (F <= 4e+166) {
            		tmp = ((1.0 - (x * x)) / (1.0 + x)) / B;
            	} else {
            		tmp = pow(sin(B), -1.0);
            	}
            	return tmp;
            }
            
            function code(F, B, x)
            	tmp = 0.0
            	if (F <= -2.5e-15)
            		tmp = Float64(Float64(-1.0 - x) / sin(B));
            	elseif (F <= 1.02e-167)
            		tmp = Float64(Float64(Float64(F / B) * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)) - Float64(x / B));
            	elseif (F <= 1.06e+77)
            		tmp = Float64(Float64(1.0 / sqrt(fma(F, F, 2.0))) * Float64(F / sin(B)));
            	elseif (F <= 4e+166)
            		tmp = Float64(Float64(Float64(1.0 - Float64(x * x)) / Float64(1.0 + x)) / B);
            	else
            		tmp = sin(B) ^ -1.0;
            	end
            	return tmp
            end
            
            code[F_, B_, x_] := If[LessEqual[F, -2.5e-15], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.02e-167], N[(N[(N[(F / B), $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.06e+77], N[(N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4e+166], N[(N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;F \leq -2.5 \cdot 10^{-15}:\\
            \;\;\;\;\frac{-1 - x}{\sin B}\\
            
            \mathbf{elif}\;F \leq 1.02 \cdot 10^{-167}:\\
            \;\;\;\;\frac{F}{B} \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \frac{x}{B}\\
            
            \mathbf{elif}\;F \leq 1.06 \cdot 10^{+77}:\\
            \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
            
            \mathbf{elif}\;F \leq 4 \cdot 10^{+166}:\\
            \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\
            
            \mathbf{else}:\\
            \;\;\;\;{\sin B}^{-1}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 5 regimes
            2. if F < -2.5e-15

              1. Initial program 61.4%

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

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

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

                  \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
                3. div-add-revN/A

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

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

                  \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
                6. *-commutativeN/A

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

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

                  \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                9. lift-sin.f6499.2

                  \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
              5. Applied rewrites99.2%

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

                \[\leadsto -\frac{1 + x}{\sin B} \]
              7. Step-by-step derivation
                1. Applied rewrites81.7%

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

                if -2.5e-15 < F < 1.0199999999999999e-167

                1. Initial program 99.6%

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

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

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

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

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

                if 1.0199999999999999e-167 < F < 1.06000000000000003e77

                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 x around 0

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

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

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

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

                    \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                  5. lower-pow.f64N/A

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

                    \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                  7. pow2N/A

                    \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                  8. lower-fma.f64N/A

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

                    \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                  10. lift-/.f6465.7

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

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

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

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

                    \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                  4. unpow-1N/A

                    \[\leadsto \sqrt{\frac{1}{F \cdot F + 2}} \cdot \frac{F}{\sin B} \]
                  5. pow2N/A

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

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

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

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

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

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

                    \[\leadsto \frac{1}{\sqrt{{F}^{2} + 2}} \cdot \frac{F}{\sin B} \]
                  12. pow2N/A

                    \[\leadsto \frac{1}{\sqrt{F \cdot F + 2}} \cdot \frac{F}{\sin B} \]
                  13. lift-fma.f6465.6

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

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

                if 1.06000000000000003e77 < F < 3.99999999999999976e166

                1. Initial program 71.4%

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

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

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

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

                  \[\leadsto \frac{1 - x}{B} \]
                7. Step-by-step derivation
                  1. lower--.f6460.2

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

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

                    \[\leadsto \frac{1 - x}{B} \]
                  2. flip--N/A

                    \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                  3. lower-/.f64N/A

                    \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                  4. metadata-evalN/A

                    \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                  5. unpow2N/A

                    \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                  6. lower--.f64N/A

                    \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                  7. unpow2N/A

                    \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                  8. lower-*.f64N/A

                    \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                  9. lower-+.f6465.6

                    \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                10. Applied rewrites65.6%

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

                if 3.99999999999999976e166 < F

                1. Initial program 15.2%

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

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

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

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

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

                    \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                  5. lower-pow.f64N/A

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

                    \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                  7. pow2N/A

                    \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                  8. lower-fma.f64N/A

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

                    \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                  10. lift-/.f641.9

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

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

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

                    \[\leadsto {\sin B}^{-1} \]
                  2. lower-pow.f64N/A

                    \[\leadsto {\sin B}^{-1} \]
                  3. lift-sin.f6467.5

                    \[\leadsto {\sin B}^{-1} \]
                8. Applied rewrites67.5%

                  \[\leadsto {\sin B}^{\color{blue}{-1}} \]
              8. Recombined 5 regimes into one program.
              9. Final simplification64.6%

                \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.02 \cdot 10^{-167}:\\ \;\;\;\;\frac{F}{B} \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.06 \cdot 10^{+77}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\ \mathbf{elif}\;F \leq 4 \cdot 10^{+166}:\\ \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\ \mathbf{else}:\\ \;\;\;\;{\sin B}^{-1}\\ \end{array} \]
              10. Add Preprocessing

              Alternative 10: 58.0% accurate, 2.3× speedup?

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

                1. Initial program 61.4%

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

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

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

                    \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
                  3. div-add-revN/A

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

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

                    \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
                  6. *-commutativeN/A

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

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

                    \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                  9. lift-sin.f6499.2

                    \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                5. Applied rewrites99.2%

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

                  \[\leadsto -\frac{1 + x}{\sin B} \]
                7. Step-by-step derivation
                  1. Applied rewrites81.7%

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

                  if -2.5e-15 < F < 1.0199999999999999e-167

                  1. Initial program 99.6%

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

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

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

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

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

                  if 1.0199999999999999e-167 < F < 1.06000000000000003e77

                  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 x around 0

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

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

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

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

                      \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                    5. lower-pow.f64N/A

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

                      \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                    7. pow2N/A

                      \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                    8. lower-fma.f64N/A

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

                      \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                    10. lift-/.f6465.7

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

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

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

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

                      \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                    4. unpow-1N/A

                      \[\leadsto \sqrt{\frac{1}{F \cdot F + 2}} \cdot \frac{F}{\sin B} \]
                    5. pow2N/A

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

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

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

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

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

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

                      \[\leadsto \frac{1}{\sqrt{{F}^{2} + 2}} \cdot \frac{F}{\sin B} \]
                    12. pow2N/A

                      \[\leadsto \frac{1}{\sqrt{F \cdot F + 2}} \cdot \frac{F}{\sin B} \]
                    13. lift-fma.f6465.6

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

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

                  if 1.06000000000000003e77 < F

                  1. Initial program 32.6%

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

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

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

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

                    \[\leadsto \frac{1 - x}{B} \]
                  7. Step-by-step derivation
                    1. lower--.f6449.3

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

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

                      \[\leadsto \frac{1 - x}{B} \]
                    2. flip--N/A

                      \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                    3. lower-/.f64N/A

                      \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                    4. metadata-evalN/A

                      \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                    5. unpow2N/A

                      \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                    6. lower--.f64N/A

                      \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                    7. unpow2N/A

                      \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                    8. lower-*.f64N/A

                      \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                    9. lower-+.f6451.1

                      \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                  10. Applied rewrites51.1%

                    \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                8. Recombined 4 regimes into one program.
                9. Final simplification61.2%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 1.02 \cdot 10^{-167}:\\ \;\;\;\;\frac{F}{B} \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.06 \cdot 10^{+77}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\ \end{array} \]
                10. Add Preprocessing

                Alternative 11: 58.0% accurate, 2.3× speedup?

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

                  1. Initial program 61.4%

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

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

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

                      \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
                    3. div-add-revN/A

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

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

                      \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
                    6. *-commutativeN/A

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

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

                      \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                    9. lift-sin.f6499.2

                      \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                  5. Applied rewrites99.2%

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

                    \[\leadsto -\frac{1 + x}{\sin B} \]
                  7. Step-by-step derivation
                    1. Applied rewrites81.7%

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

                    if -2.5e-15 < F < 3.5e-164

                    1. Initial program 99.6%

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

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

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

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

                      \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                    7. Step-by-step derivation
                      1. inv-powN/A

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

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

                        \[\leadsto \frac{\sqrt{{\left(2 \cdot x + 2\right)}^{-1}} \cdot F - x}{B} \]
                      4. lower-fma.f6450.7

                        \[\leadsto \frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B} \]
                    8. Applied rewrites50.7%

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

                      \[\leadsto \frac{\sqrt{\frac{1}{2}} \cdot F - x}{B} \]
                    10. Step-by-step derivation
                      1. Applied rewrites50.7%

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

                      if 3.5e-164 < F < 1.06000000000000003e77

                      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 x around 0

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

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

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

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

                          \[\leadsto \sqrt{{\left(2 + {F}^{2}\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                        5. lower-pow.f64N/A

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

                          \[\leadsto \sqrt{{\left({F}^{2} + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                        7. pow2N/A

                          \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                        8. lower-fma.f64N/A

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

                          \[\leadsto \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                        10. lift-/.f6464.3

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

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

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

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

                          \[\leadsto \sqrt{{\left(F \cdot F + 2\right)}^{-1}} \cdot \frac{F}{\sin B} \]
                        4. unpow-1N/A

                          \[\leadsto \sqrt{\frac{1}{F \cdot F + 2}} \cdot \frac{F}{\sin B} \]
                        5. pow2N/A

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

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

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

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

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

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

                          \[\leadsto \frac{1}{\sqrt{{F}^{2} + 2}} \cdot \frac{F}{\sin B} \]
                        12. pow2N/A

                          \[\leadsto \frac{1}{\sqrt{F \cdot F + 2}} \cdot \frac{F}{\sin B} \]
                        13. lift-fma.f6464.2

                          \[\leadsto \frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B} \]
                      7. Applied rewrites64.2%

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

                      if 1.06000000000000003e77 < F

                      1. Initial program 32.6%

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

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

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

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

                        \[\leadsto \frac{1 - x}{B} \]
                      7. Step-by-step derivation
                        1. lower--.f6449.3

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

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

                          \[\leadsto \frac{1 - x}{B} \]
                        2. flip--N/A

                          \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                        3. lower-/.f64N/A

                          \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                        4. metadata-evalN/A

                          \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                        5. unpow2N/A

                          \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                        6. lower--.f64N/A

                          \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                        7. unpow2N/A

                          \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                        8. lower-*.f64N/A

                          \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                        9. lower-+.f6451.1

                          \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                      10. Applied rewrites51.1%

                        \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                    11. Recombined 4 regimes into one program.
                    12. Final simplification61.2%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{-1 - x}{\sin B}\\ \mathbf{elif}\;F \leq 3.5 \cdot 10^{-164}:\\ \;\;\;\;\frac{\sqrt{0.5} \cdot F - x}{B}\\ \mathbf{elif}\;F \leq 1.06 \cdot 10^{+77}:\\ \;\;\;\;\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\ \end{array} \]
                    13. Add Preprocessing

                    Alternative 12: 58.4% accurate, 3.0× speedup?

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

                      1. Initial program 61.4%

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

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

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

                          \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
                        3. div-add-revN/A

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

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

                          \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
                        6. *-commutativeN/A

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

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

                          \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                        9. lift-sin.f6499.2

                          \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                      5. Applied rewrites99.2%

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

                        \[\leadsto -\frac{1 + x}{\sin B} \]
                      7. Step-by-step derivation
                        1. Applied rewrites81.7%

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

                        if -2.5e-15 < F < 1.34999999999999993e37

                        1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{\sqrt{{\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{-1}} \cdot F - x}{B} \]
                          7. inv-powN/A

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

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

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

                            \[\leadsto \frac{\sqrt{\frac{1}{2 \cdot x + \left(F \cdot F + 2\right)}} \cdot F - x}{B} \]
                          11. +-commutativeN/A

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

                            \[\leadsto \frac{\sqrt{\frac{1}{\left(F \cdot F + 2\right) + 2 \cdot x}} \cdot F - x}{B} \]
                          13. +-commutativeN/A

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

                            \[\leadsto \frac{\sqrt{\frac{1}{2 \cdot x + \mathsf{fma}\left(F, F, 2\right)}} \cdot F - x}{B} \]
                          15. lift-fma.f6448.7

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

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

                        if 1.34999999999999993e37 < F

                        1. Initial program 42.9%

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

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

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

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

                          \[\leadsto \frac{1 - x}{B} \]
                        7. Step-by-step derivation
                          1. lower--.f6446.0

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

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

                            \[\leadsto \frac{1 - x}{B} \]
                          2. flip--N/A

                            \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                          3. lower-/.f64N/A

                            \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                          4. metadata-evalN/A

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          5. unpow2N/A

                            \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                          6. lower--.f64N/A

                            \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                          7. unpow2N/A

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          8. lower-*.f64N/A

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          9. lower-+.f6447.5

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                        10. Applied rewrites47.5%

                          \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                      8. Recombined 3 regimes into one program.
                      9. Final simplification56.7%

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

                      Alternative 13: 51.9% accurate, 3.1× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.65 \cdot 10^{+66}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{+37}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\ \end{array} \end{array} \]
                      (FPCore (F B x)
                       :precision binary64
                       (if (<= F -1.65e+66)
                         (/ -1.0 (sin B))
                         (if (<= F 1.35e+37)
                           (/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
                           (/ (/ (- 1.0 (* x x)) (+ 1.0 x)) B))))
                      double code(double F, double B, double x) {
                      	double tmp;
                      	if (F <= -1.65e+66) {
                      		tmp = -1.0 / sin(B);
                      	} else if (F <= 1.35e+37) {
                      		tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
                      	} else {
                      		tmp = ((1.0 - (x * x)) / (1.0 + x)) / B;
                      	}
                      	return tmp;
                      }
                      
                      function code(F, B, x)
                      	tmp = 0.0
                      	if (F <= -1.65e+66)
                      		tmp = Float64(-1.0 / sin(B));
                      	elseif (F <= 1.35e+37)
                      		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(1.0 - Float64(x * x)) / Float64(1.0 + x)) / B);
                      	end
                      	return tmp
                      end
                      
                      code[F_, B_, x_] := If[LessEqual[F, -1.65e+66], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.35e+37], 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[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;F \leq -1.65 \cdot 10^{+66}:\\
                      \;\;\;\;\frac{-1}{\sin B}\\
                      
                      \mathbf{elif}\;F \leq 1.35 \cdot 10^{+37}:\\
                      \;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if F < -1.6500000000000001e66

                        1. Initial program 48.7%

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

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

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

                            \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
                          3. div-add-revN/A

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

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

                            \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
                          6. *-commutativeN/A

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

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

                            \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                          9. lift-sin.f6499.8

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

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

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

                            \[\leadsto \frac{-1}{\sin B} \]
                          2. lift-sin.f6467.5

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

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

                        if -1.6500000000000001e66 < F < 1.34999999999999993e37

                        1. Initial program 98.8%

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

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{\sqrt{{\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{-1}} \cdot F - x}{B} \]
                          7. inv-powN/A

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

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

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

                            \[\leadsto \frac{\sqrt{\frac{1}{2 \cdot x + \left(F \cdot F + 2\right)}} \cdot F - x}{B} \]
                          11. +-commutativeN/A

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

                            \[\leadsto \frac{\sqrt{\frac{1}{\left(F \cdot F + 2\right) + 2 \cdot x}} \cdot F - x}{B} \]
                          13. +-commutativeN/A

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

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

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

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

                        if 1.34999999999999993e37 < F

                        1. Initial program 42.9%

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

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

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

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

                          \[\leadsto \frac{1 - x}{B} \]
                        7. Step-by-step derivation
                          1. lower--.f6446.0

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

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

                            \[\leadsto \frac{1 - x}{B} \]
                          2. flip--N/A

                            \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                          3. lower-/.f64N/A

                            \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                          4. metadata-evalN/A

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          5. unpow2N/A

                            \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                          6. lower--.f64N/A

                            \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                          7. unpow2N/A

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          8. lower-*.f64N/A

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          9. lower-+.f6447.5

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                        10. Applied rewrites47.5%

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

                      Alternative 14: 50.9% accurate, 5.7× speedup?

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

                        1. Initial program 61.4%

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

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

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

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

                          \[\leadsto \frac{\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - \left(1 + x\right)}{B} \]
                        7. Step-by-step derivation
                          1. metadata-evalN/A

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

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

                            \[\leadsto \frac{\left(\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - 1\right) - x}{B} \]
                        8. Applied rewrites53.7%

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

                        if -2.70000000000000009e-15 < F < 1.34999999999999993e37

                        1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{\sqrt{{\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{-1}} \cdot F - x}{B} \]
                          7. inv-powN/A

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

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

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

                            \[\leadsto \frac{\sqrt{\frac{1}{2 \cdot x + \left(F \cdot F + 2\right)}} \cdot F - x}{B} \]
                          11. +-commutativeN/A

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

                            \[\leadsto \frac{\sqrt{\frac{1}{\left(F \cdot F + 2\right) + 2 \cdot x}} \cdot F - x}{B} \]
                          13. +-commutativeN/A

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

                            \[\leadsto \frac{\sqrt{\frac{1}{2 \cdot x + \mathsf{fma}\left(F, F, 2\right)}} \cdot F - x}{B} \]
                          15. lift-fma.f6448.7

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

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

                        if 1.34999999999999993e37 < F

                        1. Initial program 42.9%

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

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

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

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

                          \[\leadsto \frac{1 - x}{B} \]
                        7. Step-by-step derivation
                          1. lower--.f6446.0

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

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

                            \[\leadsto \frac{1 - x}{B} \]
                          2. flip--N/A

                            \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                          3. lower-/.f64N/A

                            \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                          4. metadata-evalN/A

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          5. unpow2N/A

                            \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                          6. lower--.f64N/A

                            \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                          7. unpow2N/A

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          8. lower-*.f64N/A

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          9. lower-+.f6447.5

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                        10. Applied rewrites47.5%

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

                      Alternative 15: 50.6% accurate, 7.2× speedup?

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

                        1. Initial program 61.4%

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

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

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

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

                          \[\leadsto \frac{\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - \left(1 + x\right)}{B} \]
                        7. Step-by-step derivation
                          1. metadata-evalN/A

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

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

                            \[\leadsto \frac{\left(\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - 1\right) - x}{B} \]
                        8. Applied rewrites53.7%

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

                        if -2.70000000000000009e-15 < F < 2.05e8

                        1. Initial program 99.6%

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

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

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

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

                          \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                        7. Step-by-step derivation
                          1. inv-powN/A

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

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

                            \[\leadsto \frac{\sqrt{{\left(2 \cdot x + 2\right)}^{-1}} \cdot F - x}{B} \]
                          4. lower-fma.f6449.4

                            \[\leadsto \frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B} \]
                        8. Applied rewrites49.4%

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

                          \[\leadsto \frac{\sqrt{\frac{1}{2}} \cdot F - x}{B} \]
                        10. Step-by-step derivation
                          1. Applied rewrites49.4%

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

                          if 2.05e8 < F

                          1. Initial program 47.6%

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

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

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

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

                            \[\leadsto \frac{1 - x}{B} \]
                          7. Step-by-step derivation
                            1. lower--.f6445.2

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

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

                              \[\leadsto \frac{1 - x}{B} \]
                            2. flip--N/A

                              \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                            3. lower-/.f64N/A

                              \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                            4. metadata-evalN/A

                              \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                            5. unpow2N/A

                              \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                            6. lower--.f64N/A

                              \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                            7. unpow2N/A

                              \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                            8. lower-*.f64N/A

                              \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                            9. lower-+.f6446.6

                              \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          10. Applied rewrites46.6%

                            \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                        11. Recombined 3 regimes into one program.
                        12. Add Preprocessing

                        Alternative 16: 50.8% accurate, 7.7× speedup?

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

                          1. Initial program 61.4%

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

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

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

                              \[\leadsto -\left(\frac{1}{\sin B} + \frac{x \cdot \cos B}{\sin B}\right) \]
                            3. div-add-revN/A

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

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

                              \[\leadsto -\frac{1 + x \cdot \cos B}{\sin B} \]
                            6. *-commutativeN/A

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

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

                              \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                            9. lift-sin.f6499.2

                              \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B} \]
                          5. Applied rewrites99.2%

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

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

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

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

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

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

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

                              \[\leadsto \frac{\left(\frac{-1}{6} \cdot x - \left(\frac{1}{6} + \frac{-1}{2} \cdot x\right)\right) \cdot {B}^{2} - \left(1 + x\right)}{B} \]
                            7. +-commutativeN/A

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

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

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

                              \[\leadsto \frac{\left(\frac{-1}{6} \cdot x - \mathsf{fma}\left(\frac{-1}{2}, x, \frac{1}{6}\right)\right) \cdot \left(B \cdot B\right) - \left(1 + x\right)}{B} \]
                            11. lower-+.f6452.7

                              \[\leadsto \frac{\left(-0.16666666666666666 \cdot x - \mathsf{fma}\left(-0.5, x, 0.16666666666666666\right)\right) \cdot \left(B \cdot B\right) - \left(1 + x\right)}{B} \]
                          8. Applied rewrites52.7%

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

                          if -2.70000000000000009e-15 < F < 2.05e8

                          1. Initial program 99.6%

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

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

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

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

                            \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                          7. Step-by-step derivation
                            1. inv-powN/A

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

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

                              \[\leadsto \frac{\sqrt{{\left(2 \cdot x + 2\right)}^{-1}} \cdot F - x}{B} \]
                            4. lower-fma.f6449.4

                              \[\leadsto \frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B} \]
                          8. Applied rewrites49.4%

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

                            \[\leadsto \frac{\sqrt{\frac{1}{2}} \cdot F - x}{B} \]
                          10. Step-by-step derivation
                            1. Applied rewrites49.4%

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

                            if 2.05e8 < F

                            1. Initial program 47.6%

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

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

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

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

                              \[\leadsto \frac{1 - x}{B} \]
                            7. Step-by-step derivation
                              1. lower--.f6445.2

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

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

                                \[\leadsto \frac{1 - x}{B} \]
                              2. flip--N/A

                                \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                              3. lower-/.f64N/A

                                \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                              4. metadata-evalN/A

                                \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                              5. unpow2N/A

                                \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                              6. lower--.f64N/A

                                \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                              7. unpow2N/A

                                \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                              8. lower-*.f64N/A

                                \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                              9. lower-+.f6446.6

                                \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                            10. Applied rewrites46.6%

                              \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                          11. Recombined 3 regimes into one program.
                          12. Add Preprocessing

                          Alternative 17: 51.1% accurate, 8.0× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.4:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 205000000:\\ \;\;\;\;\frac{\sqrt{0.5} \cdot F - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\ \end{array} \end{array} \]
                          (FPCore (F B x)
                           :precision binary64
                           (if (<= F -1.4)
                             (/ (- -1.0 x) B)
                             (if (<= F 205000000.0)
                               (/ (- (* (sqrt 0.5) F) x) B)
                               (/ (/ (- 1.0 (* x x)) (+ 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 <= 205000000.0) {
                          		tmp = ((sqrt(0.5) * F) - x) / B;
                          	} else {
                          		tmp = ((1.0 - (x * x)) / (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.4d0)) then
                                  tmp = ((-1.0d0) - x) / b
                              else if (f <= 205000000.0d0) then
                                  tmp = ((sqrt(0.5d0) * f) - x) / b
                              else
                                  tmp = ((1.0d0 - (x * x)) / (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.4) {
                          		tmp = (-1.0 - x) / B;
                          	} else if (F <= 205000000.0) {
                          		tmp = ((Math.sqrt(0.5) * F) - x) / B;
                          	} else {
                          		tmp = ((1.0 - (x * x)) / (1.0 + x)) / B;
                          	}
                          	return tmp;
                          }
                          
                          def code(F, B, x):
                          	tmp = 0
                          	if F <= -1.4:
                          		tmp = (-1.0 - x) / B
                          	elif F <= 205000000.0:
                          		tmp = ((math.sqrt(0.5) * F) - x) / B
                          	else:
                          		tmp = ((1.0 - (x * x)) / (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 <= 205000000.0)
                          		tmp = Float64(Float64(Float64(sqrt(0.5) * F) - x) / B);
                          	else
                          		tmp = Float64(Float64(Float64(1.0 - Float64(x * x)) / Float64(1.0 + x)) / B);
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(F, B, x)
                          	tmp = 0.0;
                          	if (F <= -1.4)
                          		tmp = (-1.0 - x) / B;
                          	elseif (F <= 205000000.0)
                          		tmp = ((sqrt(0.5) * F) - x) / B;
                          	else
                          		tmp = ((1.0 - (x * x)) / (1.0 + x)) / B;
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[F_, B_, x_] := If[LessEqual[F, -1.4], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 205000000.0], N[(N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;F \leq -1.4:\\
                          \;\;\;\;\frac{-1 - x}{B}\\
                          
                          \mathbf{elif}\;F \leq 205000000:\\
                          \;\;\;\;\frac{\sqrt{0.5} \cdot F - x}{B}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{\frac{1 - x \cdot x}{1 + x}}{B}\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if F < -1.3999999999999999

                            1. Initial program 59.5%

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

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

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

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

                              \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                            7. Step-by-step derivation
                              1. inv-powN/A

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

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

                                \[\leadsto \frac{\sqrt{{\left(2 \cdot x + 2\right)}^{-1}} \cdot F - x}{B} \]
                              4. lower-fma.f6411.3

                                \[\leadsto \frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B} \]
                            8. Applied rewrites11.3%

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

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

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

                              if -1.3999999999999999 < F < 2.05e8

                              1. Initial program 99.6%

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

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

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

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

                                \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                              7. Step-by-step derivation
                                1. inv-powN/A

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

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

                                  \[\leadsto \frac{\sqrt{{\left(2 \cdot x + 2\right)}^{-1}} \cdot F - x}{B} \]
                                4. lower-fma.f6448.2

                                  \[\leadsto \frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B} \]
                              8. Applied rewrites48.2%

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

                                \[\leadsto \frac{\sqrt{\frac{1}{2}} \cdot F - x}{B} \]
                              10. Step-by-step derivation
                                1. Applied rewrites48.2%

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

                                if 2.05e8 < F

                                1. Initial program 47.6%

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

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

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

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

                                  \[\leadsto \frac{1 - x}{B} \]
                                7. Step-by-step derivation
                                  1. lower--.f6445.2

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

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

                                    \[\leadsto \frac{1 - x}{B} \]
                                  2. flip--N/A

                                    \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                                  3. lower-/.f64N/A

                                    \[\leadsto \frac{\frac{1 \cdot 1 - x \cdot x}{1 + x}}{B} \]
                                  4. metadata-evalN/A

                                    \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                                  5. unpow2N/A

                                    \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                                  6. lower--.f64N/A

                                    \[\leadsto \frac{\frac{1 - {x}^{2}}{1 + x}}{B} \]
                                  7. unpow2N/A

                                    \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                                  8. lower-*.f64N/A

                                    \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                                  9. lower-+.f6446.6

                                    \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                                10. Applied rewrites46.6%

                                  \[\leadsto \frac{\frac{1 - x \cdot x}{1 + x}}{B} \]
                              11. Recombined 3 regimes into one program.
                              12. Add Preprocessing

                              Alternative 18: 51.7% accurate, 8.8× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.4:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{elif}\;F \leq 1.75 \cdot 10^{-13}:\\ \;\;\;\;\frac{\sqrt{0.5} \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 1.75e-13) (/ (- (* (sqrt 0.5) 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 <= 1.75e-13) {
                              		tmp = ((sqrt(0.5) * F) - 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.4d0)) then
                                      tmp = ((-1.0d0) - x) / b
                                  else if (f <= 1.75d-13) then
                                      tmp = ((sqrt(0.5d0) * f) - 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.4) {
                              		tmp = (-1.0 - x) / B;
                              	} else if (F <= 1.75e-13) {
                              		tmp = ((Math.sqrt(0.5) * F) - x) / B;
                              	} else {
                              		tmp = (1.0 - x) / B;
                              	}
                              	return tmp;
                              }
                              
                              def code(F, B, x):
                              	tmp = 0
                              	if F <= -1.4:
                              		tmp = (-1.0 - x) / B
                              	elif F <= 1.75e-13:
                              		tmp = ((math.sqrt(0.5) * 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 <= 1.75e-13)
                              		tmp = Float64(Float64(Float64(sqrt(0.5) * F) - 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.4)
                              		tmp = (-1.0 - x) / B;
                              	elseif (F <= 1.75e-13)
                              		tmp = ((sqrt(0.5) * F) - x) / B;
                              	else
                              		tmp = (1.0 - x) / B;
                              	end
                              	tmp_2 = tmp;
                              end
                              
                              code[F_, B_, x_] := If[LessEqual[F, -1.4], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.75e-13], N[(N[(N[(N[Sqrt[0.5], $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 1.75 \cdot 10^{-13}:\\
                              \;\;\;\;\frac{\sqrt{0.5} \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 59.5%

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

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

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

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

                                  \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                                7. Step-by-step derivation
                                  1. inv-powN/A

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

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

                                    \[\leadsto \frac{\sqrt{{\left(2 \cdot x + 2\right)}^{-1}} \cdot F - x}{B} \]
                                  4. lower-fma.f6411.3

                                    \[\leadsto \frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B} \]
                                8. Applied rewrites11.3%

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

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

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

                                  if -1.3999999999999999 < F < 1.7500000000000001e-13

                                  1. Initial program 99.6%

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

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

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

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

                                    \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                                  7. Step-by-step derivation
                                    1. inv-powN/A

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

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

                                      \[\leadsto \frac{\sqrt{{\left(2 \cdot x + 2\right)}^{-1}} \cdot F - x}{B} \]
                                    4. lower-fma.f6449.7

                                      \[\leadsto \frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B} \]
                                  8. Applied rewrites49.7%

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

                                    \[\leadsto \frac{\sqrt{\frac{1}{2}} \cdot F - x}{B} \]
                                  10. Step-by-step derivation
                                    1. Applied rewrites49.7%

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

                                    if 1.7500000000000001e-13 < F

                                    1. Initial program 50.4%

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

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

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

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

                                      \[\leadsto \frac{1 - x}{B} \]
                                    7. Step-by-step derivation
                                      1. lower--.f6442.9

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

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

                                  Alternative 19: 44.2% accurate, 13.6× speedup?

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

                                    1. Initial program 66.5%

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

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

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

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

                                      \[\leadsto \frac{\sqrt{\frac{1}{2 + 2 \cdot x}} \cdot F - x}{B} \]
                                    7. Step-by-step derivation
                                      1. inv-powN/A

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

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

                                        \[\leadsto \frac{\sqrt{{\left(2 \cdot x + 2\right)}^{-1}} \cdot F - x}{B} \]
                                      4. lower-fma.f6415.2

                                        \[\leadsto \frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B} \]
                                    8. Applied rewrites15.2%

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

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

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

                                      if -3.6e-59 < F < 1.2e-63

                                      1. Initial program 99.6%

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

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

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

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

                                        \[\leadsto \frac{-1 \cdot x}{B} \]
                                      7. Step-by-step derivation
                                        1. mul-1-negN/A

                                          \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} \]
                                        2. lower-neg.f6440.1

                                          \[\leadsto \frac{-x}{B} \]
                                      8. Applied rewrites40.1%

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

                                      if 1.2e-63 < F

                                      1. Initial program 56.2%

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

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

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

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

                                        \[\leadsto \frac{1 - x}{B} \]
                                      7. Step-by-step derivation
                                        1. lower--.f6439.6

                                          \[\leadsto \frac{1 - x}{B} \]
                                      8. Applied rewrites39.6%

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

                                    Alternative 20: 36.5% accurate, 17.5× speedup?

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

                                      1. Initial program 85.3%

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

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

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

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

                                        \[\leadsto \frac{-1 \cdot x}{B} \]
                                      7. Step-by-step derivation
                                        1. mul-1-negN/A

                                          \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} \]
                                        2. lower-neg.f6431.7

                                          \[\leadsto \frac{-x}{B} \]
                                      8. Applied rewrites31.7%

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

                                      if 1.2e-63 < F

                                      1. Initial program 56.2%

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

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

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

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

                                        \[\leadsto \frac{1 - x}{B} \]
                                      7. Step-by-step derivation
                                        1. lower--.f6439.6

                                          \[\leadsto \frac{1 - x}{B} \]
                                      8. Applied rewrites39.6%

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

                                    Alternative 21: 29.8% accurate, 18.4× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq 2.05 \cdot 10^{-20}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \end{array} \]
                                    (FPCore (F B x) :precision binary64 (if (<= F 2.05e-20) (/ (- x) B) (/ 1.0 B)))
                                    double code(double F, double B, double x) {
                                    	double tmp;
                                    	if (F <= 2.05e-20) {
                                    		tmp = -x / B;
                                    	} else {
                                    		tmp = 1.0 / 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 <= 2.05d-20) then
                                            tmp = -x / b
                                        else
                                            tmp = 1.0d0 / b
                                        end if
                                        code = tmp
                                    end function
                                    
                                    public static double code(double F, double B, double x) {
                                    	double tmp;
                                    	if (F <= 2.05e-20) {
                                    		tmp = -x / B;
                                    	} else {
                                    		tmp = 1.0 / B;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    def code(F, B, x):
                                    	tmp = 0
                                    	if F <= 2.05e-20:
                                    		tmp = -x / B
                                    	else:
                                    		tmp = 1.0 / B
                                    	return tmp
                                    
                                    function code(F, B, x)
                                    	tmp = 0.0
                                    	if (F <= 2.05e-20)
                                    		tmp = Float64(Float64(-x) / B);
                                    	else
                                    		tmp = Float64(1.0 / B);
                                    	end
                                    	return tmp
                                    end
                                    
                                    function tmp_2 = code(F, B, x)
                                    	tmp = 0.0;
                                    	if (F <= 2.05e-20)
                                    		tmp = -x / B;
                                    	else
                                    		tmp = 1.0 / B;
                                    	end
                                    	tmp_2 = tmp;
                                    end
                                    
                                    code[F_, B_, x_] := If[LessEqual[F, 2.05e-20], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;F \leq 2.05 \cdot 10^{-20}:\\
                                    \;\;\;\;\frac{-x}{B}\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\frac{1}{B}\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if F < 2.05e-20

                                      1. Initial program 86.1%

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

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

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

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

                                        \[\leadsto \frac{-1 \cdot x}{B} \]
                                      7. Step-by-step derivation
                                        1. mul-1-negN/A

                                          \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} \]
                                        2. lower-neg.f6430.7

                                          \[\leadsto \frac{-x}{B} \]
                                      8. Applied rewrites30.7%

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

                                      if 2.05e-20 < F

                                      1. Initial program 50.4%

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

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

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

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

                                        \[\leadsto \frac{1 - x}{B} \]
                                      7. Step-by-step derivation
                                        1. lower--.f6442.9

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

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

                                        \[\leadsto \frac{1}{B} \]
                                      10. Step-by-step derivation
                                        1. Applied rewrites25.7%

                                          \[\leadsto \frac{1}{B} \]
                                      11. Recombined 2 regimes into one program.
                                      12. Add Preprocessing

                                      Alternative 22: 9.5% accurate, 30.7× speedup?

                                      \[\begin{array}{l} \\ \frac{1}{B} \end{array} \]
                                      (FPCore (F B x) :precision binary64 (/ 1.0 B))
                                      double code(double F, double B, double x) {
                                      	return 1.0 / B;
                                      }
                                      
                                      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 = 1.0d0 / b
                                      end function
                                      
                                      public static double code(double F, double B, double x) {
                                      	return 1.0 / B;
                                      }
                                      
                                      def code(F, B, x):
                                      	return 1.0 / B
                                      
                                      function code(F, B, x)
                                      	return Float64(1.0 / B)
                                      end
                                      
                                      function tmp = code(F, B, x)
                                      	tmp = 1.0 / B;
                                      end
                                      
                                      code[F_, B_, x_] := N[(1.0 / B), $MachinePrecision]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \frac{1}{B}
                                      \end{array}
                                      
                                      Derivation
                                      1. Initial program 75.6%

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

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

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

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

                                        \[\leadsto \frac{1 - x}{B} \]
                                      7. Step-by-step derivation
                                        1. lower--.f6425.3

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

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

                                        \[\leadsto \frac{1}{B} \]
                                      10. Step-by-step derivation
                                        1. Applied rewrites9.7%

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

                                        Reproduce

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