VandenBroeck and Keller, Equation (24)

Percentage Accurate: 99.7% → 99.8%
Time: 8.8s
Alternatives: 11
Speedup: 1.0×

Specification

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

\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}
\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 11 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: 99.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
\frac{1}{\sin B} - \frac{x}{\tan B}
\end{array}
Derivation
  1. Initial program 99.7%

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
  2. Step-by-step derivation
    1. distribute-lft-neg-in99.7%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
    3. *-commutative99.7%

      \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
    4. remove-double-neg99.7%

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

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

      \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
    7. cancel-sign-sub-inv99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
    8. associate-*l/99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
    9. *-lft-identity99.8%

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

      \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
    11. distribute-neg-frac299.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
    12. distribute-neg-frac99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
    13. remove-double-neg99.8%

      \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 98.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -38 \lor \neg \left(x \leq 100\right):\\
\;\;\;\;\sin B - \frac{x}{\tan B}\\

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


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

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.7%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.7%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log48.2%

        \[\leadsto \color{blue}{e^{\log \left(\frac{1}{\sin B}\right)}} - \frac{x}{\tan B} \]
      2. log-rec48.2%

        \[\leadsto e^{\color{blue}{-\log \sin B}} - \frac{x}{\tan B} \]
    6. Applied egg-rr48.2%

      \[\leadsto \color{blue}{e^{-\log \sin B}} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt48.2%

        \[\leadsto e^{\color{blue}{\sqrt{-\log \sin B} \cdot \sqrt{-\log \sin B}}} - \frac{x}{\tan B} \]
      2. sqrt-unprod48.2%

        \[\leadsto e^{\color{blue}{\sqrt{\left(-\log \sin B\right) \cdot \left(-\log \sin B\right)}}} - \frac{x}{\tan B} \]
      3. sqr-neg48.2%

        \[\leadsto e^{\sqrt{\color{blue}{\log \sin B \cdot \log \sin B}}} - \frac{x}{\tan B} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{\color{blue}{\sqrt{\log \sin B} \cdot \sqrt{\log \sin B}}} - \frac{x}{\tan B} \]
      5. add-sqr-sqrt48.2%

        \[\leadsto e^{\color{blue}{\log \sin B}} - \frac{x}{\tan B} \]
      6. add-exp-log99.1%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
      7. *-un-lft-identity99.1%

        \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    8. Applied egg-rr99.1%

      \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. *-lft-identity99.1%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
    10. Simplified99.1%

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

    if -38 < x < 100

    1. Initial program 99.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.8%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.8%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\left(-\left(-\frac{1}{\tan B}\right)\right)} \cdot \left(-x\right) \]
      5. distribute-frac-neg299.8%

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.8%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. tan-quot99.8%

        \[\leadsto \frac{1}{\sin B} - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}} \]
      2. associate-/r/99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
    6. Applied egg-rr99.8%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    8. Step-by-step derivation
      1. div-sub99.8%

        \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    9. Simplified99.8%

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

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

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

Alternative 3: 98.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq 102000:\\
\;\;\;\;\frac{1 - x}{\sin B}\\

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


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

    1. Initial program 99.7%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.7%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.7%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.7%

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

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

        \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
      7. cancel-sign-sub-inv99.7%

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.6%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.6%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log39.8%

        \[\leadsto \color{blue}{e^{\log \left(\frac{1}{\sin B}\right)}} - \frac{x}{\tan B} \]
      2. log-rec39.8%

        \[\leadsto e^{\color{blue}{-\log \sin B}} - \frac{x}{\tan B} \]
    6. Applied egg-rr39.8%

      \[\leadsto \color{blue}{e^{-\log \sin B}} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt39.8%

        \[\leadsto e^{\color{blue}{\sqrt{-\log \sin B} \cdot \sqrt{-\log \sin B}}} - \frac{x}{\tan B} \]
      2. sqrt-unprod39.8%

        \[\leadsto e^{\color{blue}{\sqrt{\left(-\log \sin B\right) \cdot \left(-\log \sin B\right)}}} - \frac{x}{\tan B} \]
      3. sqr-neg39.8%

        \[\leadsto e^{\sqrt{\color{blue}{\log \sin B \cdot \log \sin B}}} - \frac{x}{\tan B} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{\color{blue}{\sqrt{\log \sin B} \cdot \sqrt{\log \sin B}}} - \frac{x}{\tan B} \]
      5. add-sqr-sqrt39.8%

        \[\leadsto e^{\color{blue}{\log \sin B}} - \frac{x}{\tan B} \]
      6. add-exp-log98.2%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
      7. *-un-lft-identity98.2%

        \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    8. Applied egg-rr98.2%

      \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. *-lft-identity98.2%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
    10. Simplified98.2%

      \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
    11. Step-by-step derivation
      1. div-inv98.2%

        \[\leadsto \sin B - \color{blue}{x \cdot \frac{1}{\tan B}} \]
      2. *-commutative98.2%

        \[\leadsto \sin B - \color{blue}{\frac{1}{\tan B} \cdot x} \]
    12. Applied egg-rr98.2%

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

    if -62 < x < 102000

    1. Initial program 99.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.8%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.8%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\left(-\left(-\frac{1}{\tan B}\right)\right)} \cdot \left(-x\right) \]
      5. distribute-frac-neg299.8%

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.8%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. tan-quot99.8%

        \[\leadsto \frac{1}{\sin B} - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}} \]
      2. associate-/r/99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
    6. Applied egg-rr99.8%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    8. Step-by-step derivation
      1. div-sub99.8%

        \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    9. Simplified99.8%

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

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

    if 102000 < x

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.5%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.5%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.5%

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

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

        \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
      7. cancel-sign-sub-inv99.5%

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.7%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.7%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log54.2%

        \[\leadsto \color{blue}{e^{\log \left(\frac{1}{\sin B}\right)}} - \frac{x}{\tan B} \]
      2. log-rec54.2%

        \[\leadsto e^{\color{blue}{-\log \sin B}} - \frac{x}{\tan B} \]
    6. Applied egg-rr54.2%

      \[\leadsto \color{blue}{e^{-\log \sin B}} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt54.2%

        \[\leadsto e^{\color{blue}{\sqrt{-\log \sin B} \cdot \sqrt{-\log \sin B}}} - \frac{x}{\tan B} \]
      2. sqrt-unprod54.2%

        \[\leadsto e^{\color{blue}{\sqrt{\left(-\log \sin B\right) \cdot \left(-\log \sin B\right)}}} - \frac{x}{\tan B} \]
      3. sqr-neg54.2%

        \[\leadsto e^{\sqrt{\color{blue}{\log \sin B \cdot \log \sin B}}} - \frac{x}{\tan B} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{\color{blue}{\sqrt{\log \sin B} \cdot \sqrt{\log \sin B}}} - \frac{x}{\tan B} \]
      5. add-sqr-sqrt54.2%

        \[\leadsto e^{\color{blue}{\log \sin B}} - \frac{x}{\tan B} \]
      6. add-exp-log99.7%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
      7. *-un-lft-identity99.7%

        \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    8. Applied egg-rr99.7%

      \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. *-lft-identity99.7%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
    10. Simplified99.7%

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

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

Alternative 4: 98.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -62:\\ \;\;\;\;\left(-x\right) \cdot \frac{\cos B}{\sin B}\\ \mathbf{elif}\;x \leq 105000:\\ \;\;\;\;\frac{1 - x}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\sin B - \frac{x}{\tan B}\\ \end{array} \end{array} \]
(FPCore (B x)
 :precision binary64
 (if (<= x -62.0)
   (* (- x) (/ (cos B) (sin B)))
   (if (<= x 105000.0) (/ (- 1.0 x) (sin B)) (- (sin B) (/ x (tan B))))))
double code(double B, double x) {
	double tmp;
	if (x <= -62.0) {
		tmp = -x * (cos(B) / sin(B));
	} else if (x <= 105000.0) {
		tmp = (1.0 - x) / sin(B);
	} else {
		tmp = sin(B) - (x / tan(B));
	}
	return tmp;
}
real(8) function code(b, x)
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= (-62.0d0)) then
        tmp = -x * (cos(b) / sin(b))
    else if (x <= 105000.0d0) then
        tmp = (1.0d0 - x) / sin(b)
    else
        tmp = sin(b) - (x / tan(b))
    end if
    code = tmp
end function
public static double code(double B, double x) {
	double tmp;
	if (x <= -62.0) {
		tmp = -x * (Math.cos(B) / Math.sin(B));
	} else if (x <= 105000.0) {
		tmp = (1.0 - x) / Math.sin(B);
	} else {
		tmp = Math.sin(B) - (x / Math.tan(B));
	}
	return tmp;
}
def code(B, x):
	tmp = 0
	if x <= -62.0:
		tmp = -x * (math.cos(B) / math.sin(B))
	elif x <= 105000.0:
		tmp = (1.0 - x) / math.sin(B)
	else:
		tmp = math.sin(B) - (x / math.tan(B))
	return tmp
function code(B, x)
	tmp = 0.0
	if (x <= -62.0)
		tmp = Float64(Float64(-x) * Float64(cos(B) / sin(B)));
	elseif (x <= 105000.0)
		tmp = Float64(Float64(1.0 - x) / sin(B));
	else
		tmp = Float64(sin(B) - Float64(x / tan(B)));
	end
	return tmp
end
function tmp_2 = code(B, x)
	tmp = 0.0;
	if (x <= -62.0)
		tmp = -x * (cos(B) / sin(B));
	elseif (x <= 105000.0)
		tmp = (1.0 - x) / sin(B);
	else
		tmp = sin(B) - (x / tan(B));
	end
	tmp_2 = tmp;
end
code[B_, x_] := If[LessEqual[x, -62.0], N[((-x) * N[(N[Cos[B], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 105000.0], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[Sin[B], $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -62:\\
\;\;\;\;\left(-x\right) \cdot \frac{\cos B}{\sin B}\\

\mathbf{elif}\;x \leq 105000:\\
\;\;\;\;\frac{1 - x}{\sin B}\\

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


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

    1. Initial program 99.7%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.7%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.7%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.7%

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

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

        \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
      7. cancel-sign-sub-inv99.7%

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.6%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.6%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 98.0%

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

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

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

        \[\leadsto \color{blue}{\left(-x\right) \cdot \frac{\cos B}{\sin B}} \]
    7. Simplified98.2%

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

    if -62 < x < 105000

    1. Initial program 99.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.8%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.8%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\left(-\left(-\frac{1}{\tan B}\right)\right)} \cdot \left(-x\right) \]
      5. distribute-frac-neg299.8%

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.8%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. tan-quot99.8%

        \[\leadsto \frac{1}{\sin B} - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}} \]
      2. associate-/r/99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
    6. Applied egg-rr99.8%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
    8. Step-by-step derivation
      1. div-sub99.8%

        \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
    9. Simplified99.8%

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

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

    if 105000 < x

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.5%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.5%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.5%

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

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

        \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
      7. cancel-sign-sub-inv99.5%

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.7%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.7%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log54.2%

        \[\leadsto \color{blue}{e^{\log \left(\frac{1}{\sin B}\right)}} - \frac{x}{\tan B} \]
      2. log-rec54.2%

        \[\leadsto e^{\color{blue}{-\log \sin B}} - \frac{x}{\tan B} \]
    6. Applied egg-rr54.2%

      \[\leadsto \color{blue}{e^{-\log \sin B}} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt54.2%

        \[\leadsto e^{\color{blue}{\sqrt{-\log \sin B} \cdot \sqrt{-\log \sin B}}} - \frac{x}{\tan B} \]
      2. sqrt-unprod54.2%

        \[\leadsto e^{\color{blue}{\sqrt{\left(-\log \sin B\right) \cdot \left(-\log \sin B\right)}}} - \frac{x}{\tan B} \]
      3. sqr-neg54.2%

        \[\leadsto e^{\sqrt{\color{blue}{\log \sin B \cdot \log \sin B}}} - \frac{x}{\tan B} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{\color{blue}{\sqrt{\log \sin B} \cdot \sqrt{\log \sin B}}} - \frac{x}{\tan B} \]
      5. add-sqr-sqrt54.2%

        \[\leadsto e^{\color{blue}{\log \sin B}} - \frac{x}{\tan B} \]
      6. add-exp-log99.7%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
      7. *-un-lft-identity99.7%

        \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    8. Applied egg-rr99.7%

      \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. *-lft-identity99.7%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
    10. Simplified99.7%

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

Alternative 5: 63.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.0072:\\
\;\;\;\;\frac{\left(1 + \left(B \cdot B\right) \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right)\right) - x}{B}\\

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


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

    1. Initial program 99.7%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.7%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.7%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.7%

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

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

        \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
      7. cancel-sign-sub-inv99.7%

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.8%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Taylor expanded in B around 0 59.9%

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

        \[\leadsto \frac{\left(1 + \color{blue}{\left(B \cdot B\right)} \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)\right) - x}{B} \]
    7. Applied egg-rr59.9%

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

    if 0.0071999999999999998 < B

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.6%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.6%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 47.8%

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

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

Alternative 6: 53.0% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.55:\\
\;\;\;\;\frac{\left(1 + \left(B \cdot B\right) \cdot \left(0.16666666666666666 + x \cdot 0.3333333333333333\right)\right) - x}{B}\\

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


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

    1. Initial program 99.7%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.7%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.7%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.7%

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

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

        \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
      7. cancel-sign-sub-inv99.7%

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.8%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Taylor expanded in B around 0 60.0%

      \[\leadsto \color{blue}{\frac{\left(1 + {B}^{2} \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)\right) - x}{B}} \]
    6. Step-by-step derivation
      1. unpow260.0%

        \[\leadsto \frac{\left(1 + \color{blue}{\left(B \cdot B\right)} \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)\right) - x}{B} \]
    7. Applied egg-rr60.0%

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

    if 1.55000000000000004 < B

    1. Initial program 99.6%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.6%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.6%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.6%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-exp-log43.5%

        \[\leadsto \color{blue}{e^{\log \left(\frac{1}{\sin B}\right)}} - \frac{x}{\tan B} \]
      2. log-rec43.5%

        \[\leadsto e^{\color{blue}{-\log \sin B}} - \frac{x}{\tan B} \]
    6. Applied egg-rr43.5%

      \[\leadsto \color{blue}{e^{-\log \sin B}} - \frac{x}{\tan B} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt43.5%

        \[\leadsto e^{\color{blue}{\sqrt{-\log \sin B} \cdot \sqrt{-\log \sin B}}} - \frac{x}{\tan B} \]
      2. sqrt-unprod43.5%

        \[\leadsto e^{\color{blue}{\sqrt{\left(-\log \sin B\right) \cdot \left(-\log \sin B\right)}}} - \frac{x}{\tan B} \]
      3. sqr-neg43.5%

        \[\leadsto e^{\sqrt{\color{blue}{\log \sin B \cdot \log \sin B}}} - \frac{x}{\tan B} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{\color{blue}{\sqrt{\log \sin B} \cdot \sqrt{\log \sin B}}} - \frac{x}{\tan B} \]
      5. add-sqr-sqrt30.1%

        \[\leadsto e^{\color{blue}{\log \sin B}} - \frac{x}{\tan B} \]
      6. add-exp-log61.5%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
      7. *-un-lft-identity61.5%

        \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    8. Applied egg-rr61.5%

      \[\leadsto \color{blue}{1 \cdot \sin B} - \frac{x}{\tan B} \]
    9. Step-by-step derivation
      1. *-lft-identity61.5%

        \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
    10. Simplified61.5%

      \[\leadsto \color{blue}{\sin B} - \frac{x}{\tan B} \]
    11. Taylor expanded in x around 0 11.1%

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

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

Alternative 7: 76.9% accurate, 2.0× speedup?

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

\\
\frac{1 - x}{\sin B}
\end{array}
Derivation
  1. Initial program 99.7%

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
  2. Step-by-step derivation
    1. distribute-lft-neg-in99.7%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
    3. *-commutative99.7%

      \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
    4. remove-double-neg99.7%

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

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

      \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
    7. cancel-sign-sub-inv99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
    8. associate-*l/99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
    9. *-lft-identity99.8%

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

      \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
    11. distribute-neg-frac299.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
    12. distribute-neg-frac99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
    13. remove-double-neg99.8%

      \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. tan-quot99.7%

      \[\leadsto \frac{1}{\sin B} - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}} \]
    2. associate-/r/99.7%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{x}{\sin B} \cdot \cos B} \]
  6. Applied egg-rr99.7%

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

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x \cdot \cos B}{\sin B}} \]
  8. Step-by-step derivation
    1. div-sub99.7%

      \[\leadsto \color{blue}{\frac{1 - x \cdot \cos B}{\sin B}} \]
  9. Simplified99.7%

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

    \[\leadsto \frac{1 - \color{blue}{x}}{\sin B} \]
  11. Add Preprocessing

Alternative 8: 49.2% accurate, 14.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 2.3 \cdot 10^{+14}\right):\\
\;\;\;\;\frac{x}{-B}\\

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


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

    1. Initial program 99.5%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.5%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.5%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.5%

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

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

        \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
      7. cancel-sign-sub-inv99.5%

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.7%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.7%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.7%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Taylor expanded in B around 0 37.8%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot x}{B}} \]
      2. neg-mul-137.2%

        \[\leadsto \frac{\color{blue}{-x}}{B} \]
    8. Simplified37.2%

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

    if -1 < x < 2.3e14

    1. Initial program 99.8%

      \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
    2. Step-by-step derivation
      1. distribute-lft-neg-in99.8%

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
      3. *-commutative99.8%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
      4. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} + \color{blue}{\left(-\left(-\frac{1}{\tan B}\right)\right)} \cdot \left(-x\right) \]
      5. distribute-frac-neg299.8%

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

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

        \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
      8. associate-*l/99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
      9. *-lft-identity99.8%

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

        \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
      11. distribute-neg-frac299.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
      12. distribute-neg-frac99.8%

        \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
      13. remove-double-neg99.8%

        \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
    4. Add Preprocessing
    5. Taylor expanded in B around 0 49.9%

      \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
    6. Taylor expanded in x around 0 48.6%

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

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

Alternative 9: 50.8% accurate, 42.0× speedup?

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

\\
\frac{1 - x}{B}
\end{array}
Derivation
  1. Initial program 99.7%

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
  2. Step-by-step derivation
    1. distribute-lft-neg-in99.7%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
    3. *-commutative99.7%

      \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
    4. remove-double-neg99.7%

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

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

      \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
    7. cancel-sign-sub-inv99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
    8. associate-*l/99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
    9. *-lft-identity99.8%

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

      \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
    11. distribute-neg-frac299.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
    12. distribute-neg-frac99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
    13. remove-double-neg99.8%

      \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
  4. Add Preprocessing
  5. Taylor expanded in B around 0 44.3%

    \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  6. Add Preprocessing

Alternative 10: 26.2% accurate, 70.0× speedup?

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

\\
\frac{1}{B}
\end{array}
Derivation
  1. Initial program 99.7%

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
  2. Step-by-step derivation
    1. distribute-lft-neg-in99.7%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
    3. *-commutative99.7%

      \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
    4. remove-double-neg99.7%

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

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

      \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
    7. cancel-sign-sub-inv99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
    8. associate-*l/99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
    9. *-lft-identity99.8%

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

      \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
    11. distribute-neg-frac299.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
    12. distribute-neg-frac99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
    13. remove-double-neg99.8%

      \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
  4. Add Preprocessing
  5. Taylor expanded in B around 0 44.3%

    \[\leadsto \color{blue}{\frac{1 - x}{B}} \]
  6. Taylor expanded in x around 0 26.9%

    \[\leadsto \color{blue}{\frac{1}{B}} \]
  7. Add Preprocessing

Alternative 11: 3.1% accurate, 70.0× speedup?

\[\begin{array}{l} \\ B \cdot 0.16666666666666666 \end{array} \]
(FPCore (B x) :precision binary64 (* B 0.16666666666666666))
double code(double B, double x) {
	return B * 0.16666666666666666;
}
real(8) function code(b, x)
    real(8), intent (in) :: b
    real(8), intent (in) :: x
    code = b * 0.16666666666666666d0
end function
public static double code(double B, double x) {
	return B * 0.16666666666666666;
}
def code(B, x):
	return B * 0.16666666666666666
function code(B, x)
	return Float64(B * 0.16666666666666666)
end
function tmp = code(B, x)
	tmp = B * 0.16666666666666666;
end
code[B_, x_] := N[(B * 0.16666666666666666), $MachinePrecision]
\begin{array}{l}

\\
B \cdot 0.16666666666666666
\end{array}
Derivation
  1. Initial program 99.7%

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B} \]
  2. Step-by-step derivation
    1. distribute-lft-neg-in99.7%

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

      \[\leadsto \color{blue}{\frac{1}{\sin B} + \left(-x\right) \cdot \frac{1}{\tan B}} \]
    3. *-commutative99.7%

      \[\leadsto \frac{1}{\sin B} + \color{blue}{\frac{1}{\tan B} \cdot \left(-x\right)} \]
    4. remove-double-neg99.7%

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

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

      \[\leadsto \frac{1}{\sin B} + \left(-\frac{1}{\color{blue}{\tan \left(-B\right)}}\right) \cdot \left(-x\right) \]
    7. cancel-sign-sub-inv99.7%

      \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{1}{\tan \left(-B\right)} \cdot \left(-x\right)} \]
    8. associate-*l/99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{1 \cdot \left(-x\right)}{\tan \left(-B\right)}} \]
    9. *-lft-identity99.8%

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

      \[\leadsto \frac{1}{\sin B} - \frac{-x}{\color{blue}{-\tan B}} \]
    11. distribute-neg-frac299.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\left(-\frac{-x}{\tan B}\right)} \]
    12. distribute-neg-frac99.8%

      \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{-\left(-x\right)}{\tan B}} \]
    13. remove-double-neg99.8%

      \[\leadsto \frac{1}{\sin B} - \frac{\color{blue}{x}}{\tan B} \]
  3. Simplified99.8%

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}} \]
  4. Add Preprocessing
  5. Taylor expanded in B around 0 44.1%

    \[\leadsto \color{blue}{\frac{\left(1 + {B}^{2} \cdot \left(0.16666666666666666 + 0.3333333333333333 \cdot x\right)\right) - x}{B}} \]
  6. Taylor expanded in x around 0 44.1%

    \[\leadsto \frac{\left(1 + \color{blue}{0.16666666666666666 \cdot {B}^{2}}\right) - x}{B} \]
  7. Step-by-step derivation
    1. *-commutative44.1%

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

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

    \[\leadsto \color{blue}{0.16666666666666666 \cdot B} \]
  10. Step-by-step derivation
    1. *-commutative3.0%

      \[\leadsto \color{blue}{B \cdot 0.16666666666666666} \]
  11. Simplified3.0%

    \[\leadsto \color{blue}{B \cdot 0.16666666666666666} \]
  12. Add Preprocessing

Reproduce

?
herbie shell --seed 2024131 
(FPCore (B x)
  :name "VandenBroeck and Keller, Equation (24)"
  :precision binary64
  (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 (sin B))))