VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.2% → 99.5%
Time: 8.7s
Alternatives: 33
Speedup: 1.3×

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}

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

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

Initial Program: 76.2% 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.5% accurate, 0.9× speedup?

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

\mathbf{elif}\;F \leq 1.35 \cdot 10^{+25}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\

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


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e9 < F < 1.35e25

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

    if 1.35e25 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
    7. Applied rewrites56.3%

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

Alternative 2: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -70000000:\\ \;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, \frac{-x}{\tan B}\right)\\ \mathbf{elif}\;F \leq 5 \cdot 10^{+23}:\\ \;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -70000000.0)
   (fma F (/ (/ -1.0 F) (sin B)) (/ (- x) (tan B)))
   (if (<= F 5e+23)
     (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (fma F F 2.0) -0.5)))
     (/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -70000000.0) {
		tmp = fma(F, ((-1.0 / F) / sin(B)), (-x / tan(B)));
	} else if (F <= 5e+23) {
		tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
	} else {
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -70000000.0)
		tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), Float64(Float64(-x) / tan(B)));
	elseif (F <= 5e+23)
		tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5)));
	else
		tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B));
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -70000000.0], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e+23], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $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 -70000000:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, \frac{-x}{\tan B}\right)\\

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

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


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7e7 < F < 4.9999999999999999e23

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

    if 4.9999999999999999e23 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
    7. Applied rewrites56.3%

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

Alternative 3: 99.1% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos B \cdot x\\ \mathbf{if}\;F \leq -1.52:\\ \;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, \frac{-x}{\tan B}\right)\\ \mathbf{elif}\;F \leq 1.65:\\ \;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5} \cdot F - t\_0}{\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 -1.52)
     (fma F (/ (/ -1.0 F) (sin B)) (/ (- x) (tan B)))
     (if (<= F 1.65)
       (/ (- (* (pow (fma 2.0 x 2.0) -0.5) F) t_0) (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 <= -1.52) {
		tmp = fma(F, ((-1.0 / F) / sin(B)), (-x / tan(B)));
	} else if (F <= 1.65) {
		tmp = ((pow(fma(2.0, x, 2.0), -0.5) * F) - t_0) / 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 <= -1.52)
		tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), Float64(Float64(-x) / tan(B)));
	elseif (F <= 1.65)
		tmp = Float64(Float64(Float64((fma(2.0, x, 2.0) ^ -0.5) * F) - t_0) / 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, -1.52], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.65], N[(N[(N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - t$95$0), $MachinePrecision] / N[Sin[B], $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 -1.52:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, \frac{-x}{\tan B}\right)\\

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

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


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.52 < F < 1.6499999999999999

    1. Initial program 76.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. Taylor expanded in F around 0

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

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

        \[\leadsto \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{\sin B} - \frac{x \cdot \cos B}{\sin B} \]
      3. sub-divN/A

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

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

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

    if 1.6499999999999999 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
    7. Applied rewrites56.3%

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

Alternative 4: 92.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -0.182:\\ \;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, \frac{-x}{\tan B}\right)\\ \mathbf{elif}\;F \leq 1700:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -0.182)
   (fma F (/ (/ -1.0 F) (sin B)) (/ (- x) (tan B)))
   (if (<= F 1700.0)
     (+
      (- (/ (* x 1.0) (tan B)))
      (/ (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) B))
     (/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -0.182) {
		tmp = fma(F, ((-1.0 / F) / sin(B)), (-x / tan(B)));
	} else if (F <= 1700.0) {
		tmp = -((x * 1.0) / tan(B)) + ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) / B);
	} else {
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -0.182)
		tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), Float64(Float64(-x) / tan(B)));
	elseif (F <= 1700.0)
		tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) / B));
	else
		tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B));
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -0.182], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1700.0], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $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 -0.182:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, \frac{-x}{\tan B}\right)\\

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

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


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.182 < F < 1700

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

    if 1700 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
    7. Applied rewrites56.3%

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

Alternative 5: 92.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos B \cdot x\\ \mathbf{if}\;F \leq -0.182:\\ \;\;\;\;-\frac{1 + t\_0}{\sin B \cdot F} \cdot F\\ \mathbf{elif}\;F \leq 1700:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F}{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 -0.182)
     (- (* (/ (+ 1.0 t_0) (* (sin B) F)) F))
     (if (<= F 1700.0)
       (+
        (- (/ (* x 1.0) (tan B)))
        (/ (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) 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 <= -0.182) {
		tmp = -(((1.0 + t_0) / (sin(B) * F)) * F);
	} else if (F <= 1700.0) {
		tmp = -((x * 1.0) / tan(B)) + ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) / 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 <= -0.182)
		tmp = Float64(-Float64(Float64(Float64(1.0 + t_0) / Float64(sin(B) * F)) * F));
	elseif (F <= 1700.0)
		tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) / 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, -0.182], (-N[(N[(N[(1.0 + t$95$0), $MachinePrecision] / N[(N[Sin[B], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), If[LessEqual[F, 1700.0], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $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 -0.182:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B \cdot F} \cdot F\\

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

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


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

        \[\leadsto -F \cdot \left(\frac{1}{F \cdot \sin B} + \frac{x \cdot \cos B}{F \cdot \sin B}\right) \]
      3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B \cdot F} \cdot F \]
      13. lift-sin.f6450.7

        \[\leadsto -\frac{1 + \cos B \cdot x}{\sin B \cdot F} \cdot F \]
    4. Applied rewrites50.7%

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

    if -0.182 < F < 1700

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

    if 1700 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
    7. Applied rewrites56.3%

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

Alternative 6: 85.3% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -2.6 \cdot 10^{+92}:\\ \;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \frac{-1}{F}}{\sin B}\\ \mathbf{elif}\;F \leq 1700:\\ \;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -2.6e+92)
   (+ (- (/ x B)) (/ (* F (/ -1.0 F)) (sin B)))
   (if (<= F 1700.0)
     (+
      (- (/ (* x 1.0) (tan B)))
      (/ (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) B))
     (/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -2.6e+92) {
		tmp = -(x / B) + ((F * (-1.0 / F)) / sin(B));
	} else if (F <= 1700.0) {
		tmp = -((x * 1.0) / tan(B)) + ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) / B);
	} else {
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -2.6e+92)
		tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * Float64(-1.0 / F)) / sin(B)));
	elseif (F <= 1700.0)
		tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) / B));
	else
		tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B));
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -2.6e+92], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1700.0], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $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 -2.6 \cdot 10^{+92}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \frac{-1}{F}}{\sin B}\\

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

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


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5999999999999999e92 < F < 1700

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

    if 1700 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
    7. Applied rewrites56.3%

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

Alternative 7: 85.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -2.6 \cdot 10^{+92}:\\ \;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \frac{-1}{F}}{\sin B}\\ \mathbf{elif}\;F \leq 1700:\\ \;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -2.6e+92)
   (+ (- (/ x B)) (/ (* F (/ -1.0 F)) (sin B)))
   (if (<= F 1700.0)
     (+
      (- (* x (/ 1.0 (tan B))))
      (/ (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) B))
     (/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -2.6e+92) {
		tmp = -(x / B) + ((F * (-1.0 / F)) / sin(B));
	} else if (F <= 1700.0) {
		tmp = -(x * (1.0 / tan(B))) + ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) / B);
	} else {
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -2.6e+92)
		tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * Float64(-1.0 / F)) / sin(B)));
	elseif (F <= 1700.0)
		tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) / B));
	else
		tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B));
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -2.6e+92], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1700.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $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 -2.6 \cdot 10^{+92}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \frac{-1}{F}}{\sin B}\\

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

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


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5999999999999999e92 < F < 1700

    1. Initial program 76.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. Taylor expanded in B around 0

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

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

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

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

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

    if 1700 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
    7. Applied rewrites56.3%

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

Alternative 8: 83.5% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos B \cdot x\\ t_1 := -\frac{x}{B}\\ t_2 := t\_1 + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\ \mathbf{if}\;F \leq -200000000:\\ \;\;\;\;t\_1 + \frac{F \cdot \frac{-1}{F}}{\sin B}\\ \mathbf{elif}\;F \leq -3.7 \cdot 10^{-227}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;F \leq 3.8 \cdot 10^{-130}:\\ \;\;\;\;-\frac{t\_0}{\sin B}\\ \mathbf{elif}\;F \leq 24000:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - t\_0}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (* (cos B) x))
        (t_1 (- (/ x B)))
        (t_2 (+ t_1 (* (/ F (sin B)) (pow (fma F F 2.0) -0.5)))))
   (if (<= F -200000000.0)
     (+ t_1 (/ (* F (/ -1.0 F)) (sin B)))
     (if (<= F -3.7e-227)
       t_2
       (if (<= F 3.8e-130)
         (- (/ t_0 (sin B)))
         (if (<= F 24000.0) t_2 (/ (- 1.0 t_0) (sin B))))))))
double code(double F, double B, double x) {
	double t_0 = cos(B) * x;
	double t_1 = -(x / B);
	double t_2 = t_1 + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
	double tmp;
	if (F <= -200000000.0) {
		tmp = t_1 + ((F * (-1.0 / F)) / sin(B));
	} else if (F <= -3.7e-227) {
		tmp = t_2;
	} else if (F <= 3.8e-130) {
		tmp = -(t_0 / sin(B));
	} else if (F <= 24000.0) {
		tmp = t_2;
	} else {
		tmp = (1.0 - t_0) / sin(B);
	}
	return tmp;
}
function code(F, B, x)
	t_0 = Float64(cos(B) * x)
	t_1 = Float64(-Float64(x / B))
	t_2 = Float64(t_1 + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5)))
	tmp = 0.0
	if (F <= -200000000.0)
		tmp = Float64(t_1 + Float64(Float64(F * Float64(-1.0 / F)) / sin(B)));
	elseif (F <= -3.7e-227)
		tmp = t_2;
	elseif (F <= 3.8e-130)
		tmp = Float64(-Float64(t_0 / sin(B)));
	elseif (F <= 24000.0)
		tmp = t_2;
	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]}, Block[{t$95$1 = (-N[(x / B), $MachinePrecision])}, Block[{t$95$2 = N[(t$95$1 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -200000000.0], N[(t$95$1 + N[(N[(F * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -3.7e-227], t$95$2, If[LessEqual[F, 3.8e-130], (-N[(t$95$0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 24000.0], t$95$2, 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\\
t_1 := -\frac{x}{B}\\
t_2 := t\_1 + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{if}\;F \leq -200000000:\\
\;\;\;\;t\_1 + \frac{F \cdot \frac{-1}{F}}{\sin B}\\

\mathbf{elif}\;F \leq -3.7 \cdot 10^{-227}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;F \leq 3.8 \cdot 10^{-130}:\\
\;\;\;\;-\frac{t\_0}{\sin B}\\

\mathbf{elif}\;F \leq 24000:\\
\;\;\;\;t\_2\\

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


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e8 < F < -3.69999999999999978e-227 or 3.7999999999999998e-130 < F < 24000

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

    if -3.69999999999999978e-227 < F < 3.7999999999999998e-130

    1. Initial program 76.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. Taylor expanded in F around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    3. 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.f6455.4

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

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

    if 24000 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 - \cos B \cdot x}{\sin B} \]
    7. Applied rewrites56.3%

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

Alternative 9: 74.7% accurate, 1.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.0499999999999999e-11 or 4.25000000000000023e-38 < x

    1. Initial program 76.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. Taylor expanded in F around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    3. 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.f6455.4

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

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

    if -1.0499999999999999e-11 < x < 4.25000000000000023e-38

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

Alternative 10: 69.6% accurate, 1.6× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{F}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B} \cdot \frac{-1}{F}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.46000000000000008e-5

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{B}} \cdot \frac{-1}{F} \]
    6. Step-by-step derivation
      1. lower-/.f6447.0

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

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

    if -1.46000000000000008e-5 < x < 4.1000000000000004e-34

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

    if 4.1000000000000004e-34 < x

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\mathsf{fma}\left(B \cdot B, \frac{-1}{6}, 1\right) \cdot B} \cdot \frac{-1}{F} \]
      7. lower-*.f6447.9

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B} \cdot \frac{-1}{F} \]
    7. Applied rewrites47.9%

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

Alternative 11: 64.9% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B \leq 80000:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\

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


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

    1. Initial program 76.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. Taylor expanded in B around 0

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

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

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

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

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

    if 8e4 < B

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\mathsf{fma}\left(B \cdot B, \frac{-1}{6}, 1\right) \cdot B} \cdot \frac{-1}{F} \]
      7. lower-*.f6447.9

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B} \cdot \frac{-1}{F} \]
    7. Applied rewrites47.9%

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

Alternative 12: 64.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B \leq 80000:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\

\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot \frac{-1}{F}\\


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

    1. Initial program 76.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. Taylor expanded in B around 0

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

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

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

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

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

    if 8e4 < B

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{B}} \cdot \frac{-1}{F} \]
    6. Step-by-step derivation
      1. lower-/.f6447.0

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

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

Alternative 13: 58.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.182:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \frac{-1}{F}}{\sin B}\\

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

\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sin B \cdot F} + \left(-\frac{x}{F \cdot B}\right)\right) \cdot F\\


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.182 < F < 1700

    1. Initial program 76.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. Step-by-step derivation
      1. 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)}} \]
      2. 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)} \]
      3. 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)} \]
      4. 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)} \]
      5. 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)} \]
      6. 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(-\color{blue}{\frac{1}{2}}\right)} \]
      7. 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)}} \]
      8. sqr-powN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{F \cdot {\left({\left(2 + \mathsf{fma}\left(2, x, F \cdot F\right)\right)}^{\frac{-1}{4}}\right)}^{2} - x}{B} \]
      9. lower-*.f6443.3

        \[\leadsto \frac{F \cdot {\left({\left(2 + \mathsf{fma}\left(2, x, F \cdot F\right)\right)}^{-0.25}\right)}^{2} - x}{B} \]
    6. Applied rewrites43.3%

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

    if 1700 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{\sin B \cdot F} + \left(-\frac{x}{F \cdot B}\right)\right) \cdot F \]
      3. lower-*.f6431.5

        \[\leadsto \left(\frac{1}{\sin B \cdot F} + \left(-\frac{x}{F \cdot B}\right)\right) \cdot F \]
    7. Applied rewrites31.5%

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

Alternative 14: 56.4% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;F \leq 1700:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sin B \cdot F} + \left(-\frac{x}{F \cdot B}\right)\right) \cdot F\\


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.182 < F < 1700

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

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

        \[\leadsto \left(-\frac{x}{B}\right) + \frac{F}{\color{blue}{B}} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5} \]
    10. Applied rewrites34.8%

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

    if 1700 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{\sin B \cdot F} + \left(-\frac{x}{F \cdot B}\right)\right) \cdot F \]
      3. lower-*.f6431.5

        \[\leadsto \left(\frac{1}{\sin B \cdot F} + \left(-\frac{x}{F \cdot B}\right)\right) \cdot F \]
    7. Applied rewrites31.5%

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

Alternative 15: 55.9% accurate, 2.0× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot \frac{1}{F}\\


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

    1. Initial program 76.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. Taylor expanded in F around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.182 < F < 1.4e29

    1. Initial program 76.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. Taylor expanded in B around 0

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

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

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

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

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

    if 1.4e29 < F

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

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

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

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

Alternative 16: 53.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
t_1 := \frac{F}{\sin B}\\
\mathbf{if}\;F \leq -5.2 \cdot 10^{+174}:\\
\;\;\;\;\frac{-\left(\left(-\frac{\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F} \cdot 0.5 - x}{F}\right) + \frac{1}{F}\right) \cdot F}{B}\\

\mathbf{elif}\;F \leq -0.182:\\
\;\;\;\;t\_0 + t\_1 \cdot \frac{-1}{F}\\

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

\mathbf{else}:\\
\;\;\;\;t\_0 + t\_1 \cdot \frac{1}{F}\\


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

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - x}{F} + \frac{1}{F}\right)\right)}{B} \]
    8. Applied rewrites22.1%

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

    if -5.1999999999999997e174 < F < -0.182

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

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

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

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

    if -0.182 < F < 1.4e29

    1. Initial program 76.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. Taylor expanded in B around 0

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

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

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

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

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

    if 1.4e29 < F

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

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

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

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

Alternative 17: 52.8% accurate, 2.0× speedup?

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

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

\mathbf{elif}\;F \leq -0.182:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \frac{-1}{F}\\

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

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


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

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - x}{F} + \frac{1}{F}\right)\right)}{B} \]
    8. Applied rewrites22.1%

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

    if -5.1999999999999997e174 < F < -0.182

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

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

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

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

    if -0.182 < F < 3.2e177

    1. Initial program 76.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. Taylor expanded in B around 0

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

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

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

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

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

    if 3.2e177 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

        \[\leadsto \frac{1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6416.9

        \[\leadsto \frac{1}{\sin B} \]
    4. Applied rewrites16.9%

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

Alternative 18: 52.7% accurate, 2.4× speedup?

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

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

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

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

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


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

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - x}{F} + \frac{1}{F}\right)\right)}{B} \]
    8. Applied rewrites22.1%

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

    if -3.7500000000000002e174 < F < -0.182

    1. Initial program 76.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. Taylor expanded in F around -inf

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

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6417.7

        \[\leadsto \frac{-1}{\sin B} \]
    4. Applied rewrites17.7%

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

    if -0.182 < F < 3.2e177

    1. Initial program 76.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. Taylor expanded in B around 0

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

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

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

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

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

    if 3.2e177 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

        \[\leadsto \frac{1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6416.9

        \[\leadsto \frac{1}{\sin B} \]
    4. Applied rewrites16.9%

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

Alternative 19: 51.6% accurate, 2.4× speedup?

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

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

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

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

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


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

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - x}{F} + \frac{1}{F}\right)\right)}{B} \]
    8. Applied rewrites22.1%

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

    if -3.7500000000000002e174 < F < -0.182

    1. Initial program 76.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. Taylor expanded in F around -inf

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

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6417.7

        \[\leadsto \frac{-1}{\sin B} \]
    4. Applied rewrites17.7%

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

    if -0.182 < F < 3800

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

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

        \[\leadsto \left(-\frac{x}{B}\right) + \frac{F}{\color{blue}{B}} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5} \]
    10. Applied rewrites34.8%

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

    if 3800 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

        \[\leadsto \frac{1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6416.9

        \[\leadsto \frac{1}{\sin B} \]
    4. Applied rewrites16.9%

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

Alternative 20: 51.4% accurate, 2.5× speedup?

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

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

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

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

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


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

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - x}{F} + \frac{1}{F}\right)\right)}{B} \]
    8. Applied rewrites22.1%

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

    if -3.7500000000000002e174 < F < -0.182

    1. Initial program 76.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. Taylor expanded in F around -inf

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

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6417.7

        \[\leadsto \frac{-1}{\sin B} \]
    4. Applied rewrites17.7%

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

    if -0.182 < F < 3800

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

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

        \[\leadsto \left(-\frac{x}{B}\right) + \frac{F}{\color{blue}{B}} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5} \]
    10. Applied rewrites34.8%

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

    if 3800 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

      \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
      2. sub-divN/A

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

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      4. lower--.f6427.2

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
    7. Applied rewrites27.2%

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

Alternative 21: 50.8% accurate, 2.7× speedup?

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

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

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

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


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

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(-1 \cdot \frac{\frac{1}{2} \cdot \frac{2 + 2 \cdot x}{{F}^{2}} - x}{F} + \frac{1}{F}\right)\right)}{B} \]
    8. Applied rewrites22.1%

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

    if -4.00000000000000017e36 < F < 3800

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

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

        \[\leadsto \left(-\frac{x}{B}\right) + \frac{F}{\color{blue}{B}} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5} \]
    10. Applied rewrites34.8%

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

    if 3800 < F

    1. Initial program 76.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. Taylor expanded in F around inf

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

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

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

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

      \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
      2. sub-divN/A

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

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      4. lower--.f6427.2

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
    7. Applied rewrites27.2%

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

Alternative 22: 50.8% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -0.182:\\ \;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\ \mathbf{elif}\;F \leq 3800:\\ \;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -0.182)
   (/ (- (* (/ (+ 1.0 x) F) F)) B)
   (if (<= F 3800.0)
     (+ (- (/ x B)) (* (/ F B) (pow (fma F F 2.0) -0.5)))
     (* (/ (/ (- 1.0 x) F) B) F))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -0.182) {
		tmp = -(((1.0 + x) / F) * F) / B;
	} else if (F <= 3800.0) {
		tmp = -(x / B) + ((F / B) * pow(fma(F, F, 2.0), -0.5));
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -0.182)
		tmp = Float64(Float64(-Float64(Float64(Float64(1.0 + x) / F) * F)) / B);
	elseif (F <= 3800.0)
		tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / B) * (fma(F, F, 2.0) ^ -0.5)));
	else
		tmp = Float64(Float64(Float64(Float64(1.0 - x) / F) / B) * F);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -0.182], N[((-N[(N[(N[(1.0 + x), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]) / B), $MachinePrecision], If[LessEqual[F, 3800.0], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 - x), $MachinePrecision] / F), $MachinePrecision] / B), $MachinePrecision] * F), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.182:\\
\;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\

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

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


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

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      7. lower-+.f6429.0

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
    9. Applied rewrites29.0%

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

    if -0.182 < F < 3800

    1. Initial program 76.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. Taylor expanded in x around 0

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \]
      8. metadata-eval76.1

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

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

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

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

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

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

        \[\leadsto \left(-\frac{x}{B}\right) + \frac{F}{\color{blue}{B}} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5} \]
    10. Applied rewrites34.8%

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

    if 3800 < F

    1. Initial program 76.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. Taylor expanded in F around inf

      \[\leadsto \color{blue}{F \cdot \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
      2. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
    4. Applied rewrites47.8%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin B \cdot F} + \left(-\frac{\cos B \cdot x}{\sin B \cdot F}\right)\right) \cdot F} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
      2. sub-divN/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      4. lower--.f6427.2

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
    7. Applied rewrites27.2%

      \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 23: 50.6% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -0.182:\\ \;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\ \mathbf{elif}\;F \leq 3900:\\ \;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5}}{B}, \frac{-x}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -0.182)
   (/ (- (* (/ (+ 1.0 x) F) F)) B)
   (if (<= F 3900.0)
     (fma F (/ (pow (fma 2.0 x 2.0) -0.5) B) (/ (- x) B))
     (* (/ (/ (- 1.0 x) F) B) F))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -0.182) {
		tmp = -(((1.0 + x) / F) * F) / B;
	} else if (F <= 3900.0) {
		tmp = fma(F, (pow(fma(2.0, x, 2.0), -0.5) / B), (-x / B));
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -0.182)
		tmp = Float64(Float64(-Float64(Float64(Float64(1.0 + x) / F) * F)) / B);
	elseif (F <= 3900.0)
		tmp = fma(F, Float64((fma(2.0, x, 2.0) ^ -0.5) / B), Float64(Float64(-x) / B));
	else
		tmp = Float64(Float64(Float64(Float64(1.0 - x) / F) / B) * F);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -0.182], N[((-N[(N[(N[(1.0 + x), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]) / B), $MachinePrecision], If[LessEqual[F, 3900.0], N[(F * N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $MachinePrecision] / B), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 - x), $MachinePrecision] / F), $MachinePrecision] / B), $MachinePrecision] * F), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.182:\\
\;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\

\mathbf{elif}\;F \leq 3900:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5}}{B}, \frac{-x}{B}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -0.182

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{-F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)}{B} \]
      3. *-commutativeN/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      5. div-add-revN/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      7. lower-+.f6429.0

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
    9. Applied rewrites29.0%

      \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]

    if -0.182 < F < 3900

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto -1 \cdot \frac{x}{B} + \color{blue}{\frac{F \cdot {\left(2 + 2 \cdot x\right)}^{\frac{-1}{2}}}{B}} \]
    8. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto -1 \cdot \frac{x}{B} + \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{B} \]
      2. metadata-evalN/A

        \[\leadsto -1 \cdot \frac{x}{B} + \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{B} \]
      3. +-commutativeN/A

        \[\leadsto \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{B} + -1 \cdot \color{blue}{\frac{x}{B}} \]
      4. associate-/l*N/A

        \[\leadsto F \cdot \frac{{\left(2 + 2 \cdot x\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{B} + -1 \cdot \frac{\color{blue}{x}}{B} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(2 + 2 \cdot x\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{\color{blue}{B}}, -1 \cdot \frac{x}{B}\right) \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(2 + 2 \cdot x\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{B}, -1 \cdot \frac{x}{B}\right) \]
      7. lower-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(2 + 2 \cdot x\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{B}, -1 \cdot \frac{x}{B}\right) \]
      8. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(2 \cdot x + 2\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{B}, -1 \cdot \frac{x}{B}\right) \]
      9. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{B}, -1 \cdot \frac{x}{B}\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}}{B}, -1 \cdot \frac{x}{B}\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{\frac{-1}{2}}}{B}, -1 \cdot \frac{x}{B}\right) \]
      12. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{\frac{-1}{2}}}{B}, \frac{-1 \cdot x}{B}\right) \]
      13. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{\frac{-1}{2}}}{B}, \frac{\mathsf{neg}\left(x\right)}{B}\right) \]
      14. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{\frac{-1}{2}}}{B}, \frac{\mathsf{neg}\left(x\right)}{B}\right) \]
    9. Applied rewrites29.3%

      \[\leadsto \mathsf{fma}\left(F, \color{blue}{\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5}}{B}}, \frac{-x}{B}\right) \]

    if 3900 < F

    1. Initial program 76.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. Taylor expanded in F around inf

      \[\leadsto \color{blue}{F \cdot \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
      2. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
    4. Applied rewrites47.8%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin B \cdot F} + \left(-\frac{\cos B \cdot x}{\sin B \cdot F}\right)\right) \cdot F} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
      2. sub-divN/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      4. lower--.f6427.2

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
    7. Applied rewrites27.2%

      \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 24: 50.6% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -0.182:\\ \;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\ \mathbf{elif}\;F \leq 3900:\\ \;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5} \cdot F - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -0.182)
   (/ (- (* (/ (+ 1.0 x) F) F)) B)
   (if (<= F 3900.0)
     (/ (- (* (pow (fma 2.0 x 2.0) -0.5) F) x) B)
     (* (/ (/ (- 1.0 x) F) B) F))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -0.182) {
		tmp = -(((1.0 + x) / F) * F) / B;
	} else if (F <= 3900.0) {
		tmp = ((pow(fma(2.0, x, 2.0), -0.5) * F) - x) / B;
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	return tmp;
}
function code(F, B, x)
	tmp = 0.0
	if (F <= -0.182)
		tmp = Float64(Float64(-Float64(Float64(Float64(1.0 + x) / F) * F)) / B);
	elseif (F <= 3900.0)
		tmp = Float64(Float64(Float64((fma(2.0, x, 2.0) ^ -0.5) * F) - x) / B);
	else
		tmp = Float64(Float64(Float64(Float64(1.0 - x) / F) / B) * F);
	end
	return tmp
end
code[F_, B_, x_] := If[LessEqual[F, -0.182], N[((-N[(N[(N[(1.0 + x), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]) / B), $MachinePrecision], If[LessEqual[F, 3900.0], N[(N[(N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(1.0 - x), $MachinePrecision] / F), $MachinePrecision] / B), $MachinePrecision] * F), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.182:\\
\;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\

\mathbf{elif}\;F \leq 3900:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5} \cdot F - x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -0.182

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{-F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)}{B} \]
      3. *-commutativeN/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      5. div-add-revN/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      7. lower-+.f6429.0

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
    9. Applied rewrites29.0%

      \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]

    if -0.182 < F < 3900

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \frac{{\left(2 + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot F - x}{B} \]
    8. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{{\left(2 \cdot x + 2\right)}^{\frac{-1}{2}} \cdot F - x}{B} \]
      2. lower-fma.f6429.1

        \[\leadsto \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5} \cdot F - x}{B} \]
    9. Applied rewrites29.1%

      \[\leadsto \frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-0.5} \cdot F - x}{B} \]

    if 3900 < F

    1. Initial program 76.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. Taylor expanded in F around inf

      \[\leadsto \color{blue}{F \cdot \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
      2. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
    4. Applied rewrites47.8%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin B \cdot F} + \left(-\frac{\cos B \cdot x}{\sin B \cdot F}\right)\right) \cdot F} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
      2. sub-divN/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      4. lower--.f6427.2

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
    7. Applied rewrites27.2%

      \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 25: 43.4% accurate, 4.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -5.7 \cdot 10^{-61}:\\ \;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\ \mathbf{elif}\;F \leq 9.2 \cdot 10^{-69}:\\ \;\;\;\;\frac{\left(0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right) - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{-x}{F} + \frac{1}{F}\right) \cdot F}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -5.7e-61)
   (/ (- (* (/ (+ 1.0 x) F) F)) B)
   (if (<= F 9.2e-69)
     (/ (- (* (* 0.3333333333333333 x) (* B B)) x) B)
     (/ (* (+ (/ (- x) F) (/ 1.0 F)) F) B))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -5.7e-61) {
		tmp = -(((1.0 + x) / F) * F) / B;
	} else if (F <= 9.2e-69) {
		tmp = (((0.3333333333333333 * x) * (B * B)) - x) / B;
	} else {
		tmp = (((-x / F) + (1.0 / F)) * F) / 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 <= (-5.7d-61)) then
        tmp = -(((1.0d0 + x) / f) * f) / b
    else if (f <= 9.2d-69) then
        tmp = (((0.3333333333333333d0 * x) * (b * b)) - x) / b
    else
        tmp = (((-x / f) + (1.0d0 / f)) * f) / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -5.7e-61) {
		tmp = -(((1.0 + x) / F) * F) / B;
	} else if (F <= 9.2e-69) {
		tmp = (((0.3333333333333333 * x) * (B * B)) - x) / B;
	} else {
		tmp = (((-x / F) + (1.0 / F)) * F) / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -5.7e-61:
		tmp = -(((1.0 + x) / F) * F) / B
	elif F <= 9.2e-69:
		tmp = (((0.3333333333333333 * x) * (B * B)) - x) / B
	else:
		tmp = (((-x / F) + (1.0 / F)) * F) / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -5.7e-61)
		tmp = Float64(Float64(-Float64(Float64(Float64(1.0 + x) / F) * F)) / B);
	elseif (F <= 9.2e-69)
		tmp = Float64(Float64(Float64(Float64(0.3333333333333333 * x) * Float64(B * B)) - x) / B);
	else
		tmp = Float64(Float64(Float64(Float64(Float64(-x) / F) + Float64(1.0 / F)) * F) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -5.7e-61)
		tmp = -(((1.0 + x) / F) * F) / B;
	elseif (F <= 9.2e-69)
		tmp = (((0.3333333333333333 * x) * (B * B)) - x) / B;
	else
		tmp = (((-x / F) + (1.0 / F)) * F) / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -5.7e-61], N[((-N[(N[(N[(1.0 + x), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]) / B), $MachinePrecision], If[LessEqual[F, 9.2e-69], N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[((-x) / F), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.7 \cdot 10^{-61}:\\
\;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\

\mathbf{elif}\;F \leq 9.2 \cdot 10^{-69}:\\
\;\;\;\;\frac{\left(0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right) - x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{-x}{F} + \frac{1}{F}\right) \cdot F}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -5.70000000000000005e-61

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{-F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)}{B} \]
      3. *-commutativeN/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      5. div-add-revN/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      7. lower-+.f6429.0

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
    9. Applied rewrites29.0%

      \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]

    if -5.70000000000000005e-61 < F < 9.2000000000000003e-69

    1. Initial program 76.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. Taylor expanded in F around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    3. 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.f6455.4

        \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
    4. Applied rewrites55.4%

      \[\leadsto \color{blue}{-\frac{\cos B \cdot x}{\sin B}} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{{B}^{2} \cdot \left(\frac{-1}{6} \cdot x - \frac{-1}{2} \cdot x\right) - x}{\color{blue}{B}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{{B}^{2} \cdot \left(\frac{-1}{6} \cdot x - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot x\right) - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{{B}^{2} \cdot \left(\frac{-1}{6} \cdot x - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot x\right) - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{{B}^{2} \cdot \left(\frac{-1}{6} \cdot x - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot x\right) - x}{B} \]
    7. Applied rewrites28.7%

      \[\leadsto \frac{\left(0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right) - x}{\color{blue}{B}} \]

    if 9.2000000000000003e-69 < F

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around inf

      \[\leadsto \frac{F \cdot \left(-1 \cdot \frac{x}{F} + \frac{1}{F}\right)}{B} \]
    8. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(-1 \cdot \frac{x}{F} + \frac{1}{F}\right) \cdot F}{B} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(-1 \cdot \frac{x}{F} + \frac{1}{F}\right) \cdot F}{B} \]
      3. lower-+.f64N/A

        \[\leadsto \frac{\left(-1 \cdot \frac{x}{F} + \frac{1}{F}\right) \cdot F}{B} \]
      4. associate-*r/N/A

        \[\leadsto \frac{\left(\frac{-1 \cdot x}{F} + \frac{1}{F}\right) \cdot F}{B} \]
      5. mul-1-negN/A

        \[\leadsto \frac{\left(\frac{\mathsf{neg}\left(x\right)}{F} + \frac{1}{F}\right) \cdot F}{B} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{\mathsf{neg}\left(x\right)}{F} + \frac{1}{F}\right) \cdot F}{B} \]
      7. lower-neg.f64N/A

        \[\leadsto \frac{\left(\frac{-x}{F} + \frac{1}{F}\right) \cdot F}{B} \]
      8. lower-/.f6428.5

        \[\leadsto \frac{\left(\frac{-x}{F} + \frac{1}{F}\right) \cdot F}{B} \]
    9. Applied rewrites28.5%

      \[\leadsto \frac{\left(\frac{-x}{F} + \frac{1}{F}\right) \cdot F}{B} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 26: 43.3% accurate, 4.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -5.7 \cdot 10^{-61}:\\ \;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\ \mathbf{elif}\;F \leq 3 \cdot 10^{-52}:\\ \;\;\;\;\frac{\left(0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right) - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -5.7e-61)
   (/ (- (* (/ (+ 1.0 x) F) F)) B)
   (if (<= F 3e-52)
     (/ (- (* (* 0.3333333333333333 x) (* B B)) x) B)
     (* (/ (/ (- 1.0 x) F) B) F))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -5.7e-61) {
		tmp = -(((1.0 + x) / F) * F) / B;
	} else if (F <= 3e-52) {
		tmp = (((0.3333333333333333 * x) * (B * B)) - x) / B;
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	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 <= (-5.7d-61)) then
        tmp = -(((1.0d0 + x) / f) * f) / b
    else if (f <= 3d-52) then
        tmp = (((0.3333333333333333d0 * x) * (b * b)) - x) / b
    else
        tmp = (((1.0d0 - x) / f) / b) * f
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -5.7e-61) {
		tmp = -(((1.0 + x) / F) * F) / B;
	} else if (F <= 3e-52) {
		tmp = (((0.3333333333333333 * x) * (B * B)) - x) / B;
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -5.7e-61:
		tmp = -(((1.0 + x) / F) * F) / B
	elif F <= 3e-52:
		tmp = (((0.3333333333333333 * x) * (B * B)) - x) / B
	else:
		tmp = (((1.0 - x) / F) / B) * F
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -5.7e-61)
		tmp = Float64(Float64(-Float64(Float64(Float64(1.0 + x) / F) * F)) / B);
	elseif (F <= 3e-52)
		tmp = Float64(Float64(Float64(Float64(0.3333333333333333 * x) * Float64(B * B)) - x) / B);
	else
		tmp = Float64(Float64(Float64(Float64(1.0 - x) / F) / B) * F);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -5.7e-61)
		tmp = -(((1.0 + x) / F) * F) / B;
	elseif (F <= 3e-52)
		tmp = (((0.3333333333333333 * x) * (B * B)) - x) / B;
	else
		tmp = (((1.0 - x) / F) / B) * F;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -5.7e-61], N[((-N[(N[(N[(1.0 + x), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]) / B), $MachinePrecision], If[LessEqual[F, 3e-52], N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(1.0 - x), $MachinePrecision] / F), $MachinePrecision] / B), $MachinePrecision] * F), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.7 \cdot 10^{-61}:\\
\;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\

\mathbf{elif}\;F \leq 3 \cdot 10^{-52}:\\
\;\;\;\;\frac{\left(0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right) - x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -5.70000000000000005e-61

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{-F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)}{B} \]
      3. *-commutativeN/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      5. div-add-revN/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      7. lower-+.f6429.0

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
    9. Applied rewrites29.0%

      \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]

    if -5.70000000000000005e-61 < F < 3e-52

    1. Initial program 76.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. Taylor expanded in F around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    3. 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.f6455.4

        \[\leadsto -\frac{\cos B \cdot x}{\sin B} \]
    4. Applied rewrites55.4%

      \[\leadsto \color{blue}{-\frac{\cos B \cdot x}{\sin B}} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{{B}^{2} \cdot \left(\frac{-1}{6} \cdot x - \frac{-1}{2} \cdot x\right) - x}{\color{blue}{B}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{{B}^{2} \cdot \left(\frac{-1}{6} \cdot x - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot x\right) - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{{B}^{2} \cdot \left(\frac{-1}{6} \cdot x - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot x\right) - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{{B}^{2} \cdot \left(\frac{-1}{6} \cdot x - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot x\right) - x}{B} \]
    7. Applied rewrites28.7%

      \[\leadsto \frac{\left(0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right) - x}{\color{blue}{B}} \]

    if 3e-52 < F

    1. Initial program 76.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. Taylor expanded in F around inf

      \[\leadsto \color{blue}{F \cdot \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
      2. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
    4. Applied rewrites47.8%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin B \cdot F} + \left(-\frac{\cos B \cdot x}{\sin B \cdot F}\right)\right) \cdot F} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
      2. sub-divN/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      4. lower--.f6427.2

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
    7. Applied rewrites27.2%

      \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 27: 43.2% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -2.65 \cdot 10^{-37}:\\ \;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\ \mathbf{elif}\;F \leq 3.25 \cdot 10^{-40}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -2.65e-37)
   (/ (- (* (/ (+ 1.0 x) F) F)) B)
   (if (<= F 3.25e-40) (/ (- x) B) (* (/ (/ (- 1.0 x) F) B) F))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -2.65e-37) {
		tmp = -(((1.0 + x) / F) * F) / B;
	} else if (F <= 3.25e-40) {
		tmp = -x / B;
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	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.65d-37)) then
        tmp = -(((1.0d0 + x) / f) * f) / b
    else if (f <= 3.25d-40) then
        tmp = -x / b
    else
        tmp = (((1.0d0 - x) / f) / b) * f
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -2.65e-37) {
		tmp = -(((1.0 + x) / F) * F) / B;
	} else if (F <= 3.25e-40) {
		tmp = -x / B;
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -2.65e-37:
		tmp = -(((1.0 + x) / F) * F) / B
	elif F <= 3.25e-40:
		tmp = -x / B
	else:
		tmp = (((1.0 - x) / F) / B) * F
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -2.65e-37)
		tmp = Float64(Float64(-Float64(Float64(Float64(1.0 + x) / F) * F)) / B);
	elseif (F <= 3.25e-40)
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(Float64(Float64(Float64(1.0 - x) / F) / B) * F);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -2.65e-37)
		tmp = -(((1.0 + x) / F) * F) / B;
	elseif (F <= 3.25e-40)
		tmp = -x / B;
	else
		tmp = (((1.0 - x) / F) / B) * F;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -2.65e-37], N[((-N[(N[(N[(1.0 + x), $MachinePrecision] / F), $MachinePrecision] * F), $MachinePrecision]) / B), $MachinePrecision], If[LessEqual[F, 3.25e-40], N[((-x) / B), $MachinePrecision], N[(N[(N[(N[(1.0 - x), $MachinePrecision] / F), $MachinePrecision] / B), $MachinePrecision] * F), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.65 \cdot 10^{-37}:\\
\;\;\;\;\frac{-\frac{1 + x}{F} \cdot F}{B}\\

\mathbf{elif}\;F \leq 3.25 \cdot 10^{-40}:\\
\;\;\;\;\frac{-x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -2.64999999999999998e-37

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto \frac{-1 \cdot \left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)\right)}{B} \]
      2. lower-neg.f64N/A

        \[\leadsto \frac{-F \cdot \left(\frac{1}{F} + \frac{x}{F}\right)}{B} \]
      3. *-commutativeN/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{-\left(\frac{1}{F} + \frac{x}{F}\right) \cdot F}{B} \]
      5. div-add-revN/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
      7. lower-+.f6429.0

        \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]
    9. Applied rewrites29.0%

      \[\leadsto \frac{-\frac{1 + x}{F} \cdot F}{B} \]

    if -2.64999999999999998e-37 < F < 3.25e-40

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \frac{-1 \cdot x}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} \]
      2. lower-neg.f6428.8

        \[\leadsto \frac{-x}{B} \]
    9. Applied rewrites28.8%

      \[\leadsto \frac{-x}{B} \]

    if 3.25e-40 < F

    1. Initial program 76.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. Taylor expanded in F around inf

      \[\leadsto \color{blue}{F \cdot \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
      2. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
    4. Applied rewrites47.8%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin B \cdot F} + \left(-\frac{\cos B \cdot x}{\sin B \cdot F}\right)\right) \cdot F} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
      2. sub-divN/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      4. lower--.f6427.2

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
    7. Applied rewrites27.2%

      \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 28: 43.2% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -2.65 \cdot 10^{-37}:\\ \;\;\;\;-\frac{1 + x}{F \cdot B} \cdot F\\ \mathbf{elif}\;F \leq 3.25 \cdot 10^{-40}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -2.65e-37)
   (- (* (/ (+ 1.0 x) (* F B)) F))
   (if (<= F 3.25e-40) (/ (- x) B) (* (/ (/ (- 1.0 x) F) B) F))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -2.65e-37) {
		tmp = -(((1.0 + x) / (F * B)) * F);
	} else if (F <= 3.25e-40) {
		tmp = -x / B;
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	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.65d-37)) then
        tmp = -(((1.0d0 + x) / (f * b)) * f)
    else if (f <= 3.25d-40) then
        tmp = -x / b
    else
        tmp = (((1.0d0 - x) / f) / b) * f
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -2.65e-37) {
		tmp = -(((1.0 + x) / (F * B)) * F);
	} else if (F <= 3.25e-40) {
		tmp = -x / B;
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -2.65e-37:
		tmp = -(((1.0 + x) / (F * B)) * F)
	elif F <= 3.25e-40:
		tmp = -x / B
	else:
		tmp = (((1.0 - x) / F) / B) * F
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -2.65e-37)
		tmp = Float64(-Float64(Float64(Float64(1.0 + x) / Float64(F * B)) * F));
	elseif (F <= 3.25e-40)
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(Float64(Float64(Float64(1.0 - x) / F) / B) * F);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -2.65e-37)
		tmp = -(((1.0 + x) / (F * B)) * F);
	elseif (F <= 3.25e-40)
		tmp = -x / B;
	else
		tmp = (((1.0 - x) / F) / B) * F;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -2.65e-37], (-N[(N[(N[(1.0 + x), $MachinePrecision] / N[(F * B), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), If[LessEqual[F, 3.25e-40], N[((-x) / B), $MachinePrecision], N[(N[(N[(N[(1.0 - x), $MachinePrecision] / F), $MachinePrecision] / B), $MachinePrecision] * F), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.65 \cdot 10^{-37}:\\
\;\;\;\;-\frac{1 + x}{F \cdot B} \cdot F\\

\mathbf{elif}\;F \leq 3.25 \cdot 10^{-40}:\\
\;\;\;\;\frac{-x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -2.64999999999999998e-37

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around -inf

      \[\leadsto -1 \cdot \color{blue}{\left(F \cdot \left(\frac{1}{B \cdot F} + \frac{x}{B \cdot F}\right)\right)} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(F \cdot \left(\frac{1}{B \cdot F} + \frac{x}{B \cdot F}\right)\right) \]
      2. lower-neg.f64N/A

        \[\leadsto -F \cdot \left(\frac{1}{B \cdot F} + \frac{x}{B \cdot F}\right) \]
      3. *-commutativeN/A

        \[\leadsto -\left(\frac{1}{B \cdot F} + \frac{x}{B \cdot F}\right) \cdot F \]
      4. lower-*.f64N/A

        \[\leadsto -\left(\frac{1}{B \cdot F} + \frac{x}{B \cdot F}\right) \cdot F \]
      5. div-add-revN/A

        \[\leadsto -\frac{1 + x}{B \cdot F} \cdot F \]
      6. lower-/.f64N/A

        \[\leadsto -\frac{1 + x}{B \cdot F} \cdot F \]
      7. lower-+.f64N/A

        \[\leadsto -\frac{1 + x}{B \cdot F} \cdot F \]
      8. *-commutativeN/A

        \[\leadsto -\frac{1 + x}{F \cdot B} \cdot F \]
      9. lower-*.f6427.6

        \[\leadsto -\frac{1 + x}{F \cdot B} \cdot F \]
    9. Applied rewrites27.6%

      \[\leadsto -\frac{1 + x}{F \cdot B} \cdot F \]

    if -2.64999999999999998e-37 < F < 3.25e-40

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \frac{-1 \cdot x}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} \]
      2. lower-neg.f6428.8

        \[\leadsto \frac{-x}{B} \]
    9. Applied rewrites28.8%

      \[\leadsto \frac{-x}{B} \]

    if 3.25e-40 < F

    1. Initial program 76.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. Taylor expanded in F around inf

      \[\leadsto \color{blue}{F \cdot \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
      2. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
    4. Applied rewrites47.8%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin B \cdot F} + \left(-\frac{\cos B \cdot x}{\sin B \cdot F}\right)\right) \cdot F} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
      2. sub-divN/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      4. lower--.f6427.2

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
    7. Applied rewrites27.2%

      \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 29: 36.8% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.45 \cdot 10^{-12}:\\ \;\;\;\;\frac{\left(B \cdot B\right) \cdot -0.16666666666666666 - 1}{B}\\ \mathbf{elif}\;F \leq 3.25 \cdot 10^{-40}:\\ \;\;\;\;\frac{-x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.45e-12)
   (/ (- (* (* B B) -0.16666666666666666) 1.0) B)
   (if (<= F 3.25e-40) (/ (- x) B) (* (/ (/ (- 1.0 x) F) B) F))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.45e-12) {
		tmp = (((B * B) * -0.16666666666666666) - 1.0) / B;
	} else if (F <= 3.25e-40) {
		tmp = -x / B;
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(f, b, x)
use fmin_fmax_functions
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-1.45d-12)) then
        tmp = (((b * b) * (-0.16666666666666666d0)) - 1.0d0) / b
    else if (f <= 3.25d-40) then
        tmp = -x / b
    else
        tmp = (((1.0d0 - x) / f) / b) * f
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.45e-12) {
		tmp = (((B * B) * -0.16666666666666666) - 1.0) / B;
	} else if (F <= 3.25e-40) {
		tmp = -x / B;
	} else {
		tmp = (((1.0 - x) / F) / B) * F;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.45e-12:
		tmp = (((B * B) * -0.16666666666666666) - 1.0) / B
	elif F <= 3.25e-40:
		tmp = -x / B
	else:
		tmp = (((1.0 - x) / F) / B) * F
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.45e-12)
		tmp = Float64(Float64(Float64(Float64(B * B) * -0.16666666666666666) - 1.0) / B);
	elseif (F <= 3.25e-40)
		tmp = Float64(Float64(-x) / B);
	else
		tmp = Float64(Float64(Float64(Float64(1.0 - x) / F) / B) * F);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1.45e-12)
		tmp = (((B * B) * -0.16666666666666666) - 1.0) / B;
	elseif (F <= 3.25e-40)
		tmp = -x / B;
	else
		tmp = (((1.0 - x) / F) / B) * F;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.45e-12], N[(N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.25e-40], N[((-x) / B), $MachinePrecision], N[(N[(N[(N[(1.0 - x), $MachinePrecision] / F), $MachinePrecision] / B), $MachinePrecision] * F), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.45 \cdot 10^{-12}:\\
\;\;\;\;\frac{\left(B \cdot B\right) \cdot -0.16666666666666666 - 1}{B}\\

\mathbf{elif}\;F \leq 3.25 \cdot 10^{-40}:\\
\;\;\;\;\frac{-x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - x}{F}}{B} \cdot F\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.4500000000000001e-12

    1. Initial program 76.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. Taylor expanded in F around -inf

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6417.7

        \[\leadsto \frac{-1}{\sin B} \]
    4. Applied rewrites17.7%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{\frac{-1}{6} \cdot {B}^{2} - 1}{\color{blue}{B}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {B}^{2} - 1}{B} \]
      2. lower--.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {B}^{2} - 1}{B} \]
      3. *-commutativeN/A

        \[\leadsto \frac{{B}^{2} \cdot \frac{-1}{6} - 1}{B} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{{B}^{2} \cdot \frac{-1}{6} - 1}{B} \]
      5. unpow2N/A

        \[\leadsto \frac{\left(B \cdot B\right) \cdot \frac{-1}{6} - 1}{B} \]
      6. lower-*.f6410.6

        \[\leadsto \frac{\left(B \cdot B\right) \cdot -0.16666666666666666 - 1}{B} \]
    7. Applied rewrites10.6%

      \[\leadsto \frac{\left(B \cdot B\right) \cdot -0.16666666666666666 - 1}{\color{blue}{B}} \]

    if -1.4500000000000001e-12 < F < 3.25e-40

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \frac{-1 \cdot x}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} \]
      2. lower-neg.f6428.8

        \[\leadsto \frac{-x}{B} \]
    9. Applied rewrites28.8%

      \[\leadsto \frac{-x}{B} \]

    if 3.25e-40 < F

    1. Initial program 76.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. Taylor expanded in F around inf

      \[\leadsto \color{blue}{F \cdot \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
      2. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \frac{x \cdot \cos B}{F \cdot \sin B} + \frac{1}{F \cdot \sin B}\right) \cdot \color{blue}{F} \]
    4. Applied rewrites47.8%

      \[\leadsto \color{blue}{\left(\frac{1}{\sin B \cdot F} + \left(-\frac{\cos B \cdot x}{\sin B \cdot F}\right)\right) \cdot F} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{1}{F} - \frac{x}{F}}{B} \cdot F \]
      2. sub-divN/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
      4. lower--.f6427.2

        \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
    7. Applied rewrites27.2%

      \[\leadsto \frac{\frac{1 - x}{F}}{B} \cdot F \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 30: 30.6% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x}{B}\\ \mathbf{if}\;x \leq -1.6 \cdot 10^{-22}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-225}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (/ (- x) B)))
   (if (<= x -1.6e-22) t_0 (if (<= x 2.6e-225) (/ -1.0 B) t_0))))
double code(double F, double B, double x) {
	double t_0 = -x / B;
	double tmp;
	if (x <= -1.6e-22) {
		tmp = t_0;
	} else if (x <= 2.6e-225) {
		tmp = -1.0 / B;
	} else {
		tmp = t_0;
	}
	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 = -x / b
    if (x <= (-1.6d-22)) then
        tmp = t_0
    else if (x <= 2.6d-225) then
        tmp = (-1.0d0) / b
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = -x / B;
	double tmp;
	if (x <= -1.6e-22) {
		tmp = t_0;
	} else if (x <= 2.6e-225) {
		tmp = -1.0 / B;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(F, B, x):
	t_0 = -x / B
	tmp = 0
	if x <= -1.6e-22:
		tmp = t_0
	elif x <= 2.6e-225:
		tmp = -1.0 / B
	else:
		tmp = t_0
	return tmp
function code(F, B, x)
	t_0 = Float64(Float64(-x) / B)
	tmp = 0.0
	if (x <= -1.6e-22)
		tmp = t_0;
	elseif (x <= 2.6e-225)
		tmp = Float64(-1.0 / B);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = -x / B;
	tmp = 0.0;
	if (x <= -1.6e-22)
		tmp = t_0;
	elseif (x <= 2.6e-225)
		tmp = -1.0 / B;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / B), $MachinePrecision]}, If[LessEqual[x, -1.6e-22], t$95$0, If[LessEqual[x, 2.6e-225], N[(-1.0 / B), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-x}{B}\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 2.6 \cdot 10^{-225}:\\
\;\;\;\;\frac{-1}{B}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.59999999999999994e-22 or 2.60000000000000013e-225 < x

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \frac{-1 \cdot x}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} \]
      2. lower-neg.f6428.8

        \[\leadsto \frac{-x}{B} \]
    9. Applied rewrites28.8%

      \[\leadsto \frac{-x}{B} \]

    if -1.59999999999999994e-22 < x < 2.60000000000000013e-225

    1. Initial program 76.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. Taylor expanded in F around -inf

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6417.7

        \[\leadsto \frac{-1}{\sin B} \]
    4. Applied rewrites17.7%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{-1}{\color{blue}{B}} \]
    6. Step-by-step derivation
      1. lower-/.f6410.8

        \[\leadsto \frac{-1}{B} \]
    7. Applied rewrites10.8%

      \[\leadsto \frac{-1}{\color{blue}{B}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 31: 29.8% accurate, 6.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.45 \cdot 10^{-12}:\\ \;\;\;\;\frac{\left(B \cdot B\right) \cdot -0.16666666666666666 - 1}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.45e-12)
   (/ (- (* (* B B) -0.16666666666666666) 1.0) B)
   (/ (- x) B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.45e-12) {
		tmp = (((B * B) * -0.16666666666666666) - 1.0) / B;
	} else {
		tmp = -x / B;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(f, b, x)
use fmin_fmax_functions
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-1.45d-12)) then
        tmp = (((b * b) * (-0.16666666666666666d0)) - 1.0d0) / b
    else
        tmp = -x / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.45e-12) {
		tmp = (((B * B) * -0.16666666666666666) - 1.0) / B;
	} else {
		tmp = -x / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.45e-12:
		tmp = (((B * B) * -0.16666666666666666) - 1.0) / B
	else:
		tmp = -x / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.45e-12)
		tmp = Float64(Float64(Float64(Float64(B * B) * -0.16666666666666666) - 1.0) / B);
	else
		tmp = Float64(Float64(-x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1.45e-12)
		tmp = (((B * B) * -0.16666666666666666) - 1.0) / B;
	else
		tmp = -x / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.45e-12], N[(N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.45 \cdot 10^{-12}:\\
\;\;\;\;\frac{\left(B \cdot B\right) \cdot -0.16666666666666666 - 1}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -1.4500000000000001e-12

    1. Initial program 76.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. Taylor expanded in F around -inf

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6417.7

        \[\leadsto \frac{-1}{\sin B} \]
    4. Applied rewrites17.7%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{\frac{-1}{6} \cdot {B}^{2} - 1}{\color{blue}{B}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {B}^{2} - 1}{B} \]
      2. lower--.f64N/A

        \[\leadsto \frac{\frac{-1}{6} \cdot {B}^{2} - 1}{B} \]
      3. *-commutativeN/A

        \[\leadsto \frac{{B}^{2} \cdot \frac{-1}{6} - 1}{B} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{{B}^{2} \cdot \frac{-1}{6} - 1}{B} \]
      5. unpow2N/A

        \[\leadsto \frac{\left(B \cdot B\right) \cdot \frac{-1}{6} - 1}{B} \]
      6. lower-*.f6410.6

        \[\leadsto \frac{\left(B \cdot B\right) \cdot -0.16666666666666666 - 1}{B} \]
    7. Applied rewrites10.6%

      \[\leadsto \frac{\left(B \cdot B\right) \cdot -0.16666666666666666 - 1}{\color{blue}{B}} \]

    if -1.4500000000000001e-12 < F

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around 0

      \[\leadsto \frac{-1 \cdot x}{B} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(x\right)}{B} \]
      2. lower-neg.f6428.8

        \[\leadsto \frac{-x}{B} \]
    9. Applied rewrites28.8%

      \[\leadsto \frac{-x}{B} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 32: 17.8% accurate, 14.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq 2.25 \cdot 10^{-63}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{B}\\ \end{array} \end{array} \]
(FPCore (F B x) :precision binary64 (if (<= F 2.25e-63) (/ -1.0 B) (/ 1.0 B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= 2.25e-63) {
		tmp = -1.0 / 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.25d-63) then
        tmp = (-1.0d0) / b
    else
        tmp = 1.0d0 / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= 2.25e-63) {
		tmp = -1.0 / B;
	} else {
		tmp = 1.0 / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= 2.25e-63:
		tmp = -1.0 / B
	else:
		tmp = 1.0 / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= 2.25e-63)
		tmp = Float64(-1.0 / B);
	else
		tmp = Float64(1.0 / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= 2.25e-63)
		tmp = -1.0 / B;
	else
		tmp = 1.0 / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, 2.25e-63], N[(-1.0 / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq 2.25 \cdot 10^{-63}:\\
\;\;\;\;\frac{-1}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 2.25e-63

    1. Initial program 76.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. Taylor expanded in F around -inf

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6417.7

        \[\leadsto \frac{-1}{\sin B} \]
    4. Applied rewrites17.7%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{-1}{\color{blue}{B}} \]
    6. Step-by-step derivation
      1. lower-/.f6410.8

        \[\leadsto \frac{-1}{B} \]
    7. Applied rewrites10.8%

      \[\leadsto \frac{-1}{\color{blue}{B}} \]

    if 2.25e-63 < F

    1. Initial program 76.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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(-\color{blue}{x \cdot \frac{1}{\tan 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(-x \cdot \color{blue}{\frac{1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      3. lift-tan.f64N/A

        \[\leadsto \left(-x \cdot \frac{1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      4. associate-*r/N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      5. lower-/.f64N/A

        \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \left(-\frac{\color{blue}{x \cdot 1}}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      7. lift-tan.f6476.3

        \[\leadsto \left(-\frac{x \cdot 1}{\color{blue}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    3. Applied rewrites76.3%

      \[\leadsto \left(-\color{blue}{\frac{x \cdot 1}{\tan B}}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    4. Taylor expanded in B around 0

      \[\leadsto \color{blue}{\frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\frac{-1}{2}} - x}{B}} \]
    5. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      2. metadata-evalN/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{B} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{F \cdot {\left(2 + \left(2 \cdot x + {F}^{2}\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} - x}{\color{blue}{B}} \]
    6. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}} \]
    7. Taylor expanded in F around inf

      \[\leadsto \frac{1}{B} \]
    8. Step-by-step derivation
      1. Applied rewrites9.8%

        \[\leadsto \frac{1}{B} \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 33: 10.8% accurate, 26.5× 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 76.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. Taylor expanded in F around -inf

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1}{\color{blue}{\sin B}} \]
      2. lift-sin.f6417.7

        \[\leadsto \frac{-1}{\sin B} \]
    4. Applied rewrites17.7%

      \[\leadsto \color{blue}{\frac{-1}{\sin B}} \]
    5. Taylor expanded in B around 0

      \[\leadsto \frac{-1}{\color{blue}{B}} \]
    6. Step-by-step derivation
      1. lower-/.f6410.8

        \[\leadsto \frac{-1}{B} \]
    7. Applied rewrites10.8%

      \[\leadsto \frac{-1}{\color{blue}{B}} \]
    8. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025142 
    (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))))))