VandenBroeck and Keller, Equation (23)

Percentage Accurate: 77.8% → 99.6%
Time: 22.6s
Alternatives: 19
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 77.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;F \leq 10000000:\\
\;\;\;\;\frac{F}{\sin B} \cdot {\left(\left(2 + F \cdot F\right) + x \cdot 2\right)}^{-0.5} - t_0\\

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


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

    1. Initial program 51.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 99.8%

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

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u77.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef77.5%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr77.5%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. expm1-def77.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p99.8%

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

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

    if -9.9999999999999993e44 < F < 1e7

    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. div-inv42.2%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u24.0%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef24.0%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr59.5%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def24.0%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p42.2%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified99.7%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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 1e7 < F

    1. Initial program 49.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. div-inv44.4%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u21.0%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef21.0%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr27.6%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def21.0%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p44.4%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified49.6%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around inf 99.9%

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

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

Alternative 2: 99.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\

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


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

    1. Initial program 73.0%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv94.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u39.7%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef39.7%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr25.9%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def39.7%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p94.8%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified73.1%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around inf 99.8%

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

    if -1 < x

    1. Initial program 74.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. Step-by-step derivation
      1. add-sqr-sqrt74.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \left({\left(\mathsf{hypot}\left(F, \sqrt{\color{blue}{x \cdot 2 + 2}}\right)\right)}^{\left(-\frac{1}{2}\right)} \cdot {\left(\sqrt{\left(F \cdot F + 2\right) + 2 \cdot x}\right)}^{\left(-\frac{1}{2}\right)}\right) \]
      10. *-commutative74.2%

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

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

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

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\left({\left(\mathsf{hypot}\left(F, \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right)\right)}^{-0.5} \cdot {\left(\mathsf{hypot}\left(F, \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right)\right)}^{-0.5}\right)} \]
    5. Step-by-step derivation
      1. pow-sqr89.8%

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

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

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\frac{1}{\mathsf{hypot}\left(F, \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right)}} \]
    7. Step-by-step derivation
      1. *-commutative89.8%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1 \cdot F}{\mathsf{hypot}\left(F, \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right) \cdot \sin B}} \]
      3. *-un-lft-identity99.5%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{F}{\mathsf{hypot}\left(F, \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right) \cdot \sin B}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.6%

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

Alternative 3: 98.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -19000000:\\
\;\;\;\;\frac{-1}{\sin B} - t_0\\

\mathbf{elif}\;F \leq 1.25:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B \cdot \sqrt{2 + x \cdot 2}}\\

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


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

    1. Initial program 57.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 99.7%

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

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u76.7%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef76.7%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr76.7%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. expm1-def76.7%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p99.8%

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

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

    if -1.9e7 < F < 1.25

    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. add-sqr-sqrt99.4%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\color{blue}{\left(\sqrt{\left(F \cdot F + 2\right) + 2 \cdot x} \cdot \sqrt{\left(F \cdot F + 2\right) + 2 \cdot x}\right)}}^{\left(-\frac{1}{2}\right)} \]
      2. unpow-prod-down99.4%

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

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

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \left({\left(\mathsf{hypot}\left(F, \sqrt{\color{blue}{x \cdot 2 + 2}}\right)\right)}^{\left(-\frac{1}{2}\right)} \cdot {\left(\sqrt{\left(F \cdot F + 2\right) + 2 \cdot x}\right)}^{\left(-\frac{1}{2}\right)}\right) \]
      10. *-commutative99.4%

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \left({\left(\mathsf{hypot}\left(F, \sqrt{\color{blue}{\mathsf{fma}\left(2, x, 2\right)}}\right)\right)}^{\left(-\frac{1}{2}\right)} \cdot {\left(\sqrt{\left(F \cdot F + 2\right) + 2 \cdot x}\right)}^{\left(-\frac{1}{2}\right)}\right) \]
      12. metadata-eval99.4%

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \left({\left(\mathsf{hypot}\left(F, \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right)\right)}^{\left(-\color{blue}{0.5}\right)} \cdot {\left(\sqrt{\left(F \cdot F + 2\right) + 2 \cdot x}\right)}^{\left(-\frac{1}{2}\right)}\right) \]
      13. metadata-eval99.4%

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

      \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \color{blue}{\left({\left(\mathsf{hypot}\left(F, \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right)\right)}^{-0.5} \cdot {\left(\mathsf{hypot}\left(F, \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right)\right)}^{-0.5}\right)} \]
    5. Step-by-step derivation
      1. pow-sqr99.4%

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

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

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

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

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

        \[\leadsto \left(-x \cdot \frac{1}{\tan B}\right) + \color{blue}{\frac{1 \cdot F}{\mathsf{hypot}\left(F, \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right) \cdot \sin B}} \]
      3. *-un-lft-identity99.5%

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

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

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

    if 1.25 < F

    1. Initial program 51.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef20.3%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr29.0%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified51.4%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around inf 99.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -19000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.25:\\ \;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B \cdot \sqrt{2 + x \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 98.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1650000000:\\
\;\;\;\;\frac{-1}{\sin B} - t_0\\

\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - t_0\\

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


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

    1. Initial program 57.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 99.7%

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

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef76.5%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr76.5%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. expm1-def76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p99.8%

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

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

    if -1.65e9 < F < 1.3999999999999999

    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. div-inv38.9%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u21.8%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef21.8%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr58.7%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def21.8%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p38.9%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified99.7%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around 0 99.2%

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

    if 1.3999999999999999 < F

    1. Initial program 51.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef20.3%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr29.0%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified51.4%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around inf 99.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.4:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 98.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1650000000:\\
\;\;\;\;\frac{-1}{\sin B} - t_0\\

\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - t_0\\

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


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

    1. Initial program 57.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 99.7%

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

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef76.5%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr76.5%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. expm1-def76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p99.8%

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

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

    if -1.65e9 < F < 1.3999999999999999

    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. Simplified99.6%

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

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

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

    if 1.3999999999999999 < F

    1. Initial program 51.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef20.3%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr29.0%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified51.4%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around inf 99.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.4:\\ \;\;\;\;F \cdot \frac{\sqrt{0.5}}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 98.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1650000000:\\
\;\;\;\;\frac{-1}{\sin B} - t_0\\

\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{2}} - t_0\\

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


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

    1. Initial program 57.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 99.7%

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

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef76.5%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr76.5%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. expm1-def76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p99.8%

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

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

    if -1.65e9 < F < 1.3999999999999999

    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. Simplified99.6%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u90.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef70.3%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      9. frac-times70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{F}}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right) - \frac{x}{\tan B} \]
    6. Applied egg-rr70.3%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def90.3%

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

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

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

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

    if 1.3999999999999999 < F

    1. Initial program 51.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef20.3%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr29.0%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified51.4%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around inf 99.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.4:\\ \;\;\;\;\frac{F}{\sin B \cdot \sqrt{2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 91.1% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_0 := 2 + x \cdot 2\\
t_1 := \sqrt{\frac{1}{t_0}}\\
t_2 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1650000000:\\
\;\;\;\;\frac{-1}{\sin B} - t_2\\

\mathbf{elif}\;F \leq 1.35 \cdot 10^{-149}:\\
\;\;\;\;t_1 \cdot \frac{F}{B} - t_2\\

\mathbf{elif}\;F \leq 8.6 \cdot 10^{-122}:\\
\;\;\;\;\frac{F}{\sin B} \cdot t_1 - \frac{x}{B}\\

\mathbf{elif}\;F \leq 0.102:\\
\;\;\;\;\frac{F}{B \cdot \sqrt{t_0}} - t_2\\

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


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

    1. Initial program 57.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 99.7%

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

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef76.5%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr76.5%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. expm1-def76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p99.8%

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

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

    if -1.65e9 < F < 1.35000000000000007e-149

    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. Simplified99.7%

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

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

      \[\leadsto \color{blue}{\frac{F}{B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}} - \frac{x}{\tan B} \]

    if 1.35000000000000007e-149 < F < 8.60000000000000037e-122

    1. Initial program 99.2%

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

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

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

    if 8.60000000000000037e-122 < F < 0.101999999999999993

    1. Initial program 99.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. Simplified99.5%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u77.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef59.7%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*59.7%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv59.7%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div59.7%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval59.7%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative59.7%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef59.7%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity59.7%

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

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def77.5%

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

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

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

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

    if 0.101999999999999993 < F

    1. Initial program 51.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef20.3%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr29.0%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified51.4%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around inf 99.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.35 \cdot 10^{-149}:\\ \;\;\;\;\sqrt{\frac{1}{2 + x \cdot 2}} \cdot \frac{F}{B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 8.6 \cdot 10^{-122}:\\ \;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{2 + x \cdot 2}} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 0.102:\\ \;\;\;\;\frac{F}{B \cdot \sqrt{2 + x \cdot 2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 91.5% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1650000000:\\
\;\;\;\;\frac{-1}{\sin B} - t_0\\

\mathbf{elif}\;F \leq 0.15:\\
\;\;\;\;\frac{F}{B \cdot \sqrt{2 + x \cdot 2}} - t_0\\

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


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

    1. Initial program 57.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 99.7%

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

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef76.5%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr76.5%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. expm1-def76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p99.8%

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

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

    if -1.65e9 < F < 0.149999999999999994

    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. Simplified99.6%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u90.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef70.3%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      9. frac-times70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity70.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{F}}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right) - \frac{x}{\tan B} \]
    6. Applied egg-rr70.3%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def90.3%

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

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

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

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

    if 0.149999999999999994 < F

    1. Initial program 51.3%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-inv44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef20.3%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr29.0%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def20.3%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p44.0%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified51.4%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around inf 99.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 0.15:\\ \;\;\;\;\frac{F}{B \cdot \sqrt{2 + x \cdot 2}} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 84.6% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1650000000:\\
\;\;\;\;\frac{-1}{\sin B} - t_0\\

\mathbf{elif}\;F \leq 2.35 \cdot 10^{-49}:\\
\;\;\;\;\frac{-x}{\tan B}\\

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


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

    1. Initial program 57.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 99.7%

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

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef76.5%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr76.5%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. expm1-def76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p99.8%

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

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

    if -1.65e9 < F < 2.35000000000000011e-49

    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. Simplified99.6%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u92.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef72.3%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*72.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv72.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div72.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval72.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative72.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef72.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      9. frac-times72.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity72.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{F}}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right) - \frac{x}{\tan B} \]
    6. Applied egg-rr72.3%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def92.5%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg67.9%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*67.9%

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac67.9%

        \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    11. Simplified67.9%

      \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u59.7%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)\right)}} \]
      2. expm1-udef34.7%

        \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)} - 1}} \]
      3. quot-tan34.8%

        \[\leadsto \frac{-x}{e^{\mathsf{log1p}\left(\color{blue}{\tan B}\right)} - 1} \]
    13. Applied egg-rr34.8%

      \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\tan B\right)} - 1}} \]
    14. Step-by-step derivation
      1. expm1-def59.8%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan B\right)\right)}} \]
      2. expm1-log1p68.0%

        \[\leadsto \frac{-x}{\color{blue}{\tan B}} \]
    15. Simplified68.0%

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

    if 2.35000000000000011e-49 < F

    1. Initial program 55.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. div-inv43.4%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u19.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef19.5%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    4. Applied egg-rr31.9%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    5. Step-by-step derivation
      1. expm1-def19.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p43.4%

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
    6. Simplified55.7%

      \[\leadsto \left(-\color{blue}{\frac{x}{\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. Taylor expanded in F around inf 94.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 2.35 \cdot 10^{-49}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{\tan B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 77.7% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.1 \cdot 10^{-24}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1650000000.0)
   (- (/ -1.0 (sin B)) (/ x (tan B)))
   (if (<= F 1.1e-24) (/ (- x) (tan B)) (- (/ 1.0 (sin B)) (/ x B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1650000000.0) {
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	} else if (F <= 1.1e-24) {
		tmp = -x / tan(B);
	} else {
		tmp = (1.0 / sin(B)) - (x / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-1650000000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / tan(b))
    else if (f <= 1.1d-24) then
        tmp = -x / tan(b)
    else
        tmp = (1.0d0 / sin(b)) - (x / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -1650000000.0) {
		tmp = (-1.0 / Math.sin(B)) - (x / Math.tan(B));
	} else if (F <= 1.1e-24) {
		tmp = -x / Math.tan(B);
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1650000000.0:
		tmp = (-1.0 / math.sin(B)) - (x / math.tan(B))
	elif F <= 1.1e-24:
		tmp = -x / math.tan(B)
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1650000000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B)));
	elseif (F <= 1.1e-24)
		tmp = Float64(Float64(-x) / tan(B));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1650000000.0)
		tmp = (-1.0 / sin(B)) - (x / tan(B));
	elseif (F <= 1.1e-24)
		tmp = -x / tan(B);
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1650000000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.1e-24], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1650000000:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\

\mathbf{elif}\;F \leq 1.1 \cdot 10^{-24}:\\
\;\;\;\;\frac{-x}{\tan B}\\

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


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

    1. Initial program 57.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 99.7%

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

        \[\leadsto \left(-\color{blue}{\frac{x}{\tan B}}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p-u76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      3. expm1-udef76.5%

        \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    5. Applied egg-rr76.5%

      \[\leadsto \left(-\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{x}{\tan B}\right)} - 1\right)}\right) + \frac{-1}{\sin B} \]
    6. Step-by-step derivation
      1. expm1-def76.5%

        \[\leadsto \left(-\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{x}{\tan B}\right)\right)}\right) + \frac{-1}{\sin B} \]
      2. expm1-log1p99.8%

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

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

    if -1.65e9 < F < 1.10000000000000001e-24

    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. Simplified99.6%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u91.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef71.5%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef71.5%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity71.5%

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

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def91.8%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg67.3%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*67.3%

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac67.3%

        \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    11. Simplified67.3%

      \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u59.5%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)\right)}} \]
      2. expm1-udef34.4%

        \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)} - 1}} \]
      3. quot-tan34.5%

        \[\leadsto \frac{-x}{e^{\mathsf{log1p}\left(\color{blue}{\tan B}\right)} - 1} \]
    13. Applied egg-rr34.5%

      \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\tan B\right)} - 1}} \]
    14. Step-by-step derivation
      1. expm1-def59.5%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan B\right)\right)}} \]
      2. expm1-log1p67.4%

        \[\leadsto \frac{-x}{\color{blue}{\tan B}} \]
    15. Simplified67.4%

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

    if 1.10000000000000001e-24 < F

    1. Initial program 53.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \leq 1.1 \cdot 10^{-24}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 64.0% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -3.05 \cdot 10^{+60}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 5.6 \cdot 10^{-25}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -3.05e+60)
   (/ -1.0 (sin B))
   (if (<= F 5.6e-25) (/ (- x) (tan B)) (- (/ 1.0 (sin B)) (/ x B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.05e+60) {
		tmp = -1.0 / sin(B);
	} else if (F <= 5.6e-25) {
		tmp = -x / tan(B);
	} else {
		tmp = (1.0 / sin(B)) - (x / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-3.05d+60)) then
        tmp = (-1.0d0) / sin(b)
    else if (f <= 5.6d-25) then
        tmp = -x / tan(b)
    else
        tmp = (1.0d0 / sin(b)) - (x / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.05e+60) {
		tmp = -1.0 / Math.sin(B);
	} else if (F <= 5.6e-25) {
		tmp = -x / Math.tan(B);
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -3.05e+60:
		tmp = -1.0 / math.sin(B)
	elif F <= 5.6e-25:
		tmp = -x / math.tan(B)
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -3.05e+60)
		tmp = Float64(-1.0 / sin(B));
	elseif (F <= 5.6e-25)
		tmp = Float64(Float64(-x) / tan(B));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -3.05e+60)
		tmp = -1.0 / sin(B);
	elseif (F <= 5.6e-25)
		tmp = -x / tan(B);
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -3.05e+60], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.6e-25], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.05 \cdot 10^{+60}:\\
\;\;\;\;\frac{-1}{\sin B}\\

\mathbf{elif}\;F \leq 5.6 \cdot 10^{-25}:\\
\;\;\;\;\frac{-x}{\tan B}\\

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


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

    1. Initial program 47.8%

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

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

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

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

    if -3.05e60 < F < 5.59999999999999976e-25

    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. Simplified99.6%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u86.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef68.4%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*68.4%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv68.4%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval68.4%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative68.4%

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity68.4%

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

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def86.9%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg67.1%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*67.2%

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac67.2%

        \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    11. Simplified67.2%

      \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u59.9%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)\right)}} \]
      2. expm1-udef34.7%

        \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)} - 1}} \]
      3. quot-tan34.8%

        \[\leadsto \frac{-x}{e^{\mathsf{log1p}\left(\color{blue}{\tan B}\right)} - 1} \]
    13. Applied egg-rr34.8%

      \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\tan B\right)} - 1}} \]
    14. Step-by-step derivation
      1. expm1-def60.0%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan B\right)\right)}} \]
      2. expm1-log1p67.2%

        \[\leadsto \frac{-x}{\color{blue}{\tan B}} \]
    15. Simplified67.2%

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

    if 5.59999999999999976e-25 < F

    1. Initial program 53.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.05 \cdot 10^{+60}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 5.6 \cdot 10^{-25}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 70.9% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.1 \cdot 10^{-24}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1650000000.0)
   (- (/ -1.0 (sin B)) (/ x B))
   (if (<= F 1.1e-24) (/ (- x) (tan B)) (- (/ 1.0 (sin B)) (/ x B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1650000000.0) {
		tmp = (-1.0 / sin(B)) - (x / B);
	} else if (F <= 1.1e-24) {
		tmp = -x / tan(B);
	} else {
		tmp = (1.0 / sin(B)) - (x / B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-1650000000.0d0)) then
        tmp = ((-1.0d0) / sin(b)) - (x / b)
    else if (f <= 1.1d-24) then
        tmp = -x / tan(b)
    else
        tmp = (1.0d0 / sin(b)) - (x / b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -1650000000.0) {
		tmp = (-1.0 / Math.sin(B)) - (x / B);
	} else if (F <= 1.1e-24) {
		tmp = -x / Math.tan(B);
	} else {
		tmp = (1.0 / Math.sin(B)) - (x / B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1650000000.0:
		tmp = (-1.0 / math.sin(B)) - (x / B)
	elif F <= 1.1e-24:
		tmp = -x / math.tan(B)
	else:
		tmp = (1.0 / math.sin(B)) - (x / B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1650000000.0)
		tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / B));
	elseif (F <= 1.1e-24)
		tmp = Float64(Float64(-x) / tan(B));
	else
		tmp = Float64(Float64(1.0 / sin(B)) - Float64(x / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1650000000.0)
		tmp = (-1.0 / sin(B)) - (x / B);
	elseif (F <= 1.1e-24)
		tmp = -x / tan(B);
	else
		tmp = (1.0 / sin(B)) - (x / B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1650000000.0], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.1e-24], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1650000000:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\

\mathbf{elif}\;F \leq 1.1 \cdot 10^{-24}:\\
\;\;\;\;\frac{-x}{\tan B}\\

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


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

    1. Initial program 57.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 99.7%

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

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

    if -1.65e9 < F < 1.10000000000000001e-24

    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. Simplified99.6%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u91.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef71.5%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative71.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef71.5%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity71.5%

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

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def91.8%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg67.3%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*67.3%

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac67.3%

        \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    11. Simplified67.3%

      \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u59.5%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)\right)}} \]
      2. expm1-udef34.4%

        \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)} - 1}} \]
      3. quot-tan34.5%

        \[\leadsto \frac{-x}{e^{\mathsf{log1p}\left(\color{blue}{\tan B}\right)} - 1} \]
    13. Applied egg-rr34.5%

      \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\tan B\right)} - 1}} \]
    14. Step-by-step derivation
      1. expm1-def59.5%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan B\right)\right)}} \]
      2. expm1-log1p67.4%

        \[\leadsto \frac{-x}{\color{blue}{\tan B}} \]
    15. Simplified67.4%

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

    if 1.10000000000000001e-24 < F

    1. Initial program 53.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1650000000:\\ \;\;\;\;\frac{-1}{\sin B} - \frac{x}{B}\\ \mathbf{elif}\;F \leq 1.1 \cdot 10^{-24}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sin B} - \frac{x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 54.4% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -2.1 \cdot 10^{+61}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 8.6 \cdot 10^{+194}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + -1}{B}\right|\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -2.1e+61)
   (/ -1.0 (sin B))
   (if (<= F 8.6e+194) (/ (- x) (tan B)) (fabs (/ (+ x -1.0) B)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -2.1e+61) {
		tmp = -1.0 / sin(B);
	} else if (F <= 8.6e+194) {
		tmp = -x / tan(B);
	} else {
		tmp = fabs(((x + -1.0) / B));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-2.1d+61)) then
        tmp = (-1.0d0) / sin(b)
    else if (f <= 8.6d+194) then
        tmp = -x / tan(b)
    else
        tmp = abs(((x + (-1.0d0)) / b))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -2.1e+61) {
		tmp = -1.0 / Math.sin(B);
	} else if (F <= 8.6e+194) {
		tmp = -x / Math.tan(B);
	} else {
		tmp = Math.abs(((x + -1.0) / B));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -2.1e+61:
		tmp = -1.0 / math.sin(B)
	elif F <= 8.6e+194:
		tmp = -x / math.tan(B)
	else:
		tmp = math.fabs(((x + -1.0) / B))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -2.1e+61)
		tmp = Float64(-1.0 / sin(B));
	elseif (F <= 8.6e+194)
		tmp = Float64(Float64(-x) / tan(B));
	else
		tmp = abs(Float64(Float64(x + -1.0) / B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -2.1e+61)
		tmp = -1.0 / sin(B);
	elseif (F <= 8.6e+194)
		tmp = -x / tan(B);
	else
		tmp = abs(((x + -1.0) / B));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -2.1e+61], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 8.6e+194], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[Abs[N[(N[(x + -1.0), $MachinePrecision] / B), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.1 \cdot 10^{+61}:\\
\;\;\;\;\frac{-1}{\sin B}\\

\mathbf{elif}\;F \leq 8.6 \cdot 10^{+194}:\\
\;\;\;\;\frac{-x}{\tan B}\\

\mathbf{else}:\\
\;\;\;\;\left|\frac{x + -1}{B}\right|\\


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

    1. Initial program 47.8%

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

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

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

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

    if -2.1000000000000001e61 < F < 8.59999999999999988e194

    1. Initial program 91.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. Simplified96.3%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u66.9%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef53.6%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*52.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv52.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div52.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval52.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative52.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef52.5%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity53.6%

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

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def66.9%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg62.4%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*62.5%

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac62.5%

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

      \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u55.0%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)\right)}} \]
      2. expm1-udef30.4%

        \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)} - 1}} \]
      3. quot-tan30.5%

        \[\leadsto \frac{-x}{e^{\mathsf{log1p}\left(\color{blue}{\tan B}\right)} - 1} \]
    13. Applied egg-rr30.5%

      \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\tan B\right)} - 1}} \]
    14. Step-by-step derivation
      1. expm1-def55.1%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan B\right)\right)}} \]
      2. expm1-log1p62.5%

        \[\leadsto \frac{-x}{\color{blue}{\tan B}} \]
    15. Simplified62.5%

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

    if 8.59999999999999988e194 < F

    1. Initial program 24.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 32.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. associate-*r/11.2%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in11.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval11.2%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-111.2%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    6. Simplified11.2%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt4.4%

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

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

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

        \[\leadsto \sqrt{{\left(\frac{\color{blue}{\left(-x\right) + -1}}{B}\right)}^{2}} \]
      5. add-sqr-sqrt7.3%

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

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

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

        \[\leadsto \sqrt{{\left(\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}} + -1}{B}\right)}^{2}} \]
      9. add-sqr-sqrt24.8%

        \[\leadsto \sqrt{{\left(\frac{\color{blue}{x} + -1}{B}\right)}^{2}} \]
    8. Applied egg-rr24.8%

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

        \[\leadsto \sqrt{\color{blue}{\frac{x + -1}{B} \cdot \frac{x + -1}{B}}} \]
      2. rem-sqrt-square27.5%

        \[\leadsto \color{blue}{\left|\frac{x + -1}{B}\right|} \]
    10. Simplified27.5%

      \[\leadsto \color{blue}{\left|\frac{x + -1}{B}\right|} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2.1 \cdot 10^{+61}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{elif}\;F \leq 8.6 \cdot 10^{+194}:\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{x + -1}{B}\right|\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 59.8% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{-101} \lor \neg \left(x \leq 6.8 \cdot 10^{-165}\right):\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (or (<= x -1e-101) (not (<= x 6.8e-165)))
   (/ (- x) (tan B))
   (/ -1.0 (sin B))))
double code(double F, double B, double x) {
	double tmp;
	if ((x <= -1e-101) || !(x <= 6.8e-165)) {
		tmp = -x / tan(B);
	} else {
		tmp = -1.0 / sin(B);
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if ((x <= (-1d-101)) .or. (.not. (x <= 6.8d-165))) then
        tmp = -x / tan(b)
    else
        tmp = (-1.0d0) / sin(b)
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if ((x <= -1e-101) || !(x <= 6.8e-165)) {
		tmp = -x / Math.tan(B);
	} else {
		tmp = -1.0 / Math.sin(B);
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if (x <= -1e-101) or not (x <= 6.8e-165):
		tmp = -x / math.tan(B)
	else:
		tmp = -1.0 / math.sin(B)
	return tmp
function code(F, B, x)
	tmp = 0.0
	if ((x <= -1e-101) || !(x <= 6.8e-165))
		tmp = Float64(Float64(-x) / tan(B));
	else
		tmp = Float64(-1.0 / sin(B));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if ((x <= -1e-101) || ~((x <= 6.8e-165)))
		tmp = -x / tan(B);
	else
		tmp = -1.0 / sin(B);
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[Or[LessEqual[x, -1e-101], N[Not[LessEqual[x, 6.8e-165]], $MachinePrecision]], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-101} \lor \neg \left(x \leq 6.8 \cdot 10^{-165}\right):\\
\;\;\;\;\frac{-x}{\tan B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.00000000000000005e-101 or 6.8e-165 < x

    1. Initial program 81.1%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified88.8%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u53.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef51.3%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*50.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv50.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div50.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval50.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative50.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef50.1%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      9. frac-times51.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity51.3%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{F}}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right) - \frac{x}{\tan B} \]
    6. Applied egg-rr51.3%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def53.0%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg78.9%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*79.0%

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac79.0%

        \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    11. Simplified79.0%

      \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    12. Step-by-step derivation
      1. expm1-log1p-u70.0%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)\right)}} \]
      2. expm1-udef41.2%

        \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\frac{\sin B}{\cos B}\right)} - 1}} \]
      3. quot-tan41.3%

        \[\leadsto \frac{-x}{e^{\mathsf{log1p}\left(\color{blue}{\tan B}\right)} - 1} \]
    13. Applied egg-rr41.3%

      \[\leadsto \frac{-x}{\color{blue}{e^{\mathsf{log1p}\left(\tan B\right)} - 1}} \]
    14. Step-by-step derivation
      1. expm1-def70.1%

        \[\leadsto \frac{-x}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan B\right)\right)}} \]
      2. expm1-log1p79.1%

        \[\leadsto \frac{-x}{\color{blue}{\tan B}} \]
    15. Simplified79.1%

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

    if -1.00000000000000005e-101 < x < 6.8e-165

    1. Initial program 61.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 29.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{-101} \lor \neg \left(x \leq 6.8 \cdot 10^{-165}\right):\\ \;\;\;\;\frac{-x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 35.7% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -3.05 \cdot 10^{+60}:\\ \;\;\;\;\frac{-1}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -3.05e+60)
   (/ -1.0 (sin B))
   (- (/ (- x) B) (* B (* x -0.3333333333333333)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.05e+60) {
		tmp = -1.0 / sin(B);
	} else {
		tmp = (-x / B) - (B * (x * -0.3333333333333333));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-3.05d+60)) then
        tmp = (-1.0d0) / sin(b)
    else
        tmp = (-x / b) - (b * (x * (-0.3333333333333333d0)))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.05e+60) {
		tmp = -1.0 / Math.sin(B);
	} else {
		tmp = (-x / B) - (B * (x * -0.3333333333333333));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -3.05e+60:
		tmp = -1.0 / math.sin(B)
	else:
		tmp = (-x / B) - (B * (x * -0.3333333333333333))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -3.05e+60)
		tmp = Float64(-1.0 / sin(B));
	else
		tmp = Float64(Float64(Float64(-x) / B) - Float64(B * Float64(x * -0.3333333333333333)));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -3.05e+60)
		tmp = -1.0 / sin(B);
	else
		tmp = (-x / B) - (B * (x * -0.3333333333333333));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -3.05e+60], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[((-x) / B), $MachinePrecision] - N[(B * N[(x * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.05 \cdot 10^{+60}:\\
\;\;\;\;\frac{-1}{\sin B}\\

\mathbf{else}:\\
\;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\


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

    1. Initial program 47.8%

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

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

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

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

    if -3.05e60 < F

    1. Initial program 80.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. Simplified85.8%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u56.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef45.7%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*44.8%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv44.8%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div44.8%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval44.8%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative44.8%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef44.8%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity45.7%

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

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def56.8%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg57.7%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*57.7%

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac57.7%

        \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    11. Simplified57.7%

      \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    12. Taylor expanded in B around 0 31.6%

      \[\leadsto \color{blue}{-1 \cdot \left(B \cdot \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right)\right) + -1 \cdot \frac{x}{B}} \]
    13. Step-by-step derivation
      1. distribute-lft-out31.6%

        \[\leadsto \color{blue}{-1 \cdot \left(B \cdot \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right) + \frac{x}{B}\right)} \]
      2. distribute-rgt-out--31.6%

        \[\leadsto -1 \cdot \left(B \cdot \color{blue}{\left(x \cdot \left(-0.5 - -0.16666666666666666\right)\right)} + \frac{x}{B}\right) \]
      3. metadata-eval31.6%

        \[\leadsto -1 \cdot \left(B \cdot \left(x \cdot \color{blue}{-0.3333333333333333}\right) + \frac{x}{B}\right) \]
    14. Simplified31.6%

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

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

Alternative 16: 35.8% accurate, 21.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -1.8 \cdot 10^{-129}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -1.8e-129)
   (/ (- -1.0 x) B)
   (- (/ (- x) B) (* B (* x -0.3333333333333333)))))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.8e-129) {
		tmp = (-1.0 - x) / B;
	} else {
		tmp = (-x / B) - (B * (x * -0.3333333333333333));
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-1.8d-129)) then
        tmp = ((-1.0d0) - x) / b
    else
        tmp = (-x / b) - (b * (x * (-0.3333333333333333d0)))
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -1.8e-129) {
		tmp = (-1.0 - x) / B;
	} else {
		tmp = (-x / B) - (B * (x * -0.3333333333333333));
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -1.8e-129:
		tmp = (-1.0 - x) / B
	else:
		tmp = (-x / B) - (B * (x * -0.3333333333333333))
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -1.8e-129)
		tmp = Float64(Float64(-1.0 - x) / B);
	else
		tmp = Float64(Float64(Float64(-x) / B) - Float64(B * Float64(x * -0.3333333333333333)));
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -1.8e-129)
		tmp = (-1.0 - x) / B;
	else
		tmp = (-x / B) - (B * (x * -0.3333333333333333));
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -1.8e-129], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[(N[((-x) / B), $MachinePrecision] - N[(B * N[(x * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.8 \cdot 10^{-129}:\\
\;\;\;\;\frac{-1 - x}{B}\\

\mathbf{else}:\\
\;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\


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

    1. Initial program 70.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 82.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. associate-*r/41.2%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in41.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval41.2%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-141.2%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    6. Simplified41.2%

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

    if -1.8e-129 < F

    1. Initial program 76.0%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \]
    2. Simplified82.6%

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

      \[\leadsto F \cdot \color{blue}{\left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - \frac{x}{\tan B} \]
    5. Step-by-step derivation
      1. expm1-log1p-u53.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)\right)} - \frac{x}{\tan B} \]
      2. expm1-udef43.6%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(F \cdot \left(\frac{1}{\sin B} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)\right)} - 1\right)} - \frac{x}{\tan B} \]
      3. associate-*r*42.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\left(F \cdot \frac{1}{\sin B}\right) \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      4. div-inv42.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F}{\sin B}} \cdot \sqrt{\frac{1}{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      5. sqrt-div42.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{2 + 2 \cdot x}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      6. metadata-eval42.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{\color{blue}{1}}{\sqrt{2 + 2 \cdot x}}\right)} - 1\right) - \frac{x}{\tan B} \]
      7. +-commutative42.5%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\color{blue}{2 \cdot x + 2}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      8. fma-udef42.5%

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{F \cdot 1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}}\right)} - 1\right) - \frac{x}{\tan B} \]
      10. *-rgt-identity43.6%

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

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}}\right)} - 1\right)} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. expm1-def53.5%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}} \]
    10. Step-by-step derivation
      1. mul-1-neg58.5%

        \[\leadsto \color{blue}{-\frac{x \cdot \cos B}{\sin B}} \]
      2. associate-/l*58.5%

        \[\leadsto -\color{blue}{\frac{x}{\frac{\sin B}{\cos B}}} \]
      3. distribute-neg-frac58.5%

        \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    11. Simplified58.5%

      \[\leadsto \color{blue}{\frac{-x}{\frac{\sin B}{\cos B}}} \]
    12. Taylor expanded in B around 0 31.1%

      \[\leadsto \color{blue}{-1 \cdot \left(B \cdot \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right)\right) + -1 \cdot \frac{x}{B}} \]
    13. Step-by-step derivation
      1. distribute-lft-out31.1%

        \[\leadsto \color{blue}{-1 \cdot \left(B \cdot \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right) + \frac{x}{B}\right)} \]
      2. distribute-rgt-out--31.1%

        \[\leadsto -1 \cdot \left(B \cdot \color{blue}{\left(x \cdot \left(-0.5 - -0.16666666666666666\right)\right)} + \frac{x}{B}\right) \]
      3. metadata-eval31.1%

        \[\leadsto -1 \cdot \left(B \cdot \left(x \cdot \color{blue}{-0.3333333333333333}\right) + \frac{x}{B}\right) \]
    14. Simplified31.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -1.8 \cdot 10^{-129}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B} - B \cdot \left(x \cdot -0.3333333333333333\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 35.8% accurate, 32.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -3.05 \cdot 10^{-120}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -3.05e-120) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.05e-120) {
		tmp = (-1.0 - x) / B;
	} else {
		tmp = -x / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-3.05d-120)) then
        tmp = ((-1.0d0) - x) / b
    else
        tmp = -x / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -3.05e-120) {
		tmp = (-1.0 - x) / B;
	} else {
		tmp = -x / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -3.05e-120:
		tmp = (-1.0 - x) / B
	else:
		tmp = -x / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -3.05e-120)
		tmp = Float64(Float64(-1.0 - x) / B);
	else
		tmp = Float64(Float64(-x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -3.05e-120)
		tmp = (-1.0 - x) / B;
	else
		tmp = -x / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -3.05e-120], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.05 \cdot 10^{-120}:\\
\;\;\;\;\frac{-1 - x}{B}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -3.05e-120

    1. Initial program 70.0%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. associate-*r/40.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in40.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval40.9%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-140.9%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    6. Simplified40.9%

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

    if -3.05e-120 < F

    1. Initial program 76.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 40.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. associate-*r/21.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in21.8%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval21.8%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-121.8%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    6. Simplified21.8%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    7. Taylor expanded in x around inf 30.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    8. Step-by-step derivation
      1. mul-1-neg30.4%

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-neg-frac30.4%

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    9. Simplified30.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.05 \cdot 10^{-120}:\\ \;\;\;\;\frac{-1 - x}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 29.6% accurate, 35.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;F \leq -6.5 \cdot 10^{+63}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \end{array} \]
(FPCore (F B x)
 :precision binary64
 (if (<= F -6.5e+63) (/ -1.0 B) (/ (- x) B)))
double code(double F, double B, double x) {
	double tmp;
	if (F <= -6.5e+63) {
		tmp = -1.0 / B;
	} else {
		tmp = -x / B;
	}
	return tmp;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (f <= (-6.5d+63)) then
        tmp = (-1.0d0) / b
    else
        tmp = -x / b
    end if
    code = tmp
end function
public static double code(double F, double B, double x) {
	double tmp;
	if (F <= -6.5e+63) {
		tmp = -1.0 / B;
	} else {
		tmp = -x / B;
	}
	return tmp;
}
def code(F, B, x):
	tmp = 0
	if F <= -6.5e+63:
		tmp = -1.0 / B
	else:
		tmp = -x / B
	return tmp
function code(F, B, x)
	tmp = 0.0
	if (F <= -6.5e+63)
		tmp = Float64(-1.0 / B);
	else
		tmp = Float64(Float64(-x) / B);
	end
	return tmp
end
function tmp_2 = code(F, B, x)
	tmp = 0.0;
	if (F <= -6.5e+63)
		tmp = -1.0 / B;
	else
		tmp = -x / B;
	end
	tmp_2 = tmp;
end
code[F_, B_, x_] := If[LessEqual[F, -6.5e+63], N[(-1.0 / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.5 \cdot 10^{+63}:\\
\;\;\;\;\frac{-1}{B}\\

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


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

    1. Initial program 46.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 99.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. associate-*r/45.9%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in45.9%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval45.9%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-145.9%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    6. Simplified45.9%

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

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

    if -6.49999999999999992e63 < F

    1. Initial program 80.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 44.3%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
    5. Step-by-step derivation
      1. associate-*r/24.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
      2. distribute-lft-in24.1%

        \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
      3. metadata-eval24.1%

        \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
      4. neg-mul-124.1%

        \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
    6. Simplified24.1%

      \[\leadsto \color{blue}{\frac{-1 + \left(-x\right)}{B}} \]
    7. Taylor expanded in x around inf 30.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{B}} \]
    8. Step-by-step derivation
      1. mul-1-neg30.7%

        \[\leadsto \color{blue}{-\frac{x}{B}} \]
      2. distribute-neg-frac30.7%

        \[\leadsto \color{blue}{\frac{-x}{B}} \]
    9. Simplified30.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -6.5 \cdot 10^{+63}:\\ \;\;\;\;\frac{-1}{B}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 10.4% accurate, 108.0× speedup?

\[\begin{array}{l} \\ \frac{-1}{B} \end{array} \]
(FPCore (F B x) :precision binary64 (/ -1.0 B))
double code(double F, double B, double x) {
	return -1.0 / B;
}
real(8) function code(f, b, x)
    real(8), intent (in) :: f
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = (-1.0d0) / b
end function
public static double code(double F, double B, double x) {
	return -1.0 / B;
}
def code(F, B, x):
	return -1.0 / B
function code(F, B, x)
	return Float64(-1.0 / B)
end
function tmp = code(F, B, x)
	tmp = -1.0 / B;
end
code[F_, B_, x_] := N[(-1.0 / B), $MachinePrecision]
\begin{array}{l}

\\
\frac{-1}{B}
\end{array}
Derivation
  1. Initial program 74.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 54.7%

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

    \[\leadsto \color{blue}{-1 \cdot \frac{1 + x}{B}} \]
  5. Step-by-step derivation
    1. associate-*r/28.2%

      \[\leadsto \color{blue}{\frac{-1 \cdot \left(1 + x\right)}{B}} \]
    2. distribute-lft-in28.2%

      \[\leadsto \frac{\color{blue}{-1 \cdot 1 + -1 \cdot x}}{B} \]
    3. metadata-eval28.2%

      \[\leadsto \frac{\color{blue}{-1} + -1 \cdot x}{B} \]
    4. neg-mul-128.2%

      \[\leadsto \frac{-1 + \color{blue}{\left(-x\right)}}{B} \]
  6. Simplified28.2%

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

    \[\leadsto \color{blue}{\frac{-1}{B}} \]
  8. Final simplification9.4%

    \[\leadsto \frac{-1}{B} \]
  9. Add Preprocessing

Reproduce

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