VandenBroeck and Keller, Equation (23)

Percentage Accurate: 76.2% → 99.7%
Time: 8.4s
Alternatives: 12
Speedup: N/A×

Specification

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

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

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 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.7% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -6 \cdot 10^{+14}:\\ \;\;\;\;\frac{-1 \cdot \left(1 + x \cdot \cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 100000000:\\ \;\;\;\;-1 \cdot \frac{x}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-1 \cdot \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 -6e+14)
   (/ (* -1.0 (+ 1.0 (* x (cos B)))) (sin B))
   (if (<= F 100000000.0)
     (+
      (* -1.0 (/ x (tan B)))
      (*
       (/ F (sin B))
       (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (* -1.0 (/ 1.0 2.0)))))
     (/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -6e+14) {
		tmp = (-1.0 * (1.0 + (x * cos(B)))) / sin(B);
	} else if (F <= 100000000.0) {
		tmp = (-1.0 * (x / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 * (1.0 / 2.0))));
	} else {
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(f, b, x)
use fmin_fmax_functions
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-6d+14)) then
        tmp = ((-1.0d0) * (1.0d0 + (x * cos(b)))) / sin(b)
    else if (f <= 100000000.0d0) then
        tmp = ((-1.0d0) * (x / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** ((-1.0d0) * (1.0d0 / 2.0d0))))
    else
        tmp = (1.0d0 - (cos(b) * x)) / sin(b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -6e+14) {
		tmp = (-1.0 * (1.0 + (x * Math.cos(B)))) / Math.sin(B);
	} else if (F <= 100000000.0) {
		tmp = (-1.0 * (x / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 * (1.0 / 2.0))));
	} else {
		tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -6e+14:
		tmp = (-1.0 * (1.0 + (x * math.cos(B)))) / math.sin(B)
	elif F <= 100000000.0:
		tmp = (-1.0 * (x / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 * (1.0 / 2.0))))
	else:
		tmp = (1.0 - (math.cos(B) * x)) / math.sin(B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -6e+14)
		tmp = Float64(Float64(-1.0 * Float64(1.0 + Float64(x * cos(B)))) / sin(B));
	elseif (F <= 100000000.0)
		tmp = Float64(Float64(-1.0 * Float64(x / tan(B))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-1.0 * Float64(1.0 / 2.0)))));
	else
		tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -6e+14)
		tmp = (-1.0 * (1.0 + (x * cos(B)))) / sin(B);
	elseif (F <= 100000000.0)
		tmp = (-1.0 * (x / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ (-1.0 * (1.0 / 2.0))));
	else
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -6e+14], N[(N[(-1.0 * N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 100000000.0], N[(N[(-1.0 * N[(x / 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 * N[(1.0 / 2.0), $MachinePrecision]), $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 -6 \cdot 10^{+14}:\\
\;\;\;\;\frac{-1 \cdot \left(1 + x \cdot \cos B\right)}{\sin B}\\

\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;-1 \cdot \frac{x}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-1 \cdot \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 < -6e14

    1. Initial program 60.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6e14 < F < 1e8

    1. Initial program 99.5%

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

        \[\leadsto \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.f6499.5

        \[\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)} \]
    4. Applied rewrites99.5%

      \[\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 1e8 < F

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 4 + \left({F}^{4} - 2 \cdot \left(F \cdot F\right)\right)\\ \mathbf{if}\;F \leq -5.6 \cdot 10^{+14}:\\ \;\;\;\;\frac{-1 \cdot \left(1 + x \cdot \cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1000000000000:\\ \;\;\;\;-1 \cdot \left(x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(\frac{8}{t\_0} + \frac{{\left(F \cdot F\right)}^{3}}{t\_0}\right) + 2 \cdot x\right)}^{\left(-1 \cdot \frac{1}{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (+ 4.0 (- (pow F 4.0) (* 2.0 (* F F))))))
   (if (<= F -5.6e+14)
     (/ (* -1.0 (+ 1.0 (* x (cos B)))) (sin B))
     (if (<= F 1000000000000.0)
       (+
        (* -1.0 (* x (/ 1.0 (tan B))))
        (*
         (/ F (sin B))
         (pow
          (+ (+ (/ 8.0 t_0) (/ (pow (* F F) 3.0) t_0)) (* 2.0 x))
          (* -1.0 (/ 1.0 2.0)))))
       (/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
	double t_0 = 4.0 + (pow(F, 4.0) - (2.0 * (F * F)));
	double tmp;
	if (F <= -5.6e+14) {
		tmp = (-1.0 * (1.0 + (x * cos(B)))) / sin(B);
	} else if (F <= 1000000000000.0) {
		tmp = (-1.0 * (x * (1.0 / tan(B)))) + ((F / sin(B)) * pow((((8.0 / t_0) + (pow((F * F), 3.0) / t_0)) + (2.0 * x)), (-1.0 * (1.0 / 2.0))));
	} else {
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(f, b, x)
use fmin_fmax_functions
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 4.0d0 + ((f ** 4.0d0) - (2.0d0 * (f * f)))
    if (f <= (-5.6d+14)) then
        tmp = ((-1.0d0) * (1.0d0 + (x * cos(b)))) / sin(b)
    else if (f <= 1000000000000.0d0) then
        tmp = ((-1.0d0) * (x * (1.0d0 / tan(b)))) + ((f / sin(b)) * ((((8.0d0 / t_0) + (((f * f) ** 3.0d0) / t_0)) + (2.0d0 * x)) ** ((-1.0d0) * (1.0d0 / 2.0d0))))
    else
        tmp = (1.0d0 - (cos(b) * x)) / sin(b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double t_0 = 4.0 + (Math.pow(F, 4.0) - (2.0 * (F * F)));
	double tmp;
	if (F <= -5.6e+14) {
		tmp = (-1.0 * (1.0 + (x * Math.cos(B)))) / Math.sin(B);
	} else if (F <= 1000000000000.0) {
		tmp = (-1.0 * (x * (1.0 / Math.tan(B)))) + ((F / Math.sin(B)) * Math.pow((((8.0 / t_0) + (Math.pow((F * F), 3.0) / t_0)) + (2.0 * x)), (-1.0 * (1.0 / 2.0))));
	} else {
		tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	t_0 = 4.0 + (math.pow(F, 4.0) - (2.0 * (F * F)))
	tmp = 0
	if F <= -5.6e+14:
		tmp = (-1.0 * (1.0 + (x * math.cos(B)))) / math.sin(B)
	elif F <= 1000000000000.0:
		tmp = (-1.0 * (x * (1.0 / math.tan(B)))) + ((F / math.sin(B)) * math.pow((((8.0 / t_0) + (math.pow((F * F), 3.0) / t_0)) + (2.0 * x)), (-1.0 * (1.0 / 2.0))))
	else:
		tmp = (1.0 - (math.cos(B) * x)) / math.sin(B)
	return tmp
function code(F, B, x)
	t_0 = Float64(4.0 + Float64((F ^ 4.0) - Float64(2.0 * Float64(F * F))))
	tmp = 0.0
	if (F <= -5.6e+14)
		tmp = Float64(Float64(-1.0 * Float64(1.0 + Float64(x * cos(B)))) / sin(B));
	elseif (F <= 1000000000000.0)
		tmp = Float64(Float64(-1.0 * Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(8.0 / t_0) + Float64((Float64(F * F) ^ 3.0) / t_0)) + Float64(2.0 * x)) ^ Float64(-1.0 * Float64(1.0 / 2.0)))));
	else
		tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	t_0 = 4.0 + ((F ^ 4.0) - (2.0 * (F * F)));
	tmp = 0.0;
	if (F <= -5.6e+14)
		tmp = (-1.0 * (1.0 + (x * cos(B)))) / sin(B);
	elseif (F <= 1000000000000.0)
		tmp = (-1.0 * (x * (1.0 / tan(B)))) + ((F / sin(B)) * ((((8.0 / t_0) + (((F * F) ^ 3.0) / t_0)) + (2.0 * x)) ^ (-1.0 * (1.0 / 2.0))));
	else
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := Block[{t$95$0 = N[(4.0 + N[(N[Power[F, 4.0], $MachinePrecision] - N[(2.0 * N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5.6e+14], N[(N[(-1.0 * N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1000000000000.0], N[(N[(-1.0 * N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(8.0 / t$95$0), $MachinePrecision] + N[(N[Power[N[(F * F), $MachinePrecision], 3.0], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(1.0 / 2.0), $MachinePrecision]), $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}
t_0 := 4 + \left({F}^{4} - 2 \cdot \left(F \cdot F\right)\right)\\
\mathbf{if}\;F \leq -5.6 \cdot 10^{+14}:\\
\;\;\;\;\frac{-1 \cdot \left(1 + x \cdot \cos B\right)}{\sin B}\\

\mathbf{elif}\;F \leq 1000000000000:\\
\;\;\;\;-1 \cdot \left(x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(\frac{8}{t\_0} + \frac{{\left(F \cdot F\right)}^{3}}{t\_0}\right) + 2 \cdot x\right)}^{\left(-1 \cdot \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 < -5.6e14

    1. Initial program 60.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.6e14 < F < 1e12

    1. Initial program 99.5%

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

        \[\leadsto \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)} \]
      2. 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)} \]
      3. pow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\frac{8 + {\left(F \cdot F\right)}^{3}}{4 + \left({F}^{4} - 2 \cdot \color{blue}{\left(F \cdot F\right)}\right)} + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
      21. lift-*.f6499.5

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

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

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

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

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

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

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

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

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

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

    if 1e12 < F

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.6 \cdot 10^{+14}:\\ \;\;\;\;\frac{-1 \cdot \left(1 + x \cdot \cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 1000000000000:\\ \;\;\;\;-1 \cdot \left(x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(\frac{8}{4 + \left({F}^{4} - 2 \cdot \left(F \cdot F\right)\right)} + \frac{{\left(F \cdot F\right)}^{3}}{4 + \left({F}^{4} - 2 \cdot \left(F \cdot F\right)\right)}\right) + 2 \cdot x\right)}^{\left(-1 \cdot \frac{1}{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.6% accurate, N/A× speedup?

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

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

\mathbf{elif}\;F \leq 30000000000:\\
\;\;\;\;\left(-1 \cdot x\right) \cdot \frac{-1 \cdot \cos B}{-1 \cdot \sin B} + \frac{F \cdot {\left(\mathsf{fma}\left({F}^{1}, {F}^{1}, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-0.5}}{\sin 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 < -1.2e30

    1. Initial program 59.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2e30 < F < 3e10

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3e10 < F

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 99.6% accurate, N/A× speedup?

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

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

\mathbf{elif}\;F \leq 30000000000:\\
\;\;\;\;\left(-1 \cdot x\right) \cdot \frac{-1 \cdot \cos B}{-1 \cdot \sin B} + \frac{F \cdot {\left(\frac{{F}^{4} - \mathsf{fma}\left(2, x, 2\right) \cdot \mathsf{fma}\left(2, x, 2\right)}{F \cdot F - \mathsf{fma}\left(2, x, 2\right)}\right)}^{-0.5}}{\sin 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 < -5.5e29

    1. Initial program 59.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.5e29 < F < 3e10

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3e10 < F

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -2 \cdot 10^{+24}:\\ \;\;\;\;\frac{-1 \cdot \left(1 + x \cdot \cos B\right)}{\sin B}\\ \mathbf{elif}\;F \leq 150000000:\\ \;\;\;\;\left(-1 \cdot x\right) \cdot \frac{-1 \cdot \cos B}{-1 \cdot \sin B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-1 \cdot \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 -2e+24)
   (/ (* -1.0 (+ 1.0 (* x (cos B)))) (sin B))
   (if (<= F 150000000.0)
     (+
      (* (* -1.0 x) (/ (* -1.0 (cos B)) (* -1.0 (sin B))))
      (*
       (/ F (sin B))
       (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (* -1.0 (/ 1.0 2.0)))))
     (/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -2e+24) {
		tmp = (-1.0 * (1.0 + (x * cos(B)))) / sin(B);
	} else if (F <= 150000000.0) {
		tmp = ((-1.0 * x) * ((-1.0 * cos(B)) / (-1.0 * sin(B)))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 * (1.0 / 2.0))));
	} else {
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(f, b, x)
use fmin_fmax_functions
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-2d+24)) then
        tmp = ((-1.0d0) * (1.0d0 + (x * cos(b)))) / sin(b)
    else if (f <= 150000000.0d0) then
        tmp = (((-1.0d0) * x) * (((-1.0d0) * cos(b)) / ((-1.0d0) * sin(b)))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** ((-1.0d0) * (1.0d0 / 2.0d0))))
    else
        tmp = (1.0d0 - (cos(b) * x)) / sin(b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -2e+24) {
		tmp = (-1.0 * (1.0 + (x * Math.cos(B)))) / Math.sin(B);
	} else if (F <= 150000000.0) {
		tmp = ((-1.0 * x) * ((-1.0 * Math.cos(B)) / (-1.0 * Math.sin(B)))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 * (1.0 / 2.0))));
	} else {
		tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -2e+24:
		tmp = (-1.0 * (1.0 + (x * math.cos(B)))) / math.sin(B)
	elif F <= 150000000.0:
		tmp = ((-1.0 * x) * ((-1.0 * math.cos(B)) / (-1.0 * math.sin(B)))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 * (1.0 / 2.0))))
	else:
		tmp = (1.0 - (math.cos(B) * x)) / math.sin(B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -2e+24)
		tmp = Float64(Float64(-1.0 * Float64(1.0 + Float64(x * cos(B)))) / sin(B));
	elseif (F <= 150000000.0)
		tmp = Float64(Float64(Float64(-1.0 * x) * Float64(Float64(-1.0 * cos(B)) / Float64(-1.0 * sin(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-1.0 * Float64(1.0 / 2.0)))));
	else
		tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -2e+24)
		tmp = (-1.0 * (1.0 + (x * cos(B)))) / sin(B);
	elseif (F <= 150000000.0)
		tmp = ((-1.0 * x) * ((-1.0 * cos(B)) / (-1.0 * sin(B)))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ (-1.0 * (1.0 / 2.0))));
	else
		tmp = (1.0 - (cos(B) * x)) / sin(B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -2e+24], N[(N[(-1.0 * N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 150000000.0], N[(N[(N[(-1.0 * x), $MachinePrecision] * N[(N[(-1.0 * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[(-1.0 * N[Sin[B], $MachinePrecision]), $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 * N[(1.0 / 2.0), $MachinePrecision]), $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 -2 \cdot 10^{+24}:\\
\;\;\;\;\frac{-1 \cdot \left(1 + x \cdot \cos B\right)}{\sin B}\\

\mathbf{elif}\;F \leq 150000000:\\
\;\;\;\;\left(-1 \cdot x\right) \cdot \frac{-1 \cdot \cos B}{-1 \cdot \sin B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-1 \cdot \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 < -2e24

    1. Initial program 60.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e24 < F < 1.5e8

    1. Initial program 99.5%

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

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

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

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

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

      \[\leadsto \left(-x \cdot \color{blue}{\frac{\cos B}{\sin 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.5e8 < F

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.1% accurate, N/A× speedup?

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

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

\mathbf{elif}\;F \leq 1.5:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot t\_0\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, t\_0 \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{t\_1}{\sin B}\\

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


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

    1. Initial program 63.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.5 < F < 1.5

    1. Initial program 99.5%

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

      \[\leadsto \color{blue}{F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} + {F}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{{\left(2 + 2 \cdot x\right)}^{3}}}\right) + \frac{3}{8} \cdot \left(\frac{{F}^{2}}{\sin B} \cdot \sqrt{\frac{1}{{\left(2 + 2 \cdot x\right)}^{5}}}\right)\right)\right) - \frac{x \cdot \cos B}{\sin B}} \]
    4. Applied rewrites99.1%

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

    if 1.5 < F

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 93.1% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin B}^{-1}\\ t_1 := \cos B \cdot x\\ \mathbf{if}\;F \leq -70000:\\ \;\;\;\;\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{2} \cdot -0.75}{{F}^{4} \cdot \sin B}, 0.5, \frac{0.5 \cdot \mathsf{fma}\left(2, x, 2\right)}{\left(F \cdot F\right) \cdot \sin B}\right) - \frac{1 + t\_1}{\sin B}\\ \mathbf{elif}\;F \leq 1.5:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot t\_0\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, t\_0 \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{t\_1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - t\_1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (pow (sin B) -1.0)) (t_1 (* (cos B) x)))
   (if (<= F -70000.0)
     (-
      (fma
       (/ (* (pow (fma 2.0 x 2.0) 2.0) -0.75) (* (pow F 4.0) (sin B)))
       0.5
       (/ (* 0.5 (fma 2.0 x 2.0)) (* (* F F) (sin B))))
      (/ (+ 1.0 t_1) (sin B)))
     (if (<= F 1.5)
       (-
        (*
         (fma
          (fma
           (*
            (pow (pow (pow (fma 2.0 x 2.0) 5.0) -1.0) 0.5)
            (/ (* F F) (sin B)))
           0.375
           (* (* -0.5 t_0) (pow (pow (pow (fma 2.0 x 2.0) 3.0) -1.0) 0.5)))
          (* F F)
          (* t_0 (pow (pow (fma 2.0 x 2.0) -1.0) 0.5)))
         F)
        (/ t_1 (sin B)))
       (/ (- 1.0 t_1) (sin B))))))
double code(double F, double B, double x) {
	double t_0 = pow(sin(B), -1.0);
	double t_1 = cos(B) * x;
	double tmp;
	if (F <= -70000.0) {
		tmp = fma(((pow(fma(2.0, x, 2.0), 2.0) * -0.75) / (pow(F, 4.0) * sin(B))), 0.5, ((0.5 * fma(2.0, x, 2.0)) / ((F * F) * sin(B)))) - ((1.0 + t_1) / sin(B));
	} else if (F <= 1.5) {
		tmp = (fma(fma((pow(pow(pow(fma(2.0, x, 2.0), 5.0), -1.0), 0.5) * ((F * F) / sin(B))), 0.375, ((-0.5 * t_0) * pow(pow(pow(fma(2.0, x, 2.0), 3.0), -1.0), 0.5))), (F * F), (t_0 * pow(pow(fma(2.0, x, 2.0), -1.0), 0.5))) * F) - (t_1 / sin(B));
	} else {
		tmp = (1.0 - t_1) / sin(B);
	}
	return tmp;
}
function code(F, B, x)
	t_0 = sin(B) ^ -1.0
	t_1 = Float64(cos(B) * x)
	tmp = 0.0
	if (F <= -70000.0)
		tmp = Float64(fma(Float64(Float64((fma(2.0, x, 2.0) ^ 2.0) * -0.75) / Float64((F ^ 4.0) * sin(B))), 0.5, Float64(Float64(0.5 * fma(2.0, x, 2.0)) / Float64(Float64(F * F) * sin(B)))) - Float64(Float64(1.0 + t_1) / sin(B)));
	elseif (F <= 1.5)
		tmp = Float64(Float64(fma(fma(Float64((((fma(2.0, x, 2.0) ^ 5.0) ^ -1.0) ^ 0.5) * Float64(Float64(F * F) / sin(B))), 0.375, Float64(Float64(-0.5 * t_0) * (((fma(2.0, x, 2.0) ^ 3.0) ^ -1.0) ^ 0.5))), Float64(F * F), Float64(t_0 * ((fma(2.0, x, 2.0) ^ -1.0) ^ 0.5))) * F) - Float64(t_1 / sin(B)));
	else
		tmp = Float64(Float64(1.0 - t_1) / sin(B));
	end
	return tmp
end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -70000.0], N[(N[(N[(N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], 2.0], $MachinePrecision] * -0.75), $MachinePrecision] / N[(N[Power[F, 4.0], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(0.5 * N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision] / N[(N[(F * F), $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 + t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.5], N[(N[(N[(N[(N[(N[Power[N[Power[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], 5.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * N[(N[(F * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.375 + N[(N[(-0.5 * t$95$0), $MachinePrecision] * N[Power[N[Power[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * F), $MachinePrecision] + N[(t$95$0 * N[Power[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - N[(t$95$1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\sin B}^{-1}\\
t_1 := \cos B \cdot x\\
\mathbf{if}\;F \leq -70000:\\
\;\;\;\;\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{2} \cdot -0.75}{{F}^{4} \cdot \sin B}, 0.5, \frac{0.5 \cdot \mathsf{fma}\left(2, x, 2\right)}{\left(F \cdot F\right) \cdot \sin B}\right) - \frac{1 + t\_1}{\sin B}\\

\mathbf{elif}\;F \leq 1.5:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot t\_0\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, t\_0 \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{t\_1}{\sin B}\\

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


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

    1. Initial program 61.6%

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

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

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

    if -7e4 < F < 1.5

    1. Initial program 99.5%

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

      \[\leadsto \color{blue}{F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} + {F}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{{\left(2 + 2 \cdot x\right)}^{3}}}\right) + \frac{3}{8} \cdot \left(\frac{{F}^{2}}{\sin B} \cdot \sqrt{\frac{1}{{\left(2 + 2 \cdot x\right)}^{5}}}\right)\right)\right) - \frac{x \cdot \cos B}{\sin B}} \]
    4. Applied rewrites98.4%

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

    if 1.5 < F

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -70000:\\ \;\;\;\;\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{2} \cdot -0.75}{{F}^{4} \cdot \sin B}, 0.5, \frac{0.5 \cdot \mathsf{fma}\left(2, x, 2\right)}{\left(F \cdot F\right) \cdot \sin B}\right) - \frac{1 + \cos B \cdot x}{\sin B}\\ \mathbf{elif}\;F \leq 1.5:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot {\sin B}^{-1}\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, {\sin B}^{-1} \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{\cos B \cdot x}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 89.6% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin B}^{-1}\\ t_1 := \cos B \cdot x\\ \mathbf{if}\;F \leq -70000:\\ \;\;\;\;\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{2} \cdot -0.75}{{F}^{4} \cdot \sin B}, 0.5, \frac{0.5 \cdot \mathsf{fma}\left(2, x, 2\right)}{\left(F \cdot F\right) \cdot \sin B}\right) - \frac{1 + t\_1}{\sin B}\\ \mathbf{elif}\;F \leq 1.8:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot t\_0\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, t\_0 \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{t\_1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \cos B}{-1 \cdot \sin B}, {\left(x \cdot \sin B\right)}^{-1}\right)\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (pow (sin B) -1.0)) (t_1 (* (cos B) x)))
   (if (<= F -70000.0)
     (-
      (fma
       (/ (* (pow (fma 2.0 x 2.0) 2.0) -0.75) (* (pow F 4.0) (sin B)))
       0.5
       (/ (* 0.5 (fma 2.0 x 2.0)) (* (* F F) (sin B))))
      (/ (+ 1.0 t_1) (sin B)))
     (if (<= F 1.8)
       (-
        (*
         (fma
          (fma
           (*
            (pow (pow (pow (fma 2.0 x 2.0) 5.0) -1.0) 0.5)
            (/ (* F F) (sin B)))
           0.375
           (* (* -0.5 t_0) (pow (pow (pow (fma 2.0 x 2.0) 3.0) -1.0) 0.5)))
          (* F F)
          (* t_0 (pow (pow (fma 2.0 x 2.0) -1.0) 0.5)))
         F)
        (/ t_1 (sin B)))
       (*
        x
        (fma
         -1.0
         (/ (* -1.0 (cos B)) (* -1.0 (sin B)))
         (pow (* x (sin B)) -1.0)))))))
double code(double F, double B, double x) {
	double t_0 = pow(sin(B), -1.0);
	double t_1 = cos(B) * x;
	double tmp;
	if (F <= -70000.0) {
		tmp = fma(((pow(fma(2.0, x, 2.0), 2.0) * -0.75) / (pow(F, 4.0) * sin(B))), 0.5, ((0.5 * fma(2.0, x, 2.0)) / ((F * F) * sin(B)))) - ((1.0 + t_1) / sin(B));
	} else if (F <= 1.8) {
		tmp = (fma(fma((pow(pow(pow(fma(2.0, x, 2.0), 5.0), -1.0), 0.5) * ((F * F) / sin(B))), 0.375, ((-0.5 * t_0) * pow(pow(pow(fma(2.0, x, 2.0), 3.0), -1.0), 0.5))), (F * F), (t_0 * pow(pow(fma(2.0, x, 2.0), -1.0), 0.5))) * F) - (t_1 / sin(B));
	} else {
		tmp = x * fma(-1.0, ((-1.0 * cos(B)) / (-1.0 * sin(B))), pow((x * sin(B)), -1.0));
	}
	return tmp;
}
function code(F, B, x)
	t_0 = sin(B) ^ -1.0
	t_1 = Float64(cos(B) * x)
	tmp = 0.0
	if (F <= -70000.0)
		tmp = Float64(fma(Float64(Float64((fma(2.0, x, 2.0) ^ 2.0) * -0.75) / Float64((F ^ 4.0) * sin(B))), 0.5, Float64(Float64(0.5 * fma(2.0, x, 2.0)) / Float64(Float64(F * F) * sin(B)))) - Float64(Float64(1.0 + t_1) / sin(B)));
	elseif (F <= 1.8)
		tmp = Float64(Float64(fma(fma(Float64((((fma(2.0, x, 2.0) ^ 5.0) ^ -1.0) ^ 0.5) * Float64(Float64(F * F) / sin(B))), 0.375, Float64(Float64(-0.5 * t_0) * (((fma(2.0, x, 2.0) ^ 3.0) ^ -1.0) ^ 0.5))), Float64(F * F), Float64(t_0 * ((fma(2.0, x, 2.0) ^ -1.0) ^ 0.5))) * F) - Float64(t_1 / sin(B)));
	else
		tmp = Float64(x * fma(-1.0, Float64(Float64(-1.0 * cos(B)) / Float64(-1.0 * sin(B))), (Float64(x * sin(B)) ^ -1.0)));
	end
	return tmp
end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -70000.0], N[(N[(N[(N[(N[Power[N[(2.0 * x + 2.0), $MachinePrecision], 2.0], $MachinePrecision] * -0.75), $MachinePrecision] / N[(N[Power[F, 4.0], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5 + N[(N[(0.5 * N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision] / N[(N[(F * F), $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 + t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.8], N[(N[(N[(N[(N[(N[Power[N[Power[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], 5.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * N[(N[(F * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.375 + N[(N[(-0.5 * t$95$0), $MachinePrecision] * N[Power[N[Power[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * F), $MachinePrecision] + N[(t$95$0 * N[Power[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - N[(t$95$1 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(-1.0 * N[(N[(-1.0 * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[(-1.0 * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(x * N[Sin[B], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\sin B}^{-1}\\
t_1 := \cos B \cdot x\\
\mathbf{if}\;F \leq -70000:\\
\;\;\;\;\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{2} \cdot -0.75}{{F}^{4} \cdot \sin B}, 0.5, \frac{0.5 \cdot \mathsf{fma}\left(2, x, 2\right)}{\left(F \cdot F\right) \cdot \sin B}\right) - \frac{1 + t\_1}{\sin B}\\

\mathbf{elif}\;F \leq 1.8:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot t\_0\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, t\_0 \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{t\_1}{\sin B}\\

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


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

    1. Initial program 61.6%

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

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

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

    if -7e4 < F < 1.80000000000000004

    1. Initial program 99.5%

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

      \[\leadsto \color{blue}{F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} + {F}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{{\left(2 + 2 \cdot x\right)}^{3}}}\right) + \frac{3}{8} \cdot \left(\frac{{F}^{2}}{\sin B} \cdot \sqrt{\frac{1}{{\left(2 + 2 \cdot x\right)}^{5}}}\right)\right)\right) - \frac{x \cdot \cos B}{\sin B}} \]
    4. Applied rewrites98.4%

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

    if 1.80000000000000004 < F

    1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, \frac{1}{x \cdot \sin B}\right) \]
      6. inv-powN/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      7. lower-pow.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      8. lower-*.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      9. lift-sin.f6488.5

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    8. Applied rewrites88.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -70000:\\ \;\;\;\;\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{2} \cdot -0.75}{{F}^{4} \cdot \sin B}, 0.5, \frac{0.5 \cdot \mathsf{fma}\left(2, x, 2\right)}{\left(F \cdot F\right) \cdot \sin B}\right) - \frac{1 + \cos B \cdot x}{\sin B}\\ \mathbf{elif}\;F \leq 1.8:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot {\sin B}^{-1}\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, {\sin B}^{-1} \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{\cos B \cdot x}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \cos B}{-1 \cdot \sin B}, {\left(x \cdot \sin B\right)}^{-1}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 81.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin B}^{-1}\\ \mathbf{if}\;F \leq -5.3 \cdot 10^{+25} \lor \neg \left(F \leq 1.8\right):\\ \;\;\;\;x \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \cos B}{-1 \cdot \sin B}, {\left(x \cdot \sin B\right)}^{-1}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot t\_0\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, t\_0 \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{\cos B \cdot x}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (pow (sin B) -1.0)))
   (if (or (<= F -5.3e+25) (not (<= F 1.8)))
     (*
      x
      (fma
       -1.0
       (/ (* -1.0 (cos B)) (* -1.0 (sin B)))
       (pow (* x (sin B)) -1.0)))
     (-
      (*
       (fma
        (fma
         (* (pow (pow (pow (fma 2.0 x 2.0) 5.0) -1.0) 0.5) (/ (* F F) (sin B)))
         0.375
         (* (* -0.5 t_0) (pow (pow (pow (fma 2.0 x 2.0) 3.0) -1.0) 0.5)))
        (* F F)
        (* t_0 (pow (pow (fma 2.0 x 2.0) -1.0) 0.5)))
       F)
      (/ (* (cos B) x) (sin B))))))
double code(double F, double B, double x) {
	double t_0 = pow(sin(B), -1.0);
	double tmp;
	if ((F <= -5.3e+25) || !(F <= 1.8)) {
		tmp = x * fma(-1.0, ((-1.0 * cos(B)) / (-1.0 * sin(B))), pow((x * sin(B)), -1.0));
	} else {
		tmp = (fma(fma((pow(pow(pow(fma(2.0, x, 2.0), 5.0), -1.0), 0.5) * ((F * F) / sin(B))), 0.375, ((-0.5 * t_0) * pow(pow(pow(fma(2.0, x, 2.0), 3.0), -1.0), 0.5))), (F * F), (t_0 * pow(pow(fma(2.0, x, 2.0), -1.0), 0.5))) * F) - ((cos(B) * x) / sin(B));
	}
	return tmp;
}
function code(F, B, x)
	t_0 = sin(B) ^ -1.0
	tmp = 0.0
	if ((F <= -5.3e+25) || !(F <= 1.8))
		tmp = Float64(x * fma(-1.0, Float64(Float64(-1.0 * cos(B)) / Float64(-1.0 * sin(B))), (Float64(x * sin(B)) ^ -1.0)));
	else
		tmp = Float64(Float64(fma(fma(Float64((((fma(2.0, x, 2.0) ^ 5.0) ^ -1.0) ^ 0.5) * Float64(Float64(F * F) / sin(B))), 0.375, Float64(Float64(-0.5 * t_0) * (((fma(2.0, x, 2.0) ^ 3.0) ^ -1.0) ^ 0.5))), Float64(F * F), Float64(t_0 * ((fma(2.0, x, 2.0) ^ -1.0) ^ 0.5))) * F) - Float64(Float64(cos(B) * x) / sin(B)));
	end
	return tmp
end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]}, If[Or[LessEqual[F, -5.3e+25], N[Not[LessEqual[F, 1.8]], $MachinePrecision]], N[(x * N[(-1.0 * N[(N[(-1.0 * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[(-1.0 * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(x * N[Sin[B], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[Power[N[Power[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], 5.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision] * N[(N[(F * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.375 + N[(N[(-0.5 * t$95$0), $MachinePrecision] * N[Power[N[Power[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], 3.0], $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * F), $MachinePrecision] + N[(t$95$0 * N[Power[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - N[(N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\sin B}^{-1}\\
\mathbf{if}\;F \leq -5.3 \cdot 10^{+25} \lor \neg \left(F \leq 1.8\right):\\
\;\;\;\;x \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \cos B}{-1 \cdot \sin B}, {\left(x \cdot \sin B\right)}^{-1}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot t\_0\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, t\_0 \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{\cos B \cdot x}{\sin B}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -5.29999999999999986e25 or 1.80000000000000004 < F

    1. Initial program 65.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, \frac{1}{x \cdot \sin B}\right) \]
      6. inv-powN/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      7. lower-pow.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      8. lower-*.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      9. lift-sin.f6471.3

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    8. Applied rewrites71.3%

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

    if -5.29999999999999986e25 < F < 1.80000000000000004

    1. Initial program 99.5%

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

      \[\leadsto \color{blue}{F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}} + {F}^{2} \cdot \left(\frac{-1}{2} \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{{\left(2 + 2 \cdot x\right)}^{3}}}\right) + \frac{3}{8} \cdot \left(\frac{{F}^{2}}{\sin B} \cdot \sqrt{\frac{1}{{\left(2 + 2 \cdot x\right)}^{5}}}\right)\right)\right) - \frac{x \cdot \cos B}{\sin B}} \]
    4. Applied rewrites97.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot {\sin B}^{-1}\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, {\sin B}^{-1} \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{\cos B \cdot x}{\sin B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -5.3 \cdot 10^{+25} \lor \neg \left(F \leq 1.8\right):\\ \;\;\;\;x \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \cos B}{-1 \cdot \sin B}, {\left(x \cdot \sin B\right)}^{-1}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{5}\right)}^{-1}\right)}^{0.5} \cdot \frac{F \cdot F}{\sin B}, 0.375, \left(-0.5 \cdot {\sin B}^{-1}\right) \cdot {\left({\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{3}\right)}^{-1}\right)}^{0.5}\right), F \cdot F, {\sin B}^{-1} \cdot {\left({\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}\right)}^{0.5}\right) \cdot F - \frac{\cos B \cdot x}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 53.5% accurate, N/A× speedup?

\[\begin{array}{l} \\ x \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \cos B}{-1 \cdot \sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \end{array} \]
(FPCore (F B x)
 :precision binary64
 (*
  x
  (fma -1.0 (/ (* -1.0 (cos B)) (* -1.0 (sin B))) (pow (* x (sin B)) -1.0))))
double code(double F, double B, double x) {
	return x * fma(-1.0, ((-1.0 * cos(B)) / (-1.0 * sin(B))), pow((x * sin(B)), -1.0));
}
function code(F, B, x)
	return Float64(x * fma(-1.0, Float64(Float64(-1.0 * cos(B)) / Float64(-1.0 * sin(B))), (Float64(x * sin(B)) ^ -1.0)))
end
code[F_, B_, x_] := N[(x * N[(-1.0 * N[(N[(-1.0 * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[(-1.0 * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(x * N[Sin[B], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \cos B}{-1 \cdot \sin B}, {\left(x \cdot \sin B\right)}^{-1}\right)
\end{array}
Derivation
  1. Initial program 82.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, \frac{1}{x \cdot \sin B}\right) \]
    6. inv-powN/A

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    7. lower-pow.f64N/A

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    8. lower-*.f64N/A

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    9. lift-sin.f6451.3

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
  8. Applied rewrites51.3%

    \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right)} \]
  9. Final simplification51.3%

    \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \cos B}{-1 \cdot \sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
  10. Add Preprocessing

Alternative 11: 31.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \sin B\\ t_1 := {t\_0}^{-0.5}\\ t_2 := {t\_0}^{-1}\\ t_3 := -1 \cdot t\_2\\ t_4 := -1 \cdot \cos B\\ t_5 := \frac{t\_4}{\sin B}\\ \mathbf{if}\;B \leq 7.8 \cdot 10^{-119}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(-1, \frac{t\_4}{-1 \cdot \sin B}, t\_1 \cdot t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{{t\_5}^{3} + {t\_2}^{3}}{t\_5 \cdot t\_5 + \left(t\_3 \cdot t\_3 - t\_5 \cdot t\_2\right)}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (* x (sin B)))
        (t_1 (pow t_0 -0.5))
        (t_2 (pow t_0 -1.0))
        (t_3 (* -1.0 t_2))
        (t_4 (* -1.0 (cos B)))
        (t_5 (/ t_4 (sin B))))
   (if (<= B 7.8e-119)
     (* x (fma -1.0 (/ t_4 (* -1.0 (sin B))) (* t_1 t_1)))
     (*
      x
      (/
       (+ (pow t_5 3.0) (pow t_2 3.0))
       (+ (* t_5 t_5) (- (* t_3 t_3) (* t_5 t_2))))))))
double code(double F, double B, double x) {
	double t_0 = x * sin(B);
	double t_1 = pow(t_0, -0.5);
	double t_2 = pow(t_0, -1.0);
	double t_3 = -1.0 * t_2;
	double t_4 = -1.0 * cos(B);
	double t_5 = t_4 / sin(B);
	double tmp;
	if (B <= 7.8e-119) {
		tmp = x * fma(-1.0, (t_4 / (-1.0 * sin(B))), (t_1 * t_1));
	} else {
		tmp = x * ((pow(t_5, 3.0) + pow(t_2, 3.0)) / ((t_5 * t_5) + ((t_3 * t_3) - (t_5 * t_2))));
	}
	return tmp;
}
function code(F, B, x)
	t_0 = Float64(x * sin(B))
	t_1 = t_0 ^ -0.5
	t_2 = t_0 ^ -1.0
	t_3 = Float64(-1.0 * t_2)
	t_4 = Float64(-1.0 * cos(B))
	t_5 = Float64(t_4 / sin(B))
	tmp = 0.0
	if (B <= 7.8e-119)
		tmp = Float64(x * fma(-1.0, Float64(t_4 / Float64(-1.0 * sin(B))), Float64(t_1 * t_1)));
	else
		tmp = Float64(x * Float64(Float64((t_5 ^ 3.0) + (t_2 ^ 3.0)) / Float64(Float64(t_5 * t_5) + Float64(Float64(t_3 * t_3) - Float64(t_5 * t_2)))));
	end
	return tmp
end
code[F_, B_, x_] := Block[{t$95$0 = N[(x * N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[t$95$0, -0.5], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$0, -1.0], $MachinePrecision]}, Block[{t$95$3 = N[(-1.0 * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(-1.0 * N[Cos[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 7.8e-119], N[(x * N[(-1.0 * N[(t$95$4 / N[(-1.0 * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(N[Power[t$95$5, 3.0], $MachinePrecision] + N[Power[t$95$2, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$5 * t$95$5), $MachinePrecision] + N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(t$95$5 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \sin B\\
t_1 := {t\_0}^{-0.5}\\
t_2 := {t\_0}^{-1}\\
t_3 := -1 \cdot t\_2\\
t_4 := -1 \cdot \cos B\\
t_5 := \frac{t\_4}{\sin B}\\
\mathbf{if}\;B \leq 7.8 \cdot 10^{-119}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(-1, \frac{t\_4}{-1 \cdot \sin B}, t\_1 \cdot t\_1\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{{t\_5}^{3} + {t\_2}^{3}}{t\_5 \cdot t\_5 + \left(t\_3 \cdot t\_3 - t\_5 \cdot t\_2\right)}\\


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

    1. Initial program 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, \frac{1}{x \cdot \sin B}\right) \]
      6. inv-powN/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      7. lower-pow.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      8. lower-*.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      9. lift-sin.f6450.4

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    8. Applied rewrites50.4%

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      4. sqr-powN/A

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{\frac{-1}{2}} \cdot {\left(x \cdot \sin B\right)}^{\left(\frac{-1}{2}\right)}\right) \]
      7. lower-pow.f64N/A

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{\frac{-1}{2}} \cdot {\left(x \cdot \sin B\right)}^{\frac{-1}{2}}\right) \]
      11. lower-pow.f64N/A

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

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{\frac{-1}{2}} \cdot {\left(x \cdot \sin B\right)}^{\frac{-1}{2}}\right) \]
      13. lift-*.f6422.1

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-0.5} \cdot {\left(x \cdot \sin B\right)}^{-0.5}\right) \]
    10. Applied rewrites22.1%

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

    if 7.7999999999999998e-119 < B

    1. Initial program 87.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, \frac{1}{x \cdot \sin B}\right) \]
      6. inv-powN/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      7. lower-pow.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      8. lower-*.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
      9. lift-sin.f6453.2

        \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    8. Applied rewrites53.2%

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(-1 \cdot \frac{\cos B}{\sin B} + {\left(x \cdot \sin B\right)}^{-1}\right) \]
      8. flip3-+N/A

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 7.8 \cdot 10^{-119}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(-1, \frac{-1 \cdot \cos B}{-1 \cdot \sin B}, {\left(x \cdot \sin B\right)}^{-0.5} \cdot {\left(x \cdot \sin B\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{{\left(\frac{-1 \cdot \cos B}{\sin B}\right)}^{3} + {\left({\left(x \cdot \sin B\right)}^{-1}\right)}^{3}}{\frac{-1 \cdot \cos B}{\sin B} \cdot \frac{-1 \cdot \cos B}{\sin B} + \left(\left(-1 \cdot {\left(x \cdot \sin B\right)}^{-1}\right) \cdot \left(-1 \cdot {\left(x \cdot \sin B\right)}^{-1}\right) - \frac{-1 \cdot \cos B}{\sin B} \cdot {\left(x \cdot \sin B\right)}^{-1}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 31.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x \cdot \sin B\right)}^{-1}\\ t_1 := -1 \cdot t\_0\\ t_2 := \frac{-1 \cdot \cos B}{\sin B}\\ x \cdot \frac{{t\_2}^{3} + {t\_0}^{3}}{t\_2 \cdot t\_2 + \left(t\_1 \cdot t\_1 - t\_2 \cdot t\_0\right)} \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (let* ((t_0 (pow (* x (sin B)) -1.0))
        (t_1 (* -1.0 t_0))
        (t_2 (/ (* -1.0 (cos B)) (sin B))))
   (*
    x
    (/
     (+ (pow t_2 3.0) (pow t_0 3.0))
     (+ (* t_2 t_2) (- (* t_1 t_1) (* t_2 t_0)))))))
double code(double F, double B, double x) {
	double t_0 = pow((x * sin(B)), -1.0);
	double t_1 = -1.0 * t_0;
	double t_2 = (-1.0 * cos(B)) / sin(B);
	return x * ((pow(t_2, 3.0) + pow(t_0, 3.0)) / ((t_2 * t_2) + ((t_1 * t_1) - (t_2 * t_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
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    t_0 = (x * sin(b)) ** (-1.0d0)
    t_1 = (-1.0d0) * t_0
    t_2 = ((-1.0d0) * cos(b)) / sin(b)
    code = x * (((t_2 ** 3.0d0) + (t_0 ** 3.0d0)) / ((t_2 * t_2) + ((t_1 * t_1) - (t_2 * t_0))))
end function
public static double code(double F, double B, double x) {
	double t_0 = Math.pow((x * Math.sin(B)), -1.0);
	double t_1 = -1.0 * t_0;
	double t_2 = (-1.0 * Math.cos(B)) / Math.sin(B);
	return x * ((Math.pow(t_2, 3.0) + Math.pow(t_0, 3.0)) / ((t_2 * t_2) + ((t_1 * t_1) - (t_2 * t_0))));
}
def code(F, B, x):
	t_0 = math.pow((x * math.sin(B)), -1.0)
	t_1 = -1.0 * t_0
	t_2 = (-1.0 * math.cos(B)) / math.sin(B)
	return x * ((math.pow(t_2, 3.0) + math.pow(t_0, 3.0)) / ((t_2 * t_2) + ((t_1 * t_1) - (t_2 * t_0))))
function code(F, B, x)
	t_0 = Float64(x * sin(B)) ^ -1.0
	t_1 = Float64(-1.0 * t_0)
	t_2 = Float64(Float64(-1.0 * cos(B)) / sin(B))
	return Float64(x * Float64(Float64((t_2 ^ 3.0) + (t_0 ^ 3.0)) / Float64(Float64(t_2 * t_2) + Float64(Float64(t_1 * t_1) - Float64(t_2 * t_0)))))
end
function tmp = code(F, B, x)
	t_0 = (x * sin(B)) ^ -1.0;
	t_1 = -1.0 * t_0;
	t_2 = (-1.0 * cos(B)) / sin(B);
	tmp = x * (((t_2 ^ 3.0) + (t_0 ^ 3.0)) / ((t_2 * t_2) + ((t_1 * t_1) - (t_2 * t_0))));
end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[(x * N[Sin[B], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-1.0 * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, N[(x * N[(N[(N[Power[t$95$2, 3.0], $MachinePrecision] + N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$2 * t$95$2), $MachinePrecision] + N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(t$95$2 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(x \cdot \sin B\right)}^{-1}\\
t_1 := -1 \cdot t\_0\\
t_2 := \frac{-1 \cdot \cos B}{\sin B}\\
x \cdot \frac{{t\_2}^{3} + {t\_0}^{3}}{t\_2 \cdot t\_2 + \left(t\_1 \cdot t\_1 - t\_2 \cdot t\_0\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 82.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, \frac{1}{x \cdot \sin B}\right) \]
    6. inv-powN/A

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    7. lower-pow.f64N/A

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    8. lower-*.f64N/A

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
    9. lift-sin.f6451.3

      \[\leadsto x \cdot \mathsf{fma}\left(-1, \frac{\cos B}{\sin B}, {\left(x \cdot \sin B\right)}^{-1}\right) \]
  8. Applied rewrites51.3%

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

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

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

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

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

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

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

      \[\leadsto x \cdot \left(-1 \cdot \frac{\cos B}{\sin B} + {\left(x \cdot \sin B\right)}^{-1}\right) \]
    8. flip3-+N/A

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

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

    \[\leadsto x \cdot \frac{{\left(-1 \cdot \frac{\cos B}{\sin B}\right)}^{3} + {\left({\left(x \cdot \sin B\right)}^{-1}\right)}^{3}}{\left(-1 \cdot \frac{\cos B}{\sin B}\right) \cdot \left(-1 \cdot \frac{\cos B}{\sin B}\right) + \color{blue}{\left({\left(x \cdot \sin B\right)}^{-1} \cdot {\left(x \cdot \sin B\right)}^{-1} - \left(-1 \cdot \frac{\cos B}{\sin B}\right) \cdot {\left(x \cdot \sin B\right)}^{-1}\right)}} \]
  11. Final simplification30.3%

    \[\leadsto x \cdot \frac{{\left(\frac{-1 \cdot \cos B}{\sin B}\right)}^{3} + {\left({\left(x \cdot \sin B\right)}^{-1}\right)}^{3}}{\frac{-1 \cdot \cos B}{\sin B} \cdot \frac{-1 \cdot \cos B}{\sin B} + \left(\left(-1 \cdot {\left(x \cdot \sin B\right)}^{-1}\right) \cdot \left(-1 \cdot {\left(x \cdot \sin B\right)}^{-1}\right) - \frac{-1 \cdot \cos B}{\sin B} \cdot {\left(x \cdot \sin B\right)}^{-1}\right)} \]
  12. Add Preprocessing

Reproduce

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